How to integrate iPhone with other non iPhone devices using serial port? - iphone

Anybody knows how to integrate iPhone with other non-iPhone devices using serial port?

You can't directly. There may be some sort of serial line (i2c) on the dock connecter, but it is not exposed through the SDK, the Made for iPhone/ExternalAccessory.framework stuff is only for USB and BT.
You could conceivably use a WiFi/serial bridge (such things do exist) since you can send whatever you want over a TCP tunnel, but I doubt that is what you want.

Underlying ExternalAccessoryFramework for 30-pin connector it's the real UART handshaking (using Tx, Rx, Gnd, Vcc and some detect pins and no flow control) but not USB. Those pins of USB are only used for iTunes, Xcode and powering. The iOS app does not need to understand UART and only needs to send/receive bytes through NSOutputStream and NSInputStream.
But you need to pay Apple for MFi(Made For iPhone) Program first and buy some confidential IC to enable your accessory to communicate with iOS. They will require you to propose a product plan and expected sales and consider whether they would accept you as a MFi manufacturer.

You can get the info on using the ExternalAccessory framework from apple's developer portal.
You can't get the required serial handshake(?) info without joining the Made for iPhone program. This requires that you are developing a commercial device.
I have tried to get information on this protocol from apple through my university and have thus far failed.

I successfully received serial communication from the Arduino on the iPhone. I made a google doc explaining my process.
https://docs.google.com/document/d/1Yi9_hcw8XSyYNCG2OJT9oHlTG-dC-Dnuc58VIULa81Q/edit

Related

Create an iPad app that can send/receive data via the USB cable?

I want to create an iPad app that connects to another machine, laptop or otherwise, via USB and communicates to some other application I develop running there.
I know that this is easy to achieve via Bluetooth or WiFi but this particular set of solutions must be done via a USB cable.
Is it possible to do so without access to the Apple MFi program? (I am about 5 weeks in and the response is not looking good).
iOS App --> USB Cable --> Mac OSX --> Desktop App (without MFi access)
Thanks
To use USB communication Apple does not provide any API within IOS SDK. The only option right now is MFI. I don't think Apple will allow this in near future.
To use serial communication, you need MFI as you may have discovered. However, there is a poor man's way of achieving this. I have done so during development.
Enable "Internet sharing" on your device and connect to it. Use "ifconfig" on your Mac to find out the interface to use. You do not need to use this as the default connection, but it needs to be active. If I remember correctly, only one end can initiate connections (it was a while so I am sorry that I don't remember the details).
EDIT: I would also like to point out that I did this on an iPhone, not an iPad.
Not over USB but over RS232 (serial port)
Look here: http://www.redpark.com/c2db9.html
But:
The cable uses the old 30 pin connector, but according to them it's compatible with the Lightning adapter
The application won't be accepted on the AppStore, it's for internal use only.
There is a (small) book that explains how to use this cable to connect an iPhone directly to an Arduino, it's been published in late 2011. "iOS Sensor Apps with Arduino Wiring the iPhone and iPad into the Internet of Things" http://shop.oreilly.com/product/0636920021179.do

Is it possible to make a (non jailbroken) iPhone emit i2c commands?

I want to control a string of LEDs directly from my iPhone. The LED controller chips talk the i2c serial protocol.
Can I do this with Apple-supported APIs on a non-jailbroken iPhone? Which frameworks do I need to use?
Yes, but you will need an external hardware to do that. iOS does not give you access directly to I2C in the docking connector.
KissBos has a OEM board to do that, with a special firmware. You can connect to their board via WiFi, using a TCP based protocol, or via a RTP-MIDI based protocol (RTP-MIDI is implemented in iOS, you don't have to deal with the protocol details, it's just a MIDI port for your application).
If you want to go through the dock connector, you will need their USB interface (it will transform the USB into RTP-MIDI, which goes in the OEM board)
I'm quite sure that you can't do that. Apple is very strict about what you are allowed to and not. I spent days trying to find a way to get access to the iphone's bluetooth layer and ended up with my head against the wall (only a limited game api is public, else you have to go with the Made For Iphone program). However, you are able to do some stuff using the usb cable, but I guess that the possibilities are limited with that too.

Establish communication link between a device and iOS

I'm developing an iPhone/iPad app that requires it communicate with another device. I'm actually more interested in receiving input from another device that the iPhone is connected to through USB. The solution needs to work with any iOS device and cannot require it to be jailbroken.
I've heard of apps that communicate with a piece of hardware that can be plugged to the iOS' serial connection, which is similar to what I'm going to develop except that the other device I'll be connecting to is a standalone music keyboard.
best regards,
fbr
If you are developing accessories that need to connect to iOS devices and want to use your own communication mechanism then you need to join the Apple MFi program.
Several options:
Forget MFi unless you have 1000s of $ backing up your product development. Apple won't even talk to you. I've tried.
Take a look at the Serial Cable from Redpark (http://redpark.com/c2db9.html)
I've got one of those and it's ideal for apps that you can deliver on your own, but you might also be able to get them into the App Store.
Another option is to use Wifi with a Wifi-to-Serial adapter on the other end. I've used the RN-174 and RN-134 from Roving Networks successfully.
However, these solutions only get you Serial connections, but can be quite fast, especially with the RN modules. There are also Serial-to-USB converters you can use on the device's end, but that would require the device to work as a USB host, usually. If you have a USB device that wants to act as a client, these common adapters won't do the trick.
So, unless you can actually afford the MFi program, and if you really need USB connectivity, you'll have to let someone create a small box containing a USB host adapter with a Wifi chip. I don't know of a ready-made solution for this yet, although I've seen quite a few area where people would like to have such a unit.

Listening on USB port for data in iPhone App

I am wanting to send data over the usb on the iphone and have it captured by my application. This application will be private and not sold. I would also like to just use the standard usb cable that is standard. Is this possible?
This is possible with Apple's MFI Program. The downside is this will probably be quite expensive and you will of course have to develop a piece of hardware that can be sold as a product for your application.
EDIT: If you look at the 'iOS Accessories' section on the MFI Program link above, it suggests that you can communicate over the 30-pin usb dock connector.

can iphone use as a receiver?

Can iphone use as a receiver ? Let's say, there will be one app which can connect with a hardware that can send RDF signal. Is that possible iphone to receive signal without any additional hardware ? Thanks.
It's not possible without any additional hardware.
In order to make peripherals work with iPhone you need to contact Apple and become a registered peripheral developer, the membership that allows manufacturers to use the "Made for iPhone" etc labels.
Once you're a member you can get access to the peripherals SDK which allows you to develop for devices that connect to the iPhone using the 30 pin dock connector.
Without developing a device that receives RDF signal that can connect to the iPhone either using the dock connector or a network connection, there's no other way to make the iPhone receive that signal.
If the RDF hardware is able to communicate using standard UDP or TCP/IP based methods then the iPhone can communicate with it using network communication classes. This could be CFNetwork or higher level classes such as NSURLConnection.