Go Back   EcoModder Forum > EcoModding > Instrumentation > OpenGauge / MPGuino FE computer
Register Now
 Register Now

Now available from EcoModder: ScanGauge II fuel economy gauge.  Click for details.  

Reply  Post New Thread
 
Submit Tools LinkBack Thread Tools
Old 09-23-2009, 07:54 PM   #1 (permalink)
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)
Old 09-23-2009, 08:40 PM   #2 (permalink)
EcoModding Apprentice
 
Join Date: Aug 2009
Location: terra firma
Posts: 138
Thanks: 4
Thanked 24 Times in 22 Posts
"wow"
  Reply With Quote
Old 09-24-2009, 09:16 AM   #3 (permalink)
EcoModding Lurker
 
Join Date: Sep 2009
Location: Melbourne, Australia
Posts: 15
Thanks: 1
Thanked 10 Times in 8 Posts
It's a bit embarrassing letting people see things while they're in progress, but just in case anyone is curious I've put my modified version of OBDuino32K up on GitHub. As I mentioned previously my approach with this is to try to keep it behaving exactly the same for standard 328P builds, while enabling all the extra features for a Mega at compile time by setting some flags. I've also separated out new subsystems into separate files for clarity so I don't pollute the original codebase too much.

jonoxer's obduino32KMega at master - GitHub

Right now it builds on a Mega with different pin assignments to allow the extra subsystems to operate, and the extra subsystems compile cleanly, but they're not activated in the main loop yet (except the command-line interface for managing the OBDuino from a serial console which does partly work). To use it you'd need a bunch of information about pin assignments etc that aren't documented yet but that will all follow. I only have a couple of days left to finish the first draft for the book so stuff should progress at breakneck speed.
--
Practical Arduino
  Reply With Quote
The Following User Says Thank You to jonoxer For This Useful Post:
dewasha (07-16-2013)
Old 09-25-2009, 10:10 AM   #4 (permalink)
EcoModding Lurker
 
Join Date: Sep 2009
Location: Melbourne, Australia
Posts: 15
Thanks: 1
Thanked 10 Times in 8 Posts
GPS, memory stick, and command line partly functional

It still needs a lot of work but tonight I partly integrated code for GPS, the memory stick, and a console interface into the OBDuino32K code.

As of right now I can connect to the OBDuino via a serial console and perform filesystem operations:
* List files on memory stick
* Delete OBDuino logfile
* Display OBDuino logfile

I can also activate and deactivate logging via the console, and a button on the device itself also toggles logging on / off.

While logging is on the main loop takes a GPS reading once for every pass through and writes it into a CSV file on the memory stick. I'm not logging any OBD data yet, that's the next step. Time to stop for the night and get some sleep now though.

For the curious:

jonoxer's obduino32KMega at master - GitHub
  Reply With Quote
The Following User Says Thank You to jonoxer For This Useful Post:
dewasha (07-16-2013)
Old 09-25-2009, 03:15 PM   #5 (permalink)
Dartmouth 2010
 
SVOboy's Avatar
 
Join Date: Nov 2007
Location: Hanover, NH
Posts: 6,430

Vegan Powa! - '91 Honda CRX DX
Team Honda
90 day: 66.52 mpg (US)
Thanks: 92
Thanked 106 Times in 77 Posts
Send a message via AIM to SVOboy Send a message via MSN to SVOboy Send a message via Yahoo to SVOboy Send a message via Skype™ to SVOboy
Great work
  Reply With Quote
Old 09-25-2009, 07:28 PM   #6 (permalink)
EcoModding Lurker
 
Join Date: Apr 2009
Location: Debolt, Alberta
Posts: 78
Thanks: 1
Thanked 2 Times in 2 Posts
Excellent to see some expansion using the project into new directions.

What problems have you seen when using the 20x4 display? Is it just left over data that does not get cleared? When does the artifacting happen (what screens are involved, where is the data...) Do you have any pictures of the artifacts?

Hopefully we can get the display corrected.

Thanks.
  Reply With Quote
Old 09-25-2009, 08:27 PM   #7 (permalink)
EcoModding Lurker
 
Join Date: Sep 2009
Location: Melbourne, Australia
Posts: 15
Thanks: 1
Thanked 10 Times in 8 Posts
Quote:
Originally Posted by Froggy View Post
Do you have any pictures of the artifacts?
I'll make a video of it running in both modes so you can see what happens. The problem may be with the LCD module itself and I have a few other modules here I could try, but before going to all the trouble of unsoldering it I was also thinking of quickly substituting the LiquidCrystal library for the current hard-coded LCD routines and see if that makes any difference. Hopefully I can narrow the problem down a bit so we know if it's hardware or software.

In the meantime though I haven't been too fussed about it because it works in 16x2 mode and I've got enough to do with the GPS and memory stick code.

Cheers :-)

Jonathan Oxer
jon.oxer.com.au / twitter.com/jonoxer / www.geekmyride.org
  Reply With Quote
Old 09-25-2009, 11:42 PM   #8 (permalink)
EcoModding Lurker
 
Join Date: Apr 2009
Location: Debolt, Alberta
Posts: 78
Thanks: 1
Thanked 2 Times in 2 Posts
Hopefully we can get the 20x4 working fine for you with minimal fuss (while you work on your GPS and memory stick code...) ;-)
  Reply With Quote
The Following User Says Thank You to Froggy For This Useful Post:
jonoxer (09-26-2009)
Old 09-26-2009, 01:21 AM   #9 (permalink)
EcoModding Lurker
 
Join Date: Sep 2009
Location: Melbourne, Australia
Posts: 15
Thanks: 1
Thanked 10 Times in 8 Posts
Video of OBDuino driving a 20x4 display, with the first row OK but everything else stacked on top of each other on the second row:

http://jon.oxer.com.au/pics/OBDuino-20x4.avi

Cheers :-)

Jonathan Oxer
jon.oxer.com.au / twitter.com/jonoxer / www.geekmyride.org
  Reply With Quote
The Following User Says Thank You to jonoxer For This Useful Post:
dewasha (07-16-2013)
Old 09-26-2009, 03:59 AM   #10 (permalink)
EcoModding Lurker
 
Join Date: Sep 2009
Location: Melbourne, Australia
Posts: 15
Thanks: 1
Thanked 10 Times in 8 Posts
I've just been for a bit of a drive with the OBDuino32KMega with a USB memory stick plugged in and logging enabled, and when I got back I wrote a little script to convert the GPS data into a KML file for Google Earth. I plotted location against vehicle speed and ended up with this:



Could be quite a handy tool for improving fuel economy, for example by plotting position against instantaneous fuel consumption or perhaps acceleration and trying to keep the height of the graph as low as possible.

  Reply With Quote
The Following User Says Thank You to jonoxer For This Useful Post:
dewasha (07-16-2013)
Reply  Post New Thread

Tags
arduino, mega, obd, obduino

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
OBDuino working with ELM327 Magister OpenGauge / MPGuino FE computer 46 01-01-2013 11:50 PM
OBDuino CAN version only, progress! Magister OpenGauge / MPGuino FE computer 26 01-19-2011 09:03 AM
OBDuino Feature Request... electromike OpenGauge / MPGuino FE computer 13 07-23-2009 02:46 PM
OBDuino mod - no need of 'uino' Dominik OpenGauge / MPGuino FE computer 4 06-19-2009 10:41 AM
OBDuino and the 328p? gone22 OpenGauge / MPGuino FE computer 0 04-12-2009 09:56 PM




Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com