• Featured User: kurt


    Open-source hardware project hosting is my passion. I spend most of my free time building neat gadgets or planning what I'll build next. I love building things, and I want to make Open Hardware Hub a place that inspires others to build, ...

    Learn More

  • Updates 2013 February 18

    It's been a while, hasn't it? Well, that's ok because we've got a lot of updates to talk about. Most of these have been effective on the site fora couple weeks now. A few may or may not be active when this article gets posted, but they'll certainly be applied in the ...

    Find Out More

Arduino CAN-BUS OBD Gas Gauge

Download this project


By: winneymj

My inspiration for developing this gas gauge was after purchasing a new car (Scion Xa) and wondering what MPG I was getting. After much research on ODBII protocols (Scions support CAN-BUS), and looking into open source software that already existed (OBDuino32K) I delved into my first Arduino project.
This project has taken me over a year to put together from building my own CAN-BUS shield, learning to design a circuit board, soldering SMD parts and then building my own enclosure so I could mount it in my car.

Download project description w/o images
Download project description w/ images


Download all project files

Bill of Materials

Qty Part # Description Schematic ID Source
1 MCP2551 High-speed CAN Transceiver
1 MCP2515 Stand-Alone CAN Controller with SPI Interface
1 De9bddf7a48e75dae6428f71cffdcee28f0bf244 Arduino Pro Mini 328 It's blue! It's thin (0.8mm)! It's the Arduino Pro Mini! SparkFun's minimal design approach to Arduino. This is a 5V Arduino running the 16MHz bootloader (select 'Arduino Duemilanove w/ 328' within the Arduino software). Source
1 18325f590f3ee2530d6399ca5cb192e036874d3e OBDII Connector - OBD2 OBDII EOBD J1962 Connector Adaptor - Right Angle Source
2 0.1uF Capacitor 0.1uF Capacitor Source
2 22pF Capacitor 22pF Capacitor Source
2 1/4W 5% 10K Resistor 1/4W 5% 10K Resistor - Generic from Radio Shack
1 1/4W 5% 220 Resistor 1/4W 5% 220 Resistor - Generic from Radio Shack
1 2N3906 Transistor - Generic from Radio Shack
1 1ff9c241caf43e8ea2faa9b4a8008e39fde516a2 LCD Standard LCD 16x2 + extras - white on blue Has header pins and potentiometer Source
3 9c9e956af719bebb0bfc011e04c95ac740afc567 switch Tactile & Jog Switches TACT SWITCH 12X12MM Source
3 9634481494f3200e505b0ae372f607bfb22ff6c2 cap Switch Hardware 12X12 RND BLK CAP - This one is black but other colors are available. Source
2 D3eebebfd12b32787852ff8f0bad6cb21b6d8c56 Pin Header Break-away 0.1" 36-pin strip male header Source
1 Ea769c35d6785537a3cc9e8254d625607030ec5e Crystal Crystal 20 MHZ Source
1 9eaeda6eb19f9e8e3bb7b7be72e2e7fd197e2483 enclosure Build your own or buy an enclosure.
2 1f1efbb7a1c2062e421380cd39546cdfd3b008bf Pin Header Headers & Wire Housings R/A PCB HDR 4P TIN FRICTION LOCK Source
2 97422a08a1f21b8972e0dd3d29d02081e552347e Female Pin Header Headers & Wire Housings HSG 4P WITH LKG RAMP Source
8 1d80b37b131ed4a9dcedc2a75da0d78d01e5619f Crimp Terminal .100" CRIMP TERMINALS Source
1 cable (3 ft) 4 core 22 awg stranded cable. Taken from an old broken keyboard.
1 Ad2b0183f2d096e96acaf0dd57c3be6c29c7e008 FTDI Basic breakout FTDI Basic Breakout - 5V Source
1 Circuit Board Circuit Board - Custom Circuit Board, sized to match the LCD circuit board size. See attached Eagle files for details.
loading total from bomfire.com...

Download BOM w/o images
Download BOM w/ images


1. Make sure your card supports CAN-BUS

Please make sure that your car supports CAN-BUS protocol. Not all cars do, especially older cars, before 1998, but more and more newer cars do. Two cars I know for sure do:

1996 Scion Xa and
2011 Nissan Versa (Father in-law had a rental).

A site that might help with determining this is: http://www.auterraweb.com/aboutcan.html

2. Gather parts

I have tried to link to as many parts as I could in the parts list. Some are from eBay, some from Radio Shack and even got my cable from Goodwill from a used keyboard for a couple of bucks.
Sparkfun for the Arduino and Mouser for the remaining parts.
Thiss was the first time I have designed a circuit board and the first time I have used Eagle CAD. I relied on the auto-routing features and I am sure the more experienced designers will be gasping in horror at my board. But it works and that is good enough for me. The circuit board was ordered from Sparkfun spinoff site at http://batchpcb.com/index.php/Home.

I sincerely apologize for the lack of steps detailing how to solder all the parts into place and images. I did not think that I would be detailing the process. My bad.

3. Build enclosure

This is one of the hardest parts of this project. I did some extensive searching for a project enclosure. None of them fitted my needs. I even considered a glasses case. Eventually I decided that I would have to resort to building my own.
I bought Bass wood from local hardware store (Ace or Michaels) and using a coping saw and a table saw to make kerf cuts, so I could bend the wood, I came up with the "kidney bean" design shown. The image shows the LCD placed inside the enclosure. My circuit board is soldered directly to the LCD header pins.

The gray textured finish is actually paper from Michaels scrapbook section. They have some pretty cool paper with all sorts of finishes. Cut out using sharp knife and glued directly to the enclosure.

Img_1169 Img_1168 Img_1170 Img_1171

4. Solder parts

Some parts are surface mount and there are plenty of examples on YouTube on how to do this so I will not be going into details.
The circuit board I designed was sized to be exactly the same size as the LCD and is soldered to the 16 header pins from the LCD. The 3 buttons were soldered directly to a piece of protoboard from Radio Shack and then wired to female header for connection to the circuit board. I mounted the buttons into the enclosure with scraps of wood and a hot glue gun. See the "fit into enclosure" section for photo.

Dcim_114canon_img_1278_jpg Img_1277

5. Build the OBDII cable

The cable I used came from an old keyboard that I found at Goodwill. One end it attached to the J1962 (OBDII port) and the other end to the Female Pin Header. The connections is are:

GND ->4,
RAW ->16,

For more information on the OBDII port and its pin connections see the following URL: http://www.obd2cables.com/products/obd-cables/cable-j1962m-to-db9f-type-d-6ft.html

Download steps w/o images
Download steps w/ images

Show all steps


1 - Initial project release

blog comments powered by Disqus