EcoModder.com

EcoModder.com (https://ecomodder.com/forum/)
-   OpenGauge / MPGuino FE computer (https://ecomodder.com/forum/opengauge-mpguino-fe-computer.html)
-   -   OBDuino Mega (https://ecomodder.com/forum/showthread.php/obduino-mega-10300.html)

jonoxer 09-23-2009 07:54 PM

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.

http://www.practicalarduino.com/pics/obduino-mega.jpg

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.

nickdigger 09-23-2009 08:40 PM

"wow"

jonoxer 09-24-2009 09:16 AM

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

jonoxer 09-25-2009 10:10 AM

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

SVOboy 09-25-2009 03:15 PM

Great work :thumbup:

Froggy 09-25-2009 07:28 PM

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.

jonoxer 09-25-2009 08:27 PM

Quote:

Originally Posted by Froggy (Post 129820)
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

Froggy 09-25-2009 11:42 PM

Hopefully we can get the 20x4 working fine for you with minimal fuss (while you work on your GPS and memory stick code...) ;-)

jonoxer 09-26-2009 01:21 AM

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

jonoxer 09-26-2009 03:59 AM

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:

http://jon.oxer.com.au/pics/obduino-track.jpg

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.


All times are GMT -4. The time now is 06:23 AM.

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