Let's Make Robots!

arduino controlled by iphone

Hi guys! i want to realize my project to control arduino with my iphone ( maybe through TouchOsc?) but i don't know if it's better use a xbee wifi module or a bluetooth module.

Thanks for the answers:)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

has bluetooth built in. The xbee protocol I am not sure about, but, would say probably not there. Bluetooth, depending on class of transceiver, has a range from about 5m to about 100m. xbee's can transfer data over greater distances at lower speeds.

iOS doesn't support Bluetooth SPP profile, to directly talk to a BT module, only theses BT profiles are supported. You will need a PC as man in the middle to talk Wifi to your phone and BT/XBEE to your arduino. Or you can get an Arduino WiFi shield to talk directly between iPhone and Arduino via UDP. TouchOSC for example, uses UDP for communication. Don't know if an OSC library exists for Arduino.

XBEE is a proprietary protocol, not WiFi.


Thanks:) Is there any tutorial showing how to interface wifly shield with arduino and iphone?


Recotana has done some stuff with OSC, iPhone and Arduino. But he uses a Network shield, not a WiFly shield.

I have just done a short test with an Arduino + WiFly shield and an iPod touch:

The WiFly shield runs in Adhoc mode and creates an open Adhoc network and runs the UDP protocol on Port 2000. All preferences were done manually in terminal mode.

The iPod touch (2nd generation iOS 4.2.1) can connect to this Adhoc network. After starting an OSC app (Mrmr App in this case), I can send OSC messages to the Arduino+WiFly.

The Arduino runs the SpiUartTerminal sketch from the WiFly Library. The received  OSC messages are send to the Arduino IDE Terminal. But I have no sketch to interprete the OSC messages.


Thanks a lot:) now i have to decide how to control my arduino via wirelss. Bluetooth, wifi or ir: this is the question!

so it's better to use the wifly shield in order to connect directly iphone to arduino right? and what about the implementation?i've already used TouchOsc but the arduino was connected via usb. i don't need to use processing with the wiflyshield?o.O

Thus is an interesting idea, but as others said, I think you're going to need a man in the middle. However, others suggested a pc, but I think I have a better idea: a hackable linksys router. It has wifi already (obviously), runs Linux and (I'm 99% sure) can easily be hacked to have USB. So it can talk to a xbee-equipped arduino, which can talk to your bot. You can even put it all into a new enclosure, use the routers power and it'll be quite portable, contained and reusable that way.

mmm that would be nice:) But RobotFreak said that it can connect directly iphone and arduino via UDP with the WIFly SHield.

Oh i've just read that wifly needs a man in the middle :P. So, how could i hack the linksys router and which model i have to use?


First, you can start by googling for DD-WRT, the name of the custom firmware you'll need to use.  It's a small Linux distro, so it will help to have some experience with Linux.  There's tons of info on the DD-WRT site and wiki, including a huge compatibility list of which routers will and will not work.

I was mistaken when I said most had USB, they have serial ports.  Some of them do have USB, but they tend to be more expensive.  Depending on your router, you'll need to solder some header pins on or solder wires onto solder pads on the board.  This can be a bit delicate, but not too bad.  To interface that with the Arduino, you'll probably need the Maxim RS232 interface chip (I think it's called the MAX3232).  You give it SPI and it spits out RS232, I've never used it but it sounds straightforward to use.  One thing to watch out for is line levels though.  I saw on the notes that some of these routers use non-standard RS232 voltage levels, so you might need to work around that.

After that, it's just a matter of writing software for Linux that listens on TCP or UDP and relays messages over serial to the Arduino.  Which then relays messages over xbee.  It's the long way around, but since you can't really add hardware onto iStuff (and who would want a big ugly home-made addon clinging to your sleek iThing?), it's probably the best way.  Oh, and as a bonus you can forward the port and it'll work over the Internet too.  And think of it this way, once you hack the Arduino and xbee shield into your router, you can use it again and again for future robots.  Control everything with your iPhone.  Why not?  And if want to take it far enough, mod the case for the router so it'll fit everything back into the original package.  The xbee hardware is pretty small I think, but you may need to use a smaller Arduino for that.  And while you're at it, throw a custom paint job on the router.

One final thing, please use the individual reply buttons on the posts.  By replying to your original post, it's hard to tell who you're replying to.