Introduction: Easy Android Display for Arduino With Torque App

Picture of Easy Android Display for Arduino With Torque App

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

Picture of 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:

http://elmelectronics.com/DSheets/ELM327DS.pdf and https://en.wikipedia.org/wiki/OBD-II_PIDs

Step 3: Torque App Setup

Picture of 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!

Comments

k-esd (author)2016-06-14

Hi

I am wondering if there would be any reason why the app only requests 05 and 0C (engine coolant temp and RMP) over and over again and doesn't ever request anything from mode 21. It never gets the chance to send the data from the analogRead. I am using the "lite" version, I don't want to invest in the paid version unless I know it works. Anyone else have this issue?

Any help would be appreciated

MikeD11 (author)2016-05-10

Hi, thanks for putting up the Instructable. I could not have done it without you. I got my HC-05 bluetooth radio in today, first error I hooked Rx to Rx and Tx to Tx... Oops. My Pin out is Rx to Pin11, TX to Pin 10, GND, 5V, EN=Open, State=Open. Bluetooth pair code was 1234 then shows as HC-05 device. One odd issue, I have to have the serial monitor window open on my PC in order for the ECU to be detected. I'll figure that out, but otherwise, SUPER COOL!!!

harolete (author)MikeD112016-06-02

hello you could help me with my project, I am working with a scanner obd2 usb and mega arduino , my email is hadelto@hotmail.com

MikeD11 (author)MikeD112016-05-12

I found that when I was powering the device from my PC that I needed to open the serial monitor to get it to run. When I powered it from a USB charger it ran happily.

LarsR5 (author)2015-11-11

It's working now :-)

I had to add the line

mySerial.println("OK");

infront of
mySerial.println(">");

in the arduino code. However I still have a question: How do I tell torque to save my new PIDs?

niekvanprooijen (author)LarsR52015-11-12

Nice! Mine saves it automatically, but I have the paid Pro version. I advise to buy it once.

LarsR5 (author)2015-11-11

What a great idea!

I just tried it out with a German version of torque lite however I can't get it running.

I can't find the menu adapter status. Torque tries to connect, tells me, that it is connected but looses connection one second later.

The serial debug window repeats:

Z

E0
D

I'm using a HC-05 adapter, paired to the phone.

Any ideas?

seamster (author)2015-11-10

Excellent! Thanks for writing up and sharing how you did this.

niekvanprooijen (author)seamster2015-11-10

you're welcome. I hope it can help you.

Niek