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: