Making an iPhone-controlled robot
We recently presented a list of commercially available robots that use your iPhone (or in some cases, Android) phone or iPod Touch as the robot brains. This makes a lot of sense, given all the sensors, networking, input/output, and raw computing power you probably already have in your pocket. But a good robot hobbyist is never satisfied with an off-the-shelf robot; how can you harness this power in your own projects?
The best way, if you can manage it, is one of the official interface cables from Redpark. These are official (Apple-approved) serial adapters for the older 30-pin connector, or the Lightning connector on newer devices. Among the 30-pin options are a TTL version, which gives you a 57.6 kbps logic-level serial connection you can easily interface with your other electronics.
If your device has the Lightning connector instead, you can still use this cable with one of the standard 30-pin-to-Lightning adapter dongles. Redpark expected to have a Lightning version of the cable available “before the end of 2013,” but apparently are running a bit behind schedule.
The biggest drawback to this connector is that all the electronics are at the phone end, making a big, bulky brick that sticks out of your phone. This limits your options when it comes to mounting the phone, especially if you want to use it as your robot’s face. However, if you do get the 30-pin Redpark cable and a Lightning device, then this problem is neatly solved by selecting an adapter with a short cable, like this one.
The other problem, for robot use, is the meter-long cable on the Redpark device; that’s a lot of unnecessary weight and bulk for a robot to lug around. However, in this case having all the electronics at the phone end is a good thing, since it makes shortening the 6-conductor cable a trivial hack.
So, apart from the Redpark cable, what other options are there? Well, if feeling bold you could build it yourself, as shown here (click on the right-arrow on the image to get to the actual content). Since on a robot you just want logic-level serial (rather than true RS-232), you can skip many of the steps shown. This approach requires you to jailbreak your phone, and runs a higher risk of damaging it, but if you’re both brave and short on cash, it could be a viable option.
Another option is to connect to your phone via Bluetooth. More specifically, Bluetooth Low Energy (BTLE), often called Bluetooth Smart by marketing types. Unlike regular Bluetooth, which you can’t use from your apps unless you’re a registered Apple hardware developer, any software developer can use BTLE to talk to any BTLE device. This connectBlue device might be just the thing for interfacing with your projects; connection speeds up to 115.2 kbps are claimed. I’ve worked with BTLE in iOS, and it’s not like a serial port; it’s all very event-driven and based on very small packets without guaranteed delivery. So it’s a bit of a pain in the neck, but it could work.
Finally, you could replicate the trick that several of the off-the-shelf robots use: communicate with your iPhone via the audio port. This audio jack modem (which is better documented here) gives you about 1200 bps (yes, that’s baud, not kilobaud), and occasionally corrupts the data, but if you don’t need to move back and forth and you include some error checking in your protocol, it may do the trick.
And that’s about it. There only a few reasonable ways to get data in and out of your iPhone to a nearby device: the sync connector, the Bluetooth radio, and the audio port. Of these, the sync connector via the Redpark cable is probably the best bet in most cases.
But what do you think? Have I missed any other good options? If so, please share your thoughts in the comments below!