OBD-II Arduino Car Information Display

Introduction:

Back in September of 2013, I was interested in creating a project to look at solutions for interfacing with personal vehicles, so that real time performance data can be collected and somehow displayed to the driver. Originally, products like the OBDLink (by ScanTool), Mojio, and others were a source of inspiration because they were launching into the consumer market with some neat features. But I asked myself, what is available out there for all the creator community? Well I did not find much, other than shields and modules for Arduinos, all of which I didn't want to spend more money on. But what I had at home already was a USB ELM327 OBD-II Scan Tool, and I quickly realized that this was an easy thing to 'hack' into.

This part 1 of the article, we look at finding the right ELM327 OBD-II adapter to buy, and how to tap into the TX/RX lines to feed to an Arduino. In part 2, I cover the programming of the Arduino to display the information. It is a straight forward, cheap, and easy 'hack' to complete. Soldering, heat shrink tubing, wire, and connectors will/may be required.

Buying an adapter:

The way to access information from the vehicle is through the OBD-II port, which is short for on-board diagnostics. It is normally used by mechanics who have an expensive code reader, so they can read error codes and sensor data when completing maintenance on vehicles. However, more information can be read live while the engine is on, such as speed, engine RPM, throttle, and temperatures.

To obtain data from your car's OBD-II port, we'll be using a cheap ELM327 OBD-II Scan Tool. Why? Well they are very cheap and go for around $10-15 on sites like dealextreme, eBay, and Amazon. In addition, the ELM327 will actually be doing most of the work for us, and acts as the middle man in obtaining data from the ECU, and converting it to something a little nicer. We can then talk to the ELM327 through the AT command set (commonly used by modems) via serial connection. Essentially you ask for information from the ELM327 with a simple command, and then it will retrieve and send the information back to you.

A problem about these cheap ELM327 scan tools is that there are many variations available for sale, and they may not be made of the same quality (in terms of casings, PCB, and parts). So some of them may not actually be able to handle the stress and amount of heat that we will require it to go through. For example, there is a thread I found by ScanTool that tears down a sketchy adapter bought from China. 

Therefore, I highly recommend that you try and purchase the one I used since it has gone through a lot of use with no problems. It is called the "V1.5 OBD2 ELM327 USB CAN-BUS SCANNER" from dealextreme for $11.87 (free shipping):

http://dx.com/p/v1-5-obd2-elm327-usb-can-bus-scanner-126938#.UwBI4PldWWY

SKU 12693

The particular one that I received was a bit fidgety to get the connector snugly fit in my Honda connector. But the problem fixed itself eventually after plugging it in and out a few more times. The benefits? It's USB and has the cable which will be perfect for tapping in and out of. The PCB is of good quality and may look something like this:


Usually comes in green or black

And most importantly, it has convenient serial outputs which we will be able to tap into; but I'll explain that shortly. Bluetooth only models that have no cable should work as well, but there is no guaranteed. 

*If you decide to order from dealextreme, please avoid getting SKU 242224 (this one here), because I got this one too as a second adapter, and the case was glued shut and difficult to remove. Although, dealextreme mixes up orders quite often and may send you this bad one even if you ordered the previously suggested one, SKU 126938.

*To note, these cheap adapters from China are clones, and do not actually use an "official" ELM327 chip. Instead, they are PIC18F2480's flashed with the 1.0 ELM software, which was pirated (copied) from the original chips because it was not initially copy protected. Also, don't bother paying attention to the ELM327 version numbers on these when shopping (eg. 1.2, 1.3, 1.4, 1.45, 1.5), as they should all be generally flashed with the same 1.0a firmware. 

*The "official" ELM327 chip is not so much different, and is commonly a PIC18F2580- I/SO or I/P made by Microchip.

Modifying the adapter for use with Arduino:


As mentioned already, the PIC18F2480 (fake ELM327) acts as the data processor by talking to the CAN bus and converting it as easy to access information. Like an old fax modem, it uses the AT command set to grab and provide the information via serial. The RS232/USB, and bluetooth interfaces can use serial to communicate with it.


