Archive for October, 2010|Monthly archive page

Reading the OBD – Part 2 – Hardware

After looking around at CAN controllers, I settled on the MCP2510 by Microchip.  It takes care of all the low-level CAN stuff for you, allowing you to just read the CAN messages over SPI.  It also has hardware message filtering features, which I would probably never need, but are nice to have just in case.  I would have liked to use an Atmel micro with built-in CAN, but I wasn’t able to find one in a DIP package, which I consider essential for prototype projects like this one.

This turned out to be just as well, because after messing around for a bit, I decided to order an Arduino to use as a development platform.  I’d wanted to play with one anyway, and this seemed to be a good opportunity.  The Arduino is easy to program over USB and handles USART over USB for you as well.  The MCP2510 is a good choice for integration with the Arduino, so everything turned out well.

The MCP2510 requires an additional CAN transciever chip to do the actual interfacing with the CAN bus.  Unfortunately, I couldn’t find one of these in a DIP package either.  I did find a Maxim chip in a SOIC package, which is about the friendliest SMD package.  Maxim is excellent about sending samples, and happily sent me several of these devices.  I ordered my Arduino from Adafruit in a kit that also came with a protoshield board and tiny breadboard.  This was perfect for the project, as the breadboard made for easy prototyping with the MCP2510 and the protoshield has SOIC pads broken out to solder points.

I didn’t do enough reading before placing my parts order, and so didn’t realize that the 2510 needs a clock source.  Not wanting to order and wait for a crystal oscillator, I found that the ATMega328 on the Arduino can output its clock on a pin.  This can be enabled by setting the eFuses a certain way.  It was an easy fix to update the fuses and use the microprocessor clock to drive the 2510.  I’ve since ordered a 16MHz crystal for it so that the Arduino fuses don’t have to be altered, but it works both ways.

The final build turned out to look like this:
Photo of CAN setup prototyped on Protoshield

The wiring’s a little messy, but it works!  My only gripe about the protoboard is that if you populate the 5v and GND headers at the bottom, your breadboard will cover up some of the SOIC breakout points.  This might be a design oversight, but I think it comes from a conscious layout choice to keep through-hole connections from being grounded by the casing on the USB jack.  I luckily noticed this before placing the breadboard and was able to run the SOIC breakout wires from the bottom of the board, so it worked out.  If you’re planning on using the breadboard and the SOIC spot on the protoboard, make sure to leave off the GND and 5V headers and place the breadboard low enough to allow access to the SOIC breakout points.

Advertisements