For a long time I struggled with displaying Arduino data on an Android phone. I tried the MEGA ADK, but it is quite hard to work with. I tried the play store apps, but they cannot display data from an own program.
So, time to make and hack. In my car I use an ELM327 Bluetooth adapter in combination with the incredible Torque app. Would it be possible to simulate an ELM327 adapter with an arduino over a Bluetooth connection? This would solve my problem. After some reverse engineering and reading datasheets I got it to work.
I've put this on Instructables so it may be usefull to others. It's really easy to use!
Step 1: Hardware
Short: Arduino Uno with bluetooth shield/pcb/whatever. I let it communicate over SoftwareSerial on pin 10 and 11. It can also communicate over the hardware serial port, but this is annoying when programming...
Long: See above.
Step 2: Arduino Software
Please see attached file. In the code comments are used to explain. ELM327 uses AT and OBD commands.
Torque tries to setup the connection first with AT command. Echo, linefeeds, headers, etc. are turned off. Torque askes for description, identifier and protocol. Any information can be displayed in the Torque app.
When the connection is ready it starts to ask for data and requests a PID. When it came back and the string ends with '>' it will ask for the next PID.
For all PID's and ELM327 protocol please see:
Step 3: Torque App Setup
Before using the Torque app you first need to link your Android phone with the Bluetooth adapter. Make sure it is turned on, what the name is and the pin-code. Go to your Android settings and link to the Bluetooth adapter.
Next start up Torque, go to settings, OBD2 Adapter Settings and Choose Bluetooth Device. Here select the name of the bluetooth adapter. Make sure 'Faster communication' is switched off. Next go to the home screen of Torque and select Adapter Status. The first 4 should go green and ok. It may take up to 10-15 seconds. If not, good luck with it :P after too many errors Torque tries to reset the connection automatically.
Now, because we don't use standard PID's we have to add them manually. Goto settings, Manage extra PIDs/Sensors. For this demo Arduino has PID 2110 till 2115 (a0 till a5). Depending on your application you can add them as you like. Make sure they are available in the Arduino code. After you added a PID you can hit Test to get the current value from the Arduino. That's it.
Now you can set up your Torque display. How this works is well documented at http://torque-bhp.com/.
A nice extra feature of Torque, you can upload your data automatically to a web server. So online logging will be available for your Arduino using the phone's internet connection!
So, this may be the easiest way to display Arduino data nicely on an Android Phone, be able to log data online. It is even wireless (Bluetooth).
There are extended possibilities. Normally Torque lets you send single commands to the adapter. These commands could be used to do something with the Arduino. It will make the interface two way.
Have fun with it and let me know if it works for you!