Above is the pin schematic for the PIC18F2480, and pins 18 (RC7/RX/DT) and 17 (RC6/TX/CK) are what we need to use. However, since the cheap adapter we're using has bluetooth, or at least an empty spot for it, there is an easier to access etched path at the bluetooth pads.

A similar PCB with a bluetooth module attached (on right)
A photo of the TX/RX headers soldered down on my PCB

(Optional) Adding a power switch to the adapter:

When everything is completed and your using this for your own projects, you may find it handy to have a switch on the adapter so that you can turn it off, without having to unplug the entire adapter from the port. When left connected, the unit will stay on and draw a small amount of power, leading to a dead car battery.

So thinking ahead, you may want to consider doing this so it's more convenient for yourself.


1. Grab the male OBD-II connector we took off that had the attached wires, and locate Pin 16 (Power in from the battery)


Pin 16 has a purple wire attached (on mine)

2. Take the wire attached to pin 16, and cut it roughly in half, strip the ends, and pull heat shrink tubing over it

3. Grab a mini toggle switch and wire it as shown, then solder together 

Then heat the tubing in place to protect the connections

4. Take your soldering iron and melt a hole in the casing like this to hold the switch (or drill a hole)

Also, snap off the round peg from the top case so
that it will not interfere with the newly placed switch

Wiring the adapter:







Programming the Adapter:

Stay tuned for a separate article!


Demonstrations:



ELM327 without case

TM1638 mounted on the right side of dashboard
Initial TFT LCD startup screen
TFT LCD Info Display (WIP)

