I’ve searched the internet for projects, tutorials, guides or explanations on how to get realtime data from arduino wirelessly to
a mobile device (android, iPhone, iPad) but i haven’t found any concrete possibilities…yet.
so far, bluetooth is out of the question. unless you want to go through the whole apple MFI (made for ipod) program, which i don’t really want :<
wirelss is then the only other option. So far, i haven’t found a good adhoc way to do it. Is there? Please tell me!
Also i found some methods that used websockets for direct communication (but then both wireless arduino + device should be in the same network, connected to the same wireless AP / router). How reliable is this? any good tutorial for using sockets?
What i ultimately want is to get gyro / accelerometer data from arduino wireless to ipad / iphone.
Cool, thanks Paul! I understand where this is going. I’d have to make a device that plugs into an i-device,
and through xbees / bluetooth / WiFi connect to my own device. Hmm. i think i can make that work, cumbersome as it is.
damn you apple, just give us control of the built-in bluetooth modem. The internet of things could look so much
less ‘cumbersome’ and intuitive :<
What about ad-hoc wireless? OR, let arduino with WiFi be an AP? can that be done? is there any way to do that on iDevices?
Awesome, thanks Walter! The ardumote app looks cool but it seems to need to use a router
for NAT and stuff like that. However, i’ve found that
the lib that DHhunt has written should support adhoc networking! (scroll down, last 2 posts).
Has anyone done this yet? Is it easy to accomplish?
I realize i kind of have 2 threads running for the same advice regarding the same project, not so well-approached.
the other thread is this one.
So, using the WiFlyHQ library and a WiFi shield for arduino, combined with a NATIVE Objective-C app on iPad
using this library it seems possible to let arduino create an ad-hoc network, let the iPad join it, and communicate through UDP and thus achieving a realtime (FAST), wireless connection between arduino and an iPad.
However, i do not want to build a NATIVE app for just a quick prototype. So, i’m going for the WebSocket solution
using Per Ejeklint’s WebSocketServer.
There are several ways to have an Arduino function as an Adhoc WiFi hotpot/AP.
The Arduino Hydrogen WiFi shield available at http://diysandbox.com/ can work as an AP, for example. Alas, it's rather expensive ($75).
You can also hook up a "standard" Arduino Ethernet shield to a little pocket router that can function as an AP. I use a little TP-Link router that I bought for less than $30 connected to an Arduino Ethernet shield. The advantage of that is that you can make full use of the Arduino Ethernet library and that is not to be underestimated
I am successfully using that approach in one of my projects:
Teensy++ - Teensy®++ 2.0
WIS812 adapter - PJRC Store
WIZX812MJ Ethernet Module - http://www.saelig.com/product/ETH042.htm
TP-Link Router - WiFi Networking Equipment for Home & Business | TP-Link
Just now followed the link to the other thread you are referencing and where some of the discussion is about Bonjour/Zerokonf.
The set-up I described in my post above will allow you to do exactly that using WiFi. It works quite beautiful in my project! There are several reasons I arrived at the above configuration:
Some of the libraries I am using are based on the Arduino Ethernet Shield and it's library. These libraries use lower level ethernet library functions that "talk" directly to the W5100 ethernet chip on the Arduino Ethernet card. If you were to use another WiFi shield you'd have to adapt the functionality of these to the different WiFi chip. In my case these are the Georg Kaindls DHCP and Bonjour libraries and Rekotana's ArdOSC library.
If you've read through what Georg Kaindl writes on his web site it becomes clear that the compiled libraries are quite big. A test sketch that allows me to turn on/off the LED on the Teensy++ via TouchOSC (iPhone) is already about 26 - 27 KB. There was not much more space left for the other code I needed for my project. I would have either had to use an Arduino Mega but really did not like the form factor and price of it. The Teensy++ costs $24, offers 130KB of memory for your code and is much smaller - about the size of an Arduino Nano.
If less technically inclined people are going to use you set-up perhaps in a different environment it really is nice for them to be presented with the configuration interface of the pocket WiFi router. Changing settings is a breeze compared to having to change Arduino source code and compile/upload it. With the router solution you can also integrate it nicely and easily into an existing WiFi network which eliminates some of the hassles that you may have using a standalone AP.
My project uses TouchOSC as a remote control application and I would not want to change the network setting on my iPhone each time I want to remote control my device/project.
Another nice feature of the Teensy++ is that the download of the code is with full USB speed and is in fact lightning fast compared to the Arduino Uno I used before.
I hope this helps and good luck with your project!
Thanks Headroom! What you explained is exactly what i wanted.
The problem is: i don't want (read: can't, costs too much time to learn Obj-C for this project) to use TouchOSC (or any Obj-c code) for prototyping, so i cannot access the native socket API's (for TCP/IP/UDP/whatever protocol) nor the Bonjour services (no HTML5 library as far as i know exposes these API's). For prototyping the interface and other application related stuff i'm using HTML5.
I really hope the websocket way will work.
But thank you nonetheless, it's nice to have confirmed i was digging in the right directions
Also, i now know that if my project would ever be really made, it could be done very well in IOS (native).
I believe you are working with a Arduino Duemilanove board, which should be compatible with an Arduino Ethernet shield. Stack an Regular Arduino Ethernet Shield on it and connect the little TP-Link router to it. The little router uses USB cable for power so you should be able to connect it to the regulated 5V of the Duemilanove and you're in business from a hardware standpoint and a Software standpoint.
The library that is associated with the Arduino Ethernet Shield provides you with everything you need to send/receive data either per UDP or TCP. As you may have already discovered there is a Arduino Websocket library. That library uses the Ethernet library, and again, you should be good to go " out of the box".
Thanks again for your help, at first i did not want to go the way of Ethernet shield + mini router/AP but i think for the sake of quick prototyping i'll go this way. It seems just so much overkill, because the functionality i need is also in the tiny RN-XV wifi bee + shield, which costs less and is less big in total...
However, getting it to work seems like the ultimate arduino challenge so i think i'll just go the easy way, sigh.
The solution you have started with is a WiFi board that is supposed to be direct replacement for a xBee. Perhaps you could also get xBees and once you have these working, replace the xBees with the WiFi module.
In general all the WiFi shields I've looked at in the past have the same problem in that they use their own library that turns out not to be compatible with the Ethernet library. The only shield that I am aware of that claims compatibility is the Arduino Hydrogen from DiySandbox.com.
I have one and the sample sketches worked fine, but then again, the libraries I am using for my project are using lower level functions of the wizenet 5100 chip. If your web sockets library just uses the normal Ethernet library function calls you may be fine using a Hydrogen shield. However at $75 I find it very expensive.