If you wanted to do hardware hacking with Android and Arduino, the process was expensive, limited and/or painful
Until the beginning of 2011 the only ways to connect an Android phone to Arduino was by:
- Rooting your phone, installing a CyagenMod and connect the Arduino to the serial port of the phone. However, this only worked for a limited set of phones, like the HTC Dream and the HTC Google Nexus one and the first gen G1 phones.
- Using bluetooth, which adds about 100 euro to your project as a Bluetooth Shield for Arduino is quite expensive.
An alternative low cost / light weight option to work with Arduino and ARM-based devices might have been to install a Linux variant like Angstrom (for hand helds and tablets) or Ubuntu (for hardware based on the more powerful Cortex A9 series), but these solutions require extra work and are not guaranteed to work.
Finally there is a simple Android / Arduino solution via USB
Thanks to the smarts and hacking-work of Inopiaaardbei (Googling connects this alias to “Niels – Inopia / Aardbei – Brouwers” but there is where the traces stop) there now is Microbridge on Google code. It uses the Android Debug Bridge (ADB) and makes the Arduino the USB Host, where the Android device is the slave device. As it is using ADB, any Android device – including low budget tablets and phones – should work with it.
In my opinion, this solution is a game changer for all Android hackers who want to go do hardware. (Addition: Ytai released IOIO together with Sparkfun. See below.)
The demo-video is included later in this post.
This project is still in development. One of the issues mentioned is that the Android device is charging from the USB host port and thus creating trouble when running for a longer period.
Is it the first?
I do not know. It is the first I found since I started searching on my first Hacking away with Android posts in 2010. There might be other similar solutions available, but they are hard to find / invisible for Google, or hidden deep in the search results. I could not find them.
Is it the best?
I do not know. It is USB. It is low cost. It is simple. It works. And I am ecstatic for all it can bring me.
Update: Ytai’s IOIO (YoYo)
Sparkfun is at this moment of writing (April 11) producing the IOIO (see also here), a specific solution for Android, using almost if not all the same principles as the MicroBridge solution by Inopia. The cost are very similar to an Arduino + USB Host breakout board: 49,95 USD and I think they have a potential hit here with IOIO.
See: “What is so cool about Arduino and Android” below.
Apparently IOIO started about 8 months ago. Inopia (see below) is also in the stream of people responding and basically both Ytai (IOIO) and Inopia got the same idea independently. I personally credit Inopia for being the first one going public with a working solution. Awesomness.
What is Arduino?
Arduino is a PLC. A very simple and limited: “System on a Chip” that you can program to perform simple tasks. The Arduino chip offers several pins for digital in- and output (for instance: to talk to other devices) and analog input (for instance to measure changes in light or pressure on a sensor). They are placed on a board that can be used in projects.
You can use Arduino boards stand alone (no connection to a computer) or connected to a computer. As the Arduino chip can communicate via a serial connection, you can let it work together with more sophisticated software on the host-computer, making smarter solutions and even allowing you to post things online. (People built for instance coffee machines stating on Twitter that: “the coffee is ready”.)
See here a list of: “top 40 Arduino projects”.
What is so cool about Android and Arduino?
- Android phones, devices and tablets are becoming cheaper and cheaper – You can now buy an Android phone (prepayed) for 99 euro if you follow the special offers on Telcos. With the french Archos and their new brand Arnova you can buy their yesterdays model Android tablets, running 600 MHz and higher, for prices between 99 (for the Archos 28 ) and 200 euros
- Android hardware runs a “full” OS with a stand-alone display– Allowing you to program in Java and use off the shelf hardware and manipulate the hardware you connect to it directly
- Android hardware can connect to the network and run smart code – So whatever you do with and via Arduino can be posted online or manipulated via other things via Internet or your local WiFi, allowing you to build solutions where other phones, computers and tablets can remote-control your Arduino solution
- Android hardware (phones mainly) has a low power-usage footprint – Unlike netbooks and Intel powered machines, Android devices consume very low power, making it possible to run them on batteries for a longer time and (maybe) even on solar cells
- Android adds a lot of processing power to Arduino – In contrary to Arduino, which is quite limited and has a lot of DIY attached to it, once you run whatever you do with Arduino through the processing power of an Android phone, you have power in your hands.
- Arduino is broadly supported and still emerging – Making the research and results more valuable for the community
How is it done? – Forget bluetooth, using the Arduino as an Android Debug Bridge USB Host
At this point in time, basic Android devices do not support serial interfaces. Neither via a serial port (non existent on most Android devices) nor via a serial protocol over USB (no drivers available). So you need to hack it.
- Bluetooth: expensive and draining energy – There is a solution available (called Amarino) using the bluetooth API of Android to connect to a bluetooth Shield for Arduino. There are two main issues with bluetooth:
- It costs a lot of energy – draining your batteries
- It costs a lot of money – making it less scalable if you want to use it a lot. I could only find the Arduino Bluetooth version (149 USD) but a Bluetooth Shield would probably cost about 70 to 90 USD.
- USB: lower cost, using the Android Debug Bridge (ADB) – See the Microbridge project on Google code by Inopiaaardbei (go here to find the link for an SVN checkout). By making the Arduino board the USB host, and using the Android Debug Bridge, you can send serial data over the USB port to the Android phone and from the Android phone back to the Arduino board. Even though it is a turning around of responisbilities (in all other setups I have seen Arduino is the slave device) it is a perfect simple solution.
Will work on tablets too
As the Android Debug Bridge is a standard feature, spending 99 euro on an Archos / Arnova tablet (or any Chinese brand or cheap Android phone of your choice) will get you a working, smart, Java based, touch screen enabled Arduino solution for about 150 euro.
Will have to pay for extra stuff
The Arduino solution you have will be limited though. If you want to connect motors to it, for instance to build a small robot, you will spend extra money for that hardware. Those costs are not included in the overview below.
What are the starting cost on the Arduino / Android solution?
- An Arduino board: costs about 19 to 24USD
- An USB host shield for Arduino: 24 USD
- An USB cable: between 3 to 5 euro
We end up spending about 50 USD to enable us to connect Arduino to an Android phone. This is around 30% of the Bluetooth solution.
See it in action
Smart Spaces and ARM devices – Moving it one step further
If this is not enough, the next step might be to use something more similar to a PC, but with the advantages of the System on a Chip / ARM platform:
- Low energy footprint / low heat dissipation – As the ARM chips are having a low power consumption and low heat dissipation, they do not need external cooling and no moving parts are required
- Compact form factor – allowing you to put it anywhere you like
There are two solutions I found via ARMdevices – available for the consumer market – and priced below, or around 200 USD:
- The PandaBoard – 175 USD – offering a complete “connect and run” solution with an ARM Cortex A9 dual core processor, 2x USB out and 2 x Video out
- The TrimSlice from Compulab – About 200 to 300 USD? – Offering a more compact form factor with similar specs as the PandaBoard but very likely a tad more expensive
I have not bought either yet. But the options I see with the heavier processing power are:
- Running Ubuntu – allowing you to do more hardware hacks
- Attaching Kinect and standard cameras – allowing you video input for your Smart Spaces
- Using other sensors via USB – whatever is available can be connected