My project complete - Vehicle Dynamics Datalogger

26 Apr 2010 . Edited: 27 Apr 2010

First I want to say thank you to the board and the mbed crew for all the help along the way.

My project is somewhat uniqe.  I have seen questions related to such a device but I now have it all working on one chip.  I have a vintage car that I take to the track often.  of course, the only thing vintage about it is its looks.  Just about everything else has been brougt up to a modern standard.  This includes the engine where the original carburetors were replaced with a Megasquirt fuel injection system.  Megasquirt is an open-source engine management system with all of the functionality of the much more expensive systems like Motec.  It is reasonably priced and geard toward the DIY developer.  While the system has always worked well I needed to see what the engine was doing while driving.  This meant a display project.

Last year I built a simple device that would talk to the Megasquirt ECU and display parameters on an LCD.  Being a track car means no radio and that slot is the perfect size for a character LCD.  I must admit that I played a partial role in the code devlopment for that ATmel device.  Many thanks to a sympathetic co-worker.  When I originally started the display project I envisioned additional functionality. Who knew it would take so long to make this happen. My code skills are poor at best but I can say I made this happen with only a little outside help.  The same  person that helped with the example code showed me the mbed and was amazed at the high level of functionality and number of output ports.  So I bought one thinking this would be the next generation.

The additional functionality I wanted was based upon datalogging capabilities.  Vehicle dymanic systems and loggers are easy to find if you want to spend the money.  When I saw the examples on the mbed I was really happy.  Everything I needed was right there.  SErial connection to ECU.  accelerometer, 4bit parallel display, SPI for SD card and an additional serial port for GPS.  yes, that is 5 devices working off the same MCU.

My build answers the call from DIY track enthusiasts, Motorcycles and other users that can not carry a laptop for obvious reasons. This is not meant to replace a laptop but rather be a supplement.
The current setup has the following features:

microSD card
switch operated file format (.frd) that imports into Megasquirt TunerStudio Software for engine analysis, tuning and feedback (Thanks to Phil Tobin for the help)
LCD display compatibility (# variables depends on size)

3-axis accelerometer

10Hz GPS
switch activated logging capability of engine parameters, acclerometer and GPS for vehicle dynamics in .csv format that imports into popular video editing software (Trackvision)
data rate ~10Hz (GPS limited)

I had some boards made to complete the project.   The boards have been complete for a while and I had to assemble and debug.  This took way too long since my day job got in the way.   All of the issues have been software related.  Thankfully, no current board revisions are planned.

The boards are dual sided.  The topside is basic functionality for the MS system.  This includes a micro controller, SD card slot and power supply.  There is also display output and a trim-pot for the LCD contrast.  The dual sided board was made with a full ground plane.  Hopefully, this will cut down on cross talk and noise from the car environment.  Boards are Sn plated Cu. 







The backside of the board is for additional functionality.  I have installed a 3-axis accelerometer and 10Hz GPS.  This provides full vehicle dynamics capability whereby I can log all the parameters of the engine along with position, velocity (yes, speed and heading direction) and acceleration data. 



Everything mounts nice and neat in a standard plastic project box.  There are two switches to enable different datalogging functions.  These are the .frd format for using in Tunerstudio and the vehicle dynamics logger which is a parameter datastack in .csv format.  The comma separated value (csv) table will allow insertion into popular track video overlay programs. 

There is a realtime output in the form of a multi-line character display.  I have 2x20 and 4x20 display capability.  The functionality is present to interface with a mobile LCD such that you would find in a cell phone.  I have not coded this in yet but would consider depending on demand. 



It has been a fun project to work on.

27 Apr 2010

James,

 

Impressive use of the mbed system!  It is quite amazing how many things you can hook up at the same time to this darn chip.  It fills that role of something smaller than a PC but bigger than a typical micro quite nicely, especially with the file system on flash support!

I'm curious what kinds of things you are datalogging.  Obviously you're getting position and velocity estimates from GPS, acceleration info from the 3-axis, but does the megasquirt feedback talk to the car via OBD or just directly to the sensors?  Also, how do you synchronize all of the data: do you use GPS time or the local real time clock time stamps?  Finally, did you write you own program to visualize the data, or just import it all into a spreadsheet or something?

Very interesting indeed!  I have hooked my mbed up to a car's OBD2 via an external serial port adapter, logged it to the onboard flash, and graphed it using python's matplotlib.  Unfortunately, it seems that OBD2 doesn't really provide all that much interesting data, especially if you are using a GPS anyway...

Thanks for the update!

-John

27 Apr 2010

This is really excellent! I just updated it to pull in the images properly, to do it justice :)

29 Apr 2010 . Edited: 29 Apr 2010

John,

Megasquirt is a standalone EFI system.  No OBD or OBDII involved.  I can output just about every parameter from the system if needed.  There are approximately 55 variables that update at nearly 500Hz.  My serial connection is not quite that fast due to delays required in the call command so I can only datalog in the mid-20Hz range; especially with the open/close function to write to the card.

The EFI has an internal couter (timer) that is used for the time stamp.  I can then correlate with real-time from the GPS. I only need relative time though.

You are correct that it fits a need that does not exist.  There are many people using this system on motorcycles and track cars where you can not take a tuning laptop with you.  This means that a local datalogger can be used in conjuction with external data analysis to map the motor output.  I went a step further and combined the acclerometer and GPS.  This competes with AIM, RaceData, TraqMate and others with an order of magnitude less cost.  Of course, they have fantastic data analysis software that I do not.

I am interested in a graphing software that will plot many variables with different axes values.  Do you have any suggestions?  I have not heard of matplotlib.  I usually just graph certain parameters using Excel.

btw, I have some boards available and can build a system if anyone is interested.

 

btw, Simon.  What code did you use to fix the pictures.  I realized that standard html image tags did not work.

06 May 2010

James, excellent project.  I have a microsquirt on my desk at home, acquired with the idea of building exactly what you've done.  Have you shared it with Bruce and the MS community?

--steve

06 May 2010

Steve,  Yes, I have it listed on both the B&G and Extra sites under Expansion boards.  I had 10 boards made for the initial run and have sold a few.  Let me know if you are interested in one.  I would be happy to share the code with you.

you can email at

jamie dot novak at hotmail dot com