37 comments:

  1. Article still work in progress?

    ReplyDelete
    Replies
    1. Yeah, I hope to work on it again very soon within these next two months.
      Is there anything specific you want to know that I can perhaps answer now?

      Delete
  2. What arduino modules are you using? An UNO, with a TFT screen shield?

    ReplyDelete
    Replies
    1. In the specific photos above, it's a MEGA 2560 with a 3.2" TFT LCD + adapter shield.
      You can use an UNO as well as long as you get the appropiate shield and LCD for it.
      In the case of using a TM1638 display, you can scale it down to as small as an Arduino NANO.

      Be sure to follow or subscribe to me, since I'll be finishing this article very soon as I finally have free time coming up.

      Thanks!

      Delete
    2. I am happy to find this post Very useful for me, as it contains lot of information. I Always prefer to read The Quality and glad I found this thing in you post. Thanks obd express

      Delete
  3. Thanks for this post. Quite interesting. Which library did you use to communicate Arduino to OBD ?
    Out of the two pins tapped from the board which ones are RX & TX ?
    I have an Arduino Duemilanove and am trying an OBD LCD project.

    ReplyDelete
    Replies
    1. It's not exactly a library. Just a program to interface with the AT commands to and from the OBD scan tool. I'm very close to updating this article with everything you will need, so stay tuned!
      Thanks

      Delete
  4. Hey Thanks for this, Its exactly what I wanted to do. I couldn't figure out how to get behind the USB Chip directly onto the Serial pins
    The ELM327 USB version i have is exactly the one you have in the pictures. Please could you show exactly where you attached the 2 wires on the TX/RX pins and also show which one is TX and RX.
    (I will truly appreciate it!)

    I managed to sniff data of functions in my vehicle and i'm also able to send the data back which cause the vehicle to respond, but now i want a cheaper and more permanent solution as my seeedstudio (Similar to skpang arduino shield using the MCP2515/2551 transceiver chips) is a bit expensive and i'm using it as my "Research" tool.

    I want to be able to now send the AT commands via the serial port using the Arduino instead of sending them via the PC using putty.

    Please check out my blog.
    http://jeepjkcanbus.blogspot.com/ hope it could contribute to your findings.

    The ELM327 is known for being used a scan tool mostly but one i'm able to interface with it using an Arduino
    I will be able to send permanent vehicle programming parameters to my Jeep's ECU

    Please add a close up shot of the TX/RX pins on this blog! :-)

    Cheers
    Martin




    ReplyDelete
    Replies
    1. Well if you do have the exact same board, there is a photo already of where the TX and RX ports are connected to the PCB. That portion on the board is meant for the bluetooth HC-05 wireless chip which was not included. You can look up the schematic for the HC-05 and you will know exactly where to solder for the pins.

      Stay tuned..I know I keep saying it, but I intend to finish this article soon, and may be including a portion on sending things to the vehicle as well.

      Delete
  5. Dear Ken,

    What an amazing article you have written. Can't wait for the updates.

    Just a quick question, what voltage are you getting from the (empty) hc05 Tx/rx leads and whether the usb chip should be removed?

    Ps
    I have ordered the same sku you recommend but dx has shipped one with super strong glue instead of screws. It has a red solder mask also.

    I connected the elm327 to my bench power supply and my voltmeter tested 1.7 volts for the tx pin, is this right ? Also what baud rate should be used, 38400?

    Thanks for taking time for writing this article, so far it's the best I came across regarding obd and arduino.

    ReplyDelete
  6. Hi,
    I'll try to address all your questions by answering them in my finished post very soon.
    Just finishing up exams right now.

    Cheers

    ReplyDelete
    Replies
    1. Thanks Ken, Really looking forward to it !

      Delete
  7. Would love to see the rest of this article! Good stuff here.

    ReplyDelete
  8. Hey Fella,

    Looking forward for next part of experiment.

    ReplyDelete
  9. hey can you explain a bit more about wiring the adapter part, and also the coding involved. thanks.

    ReplyDelete
  10. would appreciate to see the approach taken to communicate. ive tried a few other ways with no luck. thanks great write up.

    ReplyDelete
  11. Does this work with any protocol supported by the PIC?
    for instance iso9141-2
    thanks

    ReplyDelete
  12. People are still waiting for the code man :'(

    ReplyDelete
  13. Discover our great deal on a wholesaler of different kinds of Obd2 Connector at Med-obd.com. Our Obd2 Connector can pinpoint the problem and can make mechanic jobs much easier. You may visit to our official website at Med-obd.com for more details.

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. Thanks for this...great info. I've read the data sheet on the PIC18F2480 but I'm far from as smart as you so I wanted to double check. The TX on this chip is 5v right? I'm doing my project on an Arduino Due and those are 3.3v. I need the speed of the Due though as its doing a lot of other things.

    ReplyDelete
  16. Wow so helpful information all about OBD-II Arduino Car. I get red tension to visit this blog.

    ReplyDelete
  17. Well done Ken Chan! You have simplified the things quite easily. Lots of people like me always have the desire to know all the logic that lied behind the invention on car engine. Yet, it is a bit confusing to understand. Here I got to understand a lot. Thanks a lot for the post!

    ReplyDelete
  18. Can we read the kilometer info that displays on odometer??

    ReplyDelete
  19. Thanks Ken for your great work. Unfortunately, i can't understand how you did to wire the adapter : can't find any explanation from where you got the four wires. I was looking to two wires : tx/rx not four ! could you clarify. Many thanks

    ReplyDelete
  20. Hi Ken. Any news on the code for the OBD reader side? Im trying to build one that logs data to an SD card. I found your library for the screen linked on youtube but i couldn't see the OBD reader part. Do you have the code for this somewhere online? Thanks Matt Sutton

    ReplyDelete
  21. Wow so helpful information all about OBD-II Arduino Car.

    ReplyDelete


  22. Thank you so much.
    http://mybestdrills.com

    ReplyDelete
  23. Thanks for sharing great information with us. If you are passionate about cars and you love working on them and fixing them yourself, buying the best OBD II car code reader can be a smart decision. These devices exist to make your life more comfortable and enjoyable. You can use an OBD2 device to inspect why your check engine light is active and to reset that.Here are the 10 best OBD II car code readers TheKeenHunter has hunted for you.

    ReplyDelete
  24. If anyone is interested in a super easy to use and reliable Arduino library to interface with an ELM327, check out ELMduino: https://github.com/PowerBroker2/ELMduino

    ReplyDelete
  25. Awesome post. This post is very helpful for me. It has Lots of OBD-II Arduino Car Information Display. Thanks for sharing. Best fitness online

    ReplyDelete
  26. Nice post. This post is very helpful for me. It has Lots of OBD-II Arduino Car Information Display.

    ReplyDelete
  27. Thanks and I have a super provide: How Much Should House Renovations Cost victorian home renovation

    ReplyDelete