Thread: OBDuino Mega
View Single Post
Old 09-23-2009, 07:54 PM   #1 (permalink)
jonoxer
EcoModding Lurker
 
Join Date: Sep 2009
Location: Melbourne, Australia
Posts: 15
Thanks: 1
Thanked 10 Times in 8 Posts
OBDuino Mega

Hi guys n gals,

Great work on MPGuino, OBDuino, etc. It's really cool to see Arduino being used as the basis of projects like this, even if they later diverge from the Arduino and become more self-contained. It shows the Arduino doing exactly what it should: providing a quick, easy, and cheap starting point for whatever your imagination comes up with.

Recently I've been switching my previous OBD datalogging / car remote management system over from running on Ubuntu on an Alix-1 to an Arduino Mega, and the OBDuino project has been very helpful in getting it working. I originally wrote my own code that implemented GPS datalogging and storage on a memory stick in a CSV file, but the OBD part of it was giving me problems. I started looking at the OBDuino32K source for inspiration and decided that it would be better to ditch my effort and implement the features I want in OBDuino rather than take OBDuino's OBD code and mash it into my existing code.

I'm coming at this from a very different perspective from you guys so I suspect you're not particularly going to care about what I'm doing but I thought I'd give you a heads-up anyway. This site is all about driving more economically and providing simple tools at the lowest possible cost to help make that happen, while I'm coming more from the rev-head side of town and, for this project at least, don't really care about trying to do this on the cheap. Instead I'm taking the approach of making it do as much as possible, regardless of the cost.

If that mentality annoys you then I apologize and I'll leave you in peace.

For those interested, though, I now have a slightly modified version of OBDuino32K running on an Arduino Mega.



Sorry about the poor picture quality. I just borrowed a work colleague's camera-phone to take the pic but I can post better ones later.

Mounted vertically in the back left is the PCB out of an OBD-II/USB adaptor that has been modified to replace the 3mm LEDs with 0805 surface mount parts, and the FTDI USB chip has been bypassed to link the TTL serial interface on the ELM327 directly to a USART on the Mega (Serial1). The header for the OBD-II cable has been taken to a DB9 socket on the back of the case and I've made up an OBD-DB9 cable that matches the pinout of the standard cables you see around the place.

On top of the Mega is a prototyping shield that provides a handy breakout point for serial ports, status LEDs, controls, and the power supply. The PSU is based on an LM2940CT-5 which is an automotive-grade equivalent to the 7805, since a standard 7805 isn't rated for the 60+ volts that a car alternator can deliver into the loom in the event of a load-dump such as when jump-starting a car or if a battery terminal works loose. The LM2940CT-5 also has a much lower dropout voltage than a 7805 so it can maintain a clean 5V output even if the input drops as low as about 5.5V during cranking the starter. A 7805 can't maintain its output below about a 7V input. The PSU also has a huge capacitor on the input side fed through a diode, with a voltage divider in front of the diode feeding into a zener-protected input connected to an interrupt. This allows the Arduino to detect power-fail and still have a few milliseconds to take care of housekeeping chores like closing files on the USB memory stick.

The LCD is a 20x4 module, nothing special about that. I'm running it configured as a 16x2 though because there are strange artifacts when OBDuino tries to drive it as a 20x4.

To the bottom right is a Locosys LS20031 GPS module, which is quite nice because it does 5Hz updates. That's connected to another of the built-in USARTs on the Mega.

In the bottom right of the case is a Vinculum VDIP1 module loaded with VDAP firmware. It's connected via serial to yet another USART on the Mega, and provides a USB host connection for a memory stick like the 4GB one in the photo. The memory stick is formatted FAT32 and the VDIP1 lets the Arduino manipulate files and the filesystem directly, so in my version of the code it opens a CSV file and writes GPS and OBD values into it. The cool thing with this approach is that you can just unplug the memory stick, take it inside, plug it into your computer, and open the CSV file directly in a spreadsheet.

What I haven't integrated into this particular prototype yet is the vehicle control stuff that I currently have running in my car, which has a permanent 3G internet connection and various devices in it including an Arduino wired into the ignition system so I can start and stop the car via the Internet, and access OBD data via the net as well. If anyone is interested in seeing what I've done with that you can check it out on the Geek My Ride site at:

Jon's RX-8 - GeekMyRide

Finally, all this is being documented to be included in a book called "Practical Arduino" which will (hopefully!) be out in a couple of months:

Practical Arduino: News

My approach so far has been to add support for the Mega using #ifdefs in the OBDuino32K codebase. With my modified version it currently builds exactly the same as the official OBDuino32K mainline unless "#define MEGA" is put at the top, in which case it switches around a bunch of things such as the serial port to use for the ELM connection, interrupts for the buttons, etc. I haven't yet integrated my GPS, Flash, or emergency-shutdown code but that's the next step.

So, keep up the good work, and if anyone is interested in what I've added please let me know. Otherwise I'll just shut up and let you all get on with it.

  Reply With Quote
The Following 2 Users Say Thank You to jonoxer For This Useful Post:
dewasha (07-16-2013), SVOboy (09-25-2009)