PDA

View Full Version : 2 1/16 gauge ECM data display



3400tZ
11-09-2013, 11:10 PM
I've always wanted a nice display to run inside my car and that's one of the reason I started working on Android apps. Clarion recently came out with the AX (http://clarion.com.my/ax1/), an Android based head unit. That was the first I was seeing from a decent head unit company, instead of those Chinese no name one. The main issue with that unit tho is that it's running Android 2.3.7 which is already over 2 years old. I really want Ice Cream Sandwich at the very least. I would assume 2 years ago is when they started working on this thing but they need to update it as it's already way out-dated.

So while I'm waiting for that nice Android based head unit to come out, I thought I would come out with an alternative solution for a permanently mounted display. This is when I thought I could turn my boring Voltmeter into something much more powerful. I will be replacing it with a gauge that will be reading data from the ECM over the CAN bus. I'm mentionning CAN bus because I'm running a MegaSquirt ECM and it will be a much better option then serial as it will allow me to keep the gauge connected all the time while still have access to the USB port on the MegaSquirt to tune / datalog. Also, the gauge being a CAN device will allow me to tune it using the USB port of the ECM. That way I can change the gauge display value or whatever gauge parameter with an Android device or netbook in the same tuning software that I use to tune / datalog.

Making this project fully customizable and working on any ECM (even any MegaSquirt) would take years so this will be mostly be an hard coded version for my specific application. I might start "unharcoding" some stuff at some point but it will take a while. The good news for you guys is that it will be open source so I really hope I will have a few person jump in and create an ALDL fork or something :)

I've done similar project in the past but using an LCD touch screen instead and let me tell you that the OLED screen seems to be a much better option for automotive use. The display seems to look good from any angle which is definitely not the case of an LCD screen (or at least the one I had).

Any one interested in this project ? :) I will keep updating this thread if you guys think this is an interesting project!

The OLED I got now is this one: http://www.adafruit.com/products/938

The code will be hosted here: https://bitbucket.org/SebGiroux/diyecmgauge/overview

Here is where I'm at after 15 mins of work:

http://i.imgur.com/yIJJoDU.jpg

mikew
11-10-2013, 02:38 AM
Very nice.

If anyone is interested, here's a link to a couple of Arduino based 8192 ALDL loggers that I've built: http://www.xm381.com/xm381/aldl.html

Just like 3400tZ, mine is designed for my specific application a 1227727 ECU with $A1 code but could easily adapted to any 8192 ECU.

3400tZ has motivated me to look a little further into a gauge mounted logger for 8192 ALDL.

I suspect 160 baud should be quite doable too.

My projects use a hardware serial port but I think one of my next step is to build an 160/8192 communications library based on the softwareserial one.

EagleMark
11-10-2013, 03:57 AM
I approve these projects! :thumbsup:

Just kidding, this is way cool stuff guys! :jfj:

3400tZ
11-11-2013, 07:19 AM
Few more hours of coding:

http://www.youtube.com/watch?v=kWo5rbVbsno

I have a few issue now tho.

The first one is that I'm maxing out pretty much everything on the Uno. I tried loading all libraries I want to use at some point (GPS and all), and I got this output from the compiler:

Binary sketch size: 18174 bytes (of a 32256 byte maximum, 56.34 percent).
Estimated memory use: 2416 bytes (of a 2048 byte maximum, 117.97 percent).

So It's maxing out the SRAM just loading the library, I haven't done anything with them yet.

So Uno definitely won't work. Flora is not gonna work either (I think they are 2.5k SRAM ?) I'm thinking about getting a Mega now. I was looking at the Due but it seems to be too incompatible with so many thing, it could be annoying. The Due is somehow cheaper then the Mega tho...

The issue with the Mega (or Due) is the SPI pins seems to be at different places then the Uno so I will end up having to do something like this:

http://www.vintagecomputercables.com/img/wires1.jpg

http://www.vintagecomputercables.com/img/wires3.jpg



So as you can see in the video, I'm currently using a push button to change page. It's way too sensitive now and I need some debouncing but it's a pain to do in the software as Arduino doesn't support calling millis() function inside an interrupt which is very annoying. So I will probably end up with a hardware solution by adding a capacitor, something like this:

http://img.photobucket.com/albums/v639/takeme2/hardwaredebounce.png

The original plan tho was to use these two things:
http://www.adafruit.com/products/1096
http://www.adafruit.com/products/1391

As you can see on my video. The issue is that for some reason it doesn't work. When I got the receiver, only half the pins were soldered on the PCB I went ahead and soldered everything but maybe I shouldn't have done that ? Anyway, its cheap enough, I will order another one next time and see how it goes. It would be cool to control the gauge with the remote instead.

I've commited the code in the bitbucket repo I posted the link above if anyone is interested, but so far, it's a mess. :)

steveo
11-11-2013, 08:30 AM
i'd like to see the code, but it appears that your bitbucket repo is private

mikew
11-11-2013, 05:00 PM
Looking good.

I'm sure you know this; the Meg2560 and the newer UNO's both have an 6 pin ICSP header (for SPI) in a common location, but it looks like your CAN bus shield was designed for the older style boards since it doesn't have those connections (unless they are surface mount on the bottom of the board).

3400tZ
11-12-2013, 03:54 AM
steveo, sorry about that, I'm was pretty sure I created it public from the beginning. Oh well, now it is, let me know if you have any issue.

Mike, yeah both CAN bus shields that I know of don't have the ICSP header. To make it worse, SparkFun does sell this thing https://www.sparkfun.com/products/11469 that I think would work to change the pin out back to "normal" but I'm not 100% sure it will work fine with the Mega and it has no holes that I need for my enclosure (https://www.sparkfun.com/products/10088) that seems to be a standard for arduino stuff. So I found this shield instead https://www.gorilladistribution.com.au/product/leoshield/ that does seems to be a better option. So now I'm trying to go back to sparkfun to look for an enclosure that could possibly contains two shields and their site down for maintenance for a few hours... fun fun fun :D

It seems like everything is incompatible with something, its a pain in the a** :D

EagleMark
11-12-2013, 04:09 AM
So now I'm trying to go back to sparkfun to look for an enclosure that could possibly contains two shields and their site down for maintenance for a few hours... fun fun fun :D
It's the Obamacare website virus... :laugh:

Six_Shooter
11-12-2013, 05:12 AM
It seems like everything is incompatible with something, its a pain in the a** :D

Which is why I don't rely on shields, I just breadboard it.

I have one shield that I bought when I bought my Uno, for the LCD, because it was simple and it made it easy to do some of the basic LCD stuff I wanted to do.

If you're looking for alternate gear look at the Teensy, it's very much like the Arduino, even uses the Arduino IDE, but seems more powerful, IIRC. I have a Teensy++ 2.0 and it's nice, especially for for plugging into and using a breadboard for development.

www.pjrc.com

Six_Shooter
11-12-2013, 05:31 AM
I just spent a few minutes verifying that the Teensy++ 2.0 has 8kB of SRAM, referred to simply as "RAM" on the PRJC site.

http://www.pjrc.com/teensy/index.html

Atmel page (the Teensy uses the 1286 uC):
http://www.atmel.ca/devices/AT90USB1286.aspx?tab=parameters

Did I mention the Teensy is cheaper than the Arduino?

3400tZ
11-12-2013, 05:32 AM
Yeah, my problem is that I don't really know what I'm doing in term of hardware :P I think I will buy that "LeoShield" and an Arduino Mega because I know all that stuff will work together out of the box. I don't mind buying some Arduino hardware as I know this isn't the last little project like that that I will do so it's always nice to have some stuff already laying around.

I haven't forgot your offer to create a proper PCB tho :) I was thinking it could be cool to maybe eventually sell a nice PCB for that project as well as some open source libraries that are already working for MS/ALDL/ODB2 as a DIY data display gauge type of project. I bet some people would be interested in that!

Six_Shooter
11-12-2013, 05:41 AM
Where you're headed with this is what I wanted to create for my GM stuff, I'm just not that good at writing code, other than assembly, I seem to have my head pretty wrapped around that...

I was hoping that the TVII that I have in my car would have done this, it was supposed to, but since the creator of it has backed off from pretty much all GM support it makes it almost useless. There's only a few things that can be displayed on it, that can't be done with regular gauges. I'm using mine right now mostly as my temp gauge since I don't currently have one in my dash.

Anyway, the way to go with this, hardware wise is SMD devices to make it small and fit INSIDE a gauge, with only a few external connections. But like some gauge companies are doing you could make one control box that feeds one or more gauges on a common databus, SPI, I2C, etc.

It's not hard to follow the pinouts and figure out what connects to where, there's enough information on the interwebz to help there, especially since most shields schematics are available, you can pick out what you need and leave the rest alone, and connect the appropriate pins. Take a look at the Teensy, it's a pretty atout bit of kit.

3400tZ
11-12-2013, 06:06 AM
If you learned Assembly, you can learn C++. Especially on the Arduino platform with all the library and stuff, it's pretty easy. As a programmer, I did look at Assembly but it's one of the rare programming language that I haven't done a project with because its so low level that I feel that it takes sooooo much time to do pretty much nothing, I got bored quickly :)

I agree the Teensy board looks pretty cool. Pretty much the chip I need for a really good price. I'm not sure why the Mega is so freaking expensive (more then the Due for some reason ?). The main advantage of the Mega as you said is that I won't have to look at any schematic or anything, I will just slap everything together and it will work (or at least, I hope :P).

I think this setup is what I will be using:
- Arduino Mega https://www.sparkfun.com/products/11061
(https://www.sparkfun.com/products/11061)- LeoShield https://www.gorilladistribution.com.au/product/leoshield/
- CAN bus shield https://www.sparkfun.com/products/10039
- Enclosure https://www.sparkfun.com/products/10033

I will be ordering a GPS module and Accelerometer from Adafruit soon as well.

The advantage with all this is that I should be able to have a somewhat clean prototype without wires everywhere while doing minimal work. I will probably use the proto area on the LeoShield for a small power supply and whatever hardware I decide for the page changing thingy (either with the key fob or with a push button). As a software guy, I would rather pay more for the hardware (I do realize its quite a bit more in this case) and spend more time making the software awesome instead :) I understand you think I'm retarded to pay that much tho but I'm OK with that :P

mikew
11-14-2013, 05:51 AM
Got some empty 2" x 1 5/8" deep gauge cases on their way!

I purchase Westach aircraft grade EGT gauges for one of my other hobbies, http://www.xm381.com They custom build each gauge for your specific installation, so when ordering another EGT gauge yesterday I asked if I could buy empty cases and they said yep.

This is what I'm thinking: this LED ring, http://www.adafruit.com/products/1463 and this OLED display (same as what 3400tZ is using I think), http://www.adafruit.com/products/938 powered by one of the small Arduino's like this, http://arduino.cc/en/Main/ArduinoBoardNano and a bluetooth transceiver like so, http://imall.iteadstudio.com/im120723009.html I think I can get it all to fit in the gauge case. I've got communication code for this already working here: http://www.xm381.com/xm381/aldl.html and pretty much done with the bluetooth portion too.

Functionally in stand alone mode the gauge will request ALDL data and then display it (a button or two for navigation between parameters) but when you pair with the bluetooth the gauge will then let TunerPro, ALDLDroid, etc. request the data then transmit the ALDL stream back.

BTW, hows it coming on ALDLDroid?

3400tZ
11-15-2013, 03:34 AM
Cool that you found some empty gauge cases, let us know how it goes with them! I've been ordering a bunch more stuff for this project lately. :)

What do you mean hows it coming on ALDLdroid ?

mikew
11-15-2013, 04:08 AM
I'm gearing my ALDL Gauge to work with your ALDLdroid, it can operate stand alone or as a bluetooth connection for ALDLdroid (function as a standard bluetooth to ALDL interface, got that working at 8192, might look into 160 also).

With 2" of gauge face to work with there's not much real-estate for displaying data, a parameter or two at a time. So I can see your ALDLdroid being used when I want to see a bunch of stuff at once.

And then's there's logging; although it would be reasonable to implement, once again using ALDLdroid solves a lot of problems (like ease of getting logs to a PC, etc).

So I'm kind of excited to see them work together!

3400tZ
11-15-2013, 04:16 AM
I see what you mean, you want the gauge to act as a proxy, right ? So the gauge is connected to the ECM and ALDLdroid is connected to the gauge using Bluetooth. If ALDLdroid is getting the same exact data stream as the ECM from the gauge, I really don't see why it wouldn't work :) That's not a bad idea at all to have both working at the same time!

mikew
11-15-2013, 04:37 AM
I got the basics working today.

In standalone mode the gauge requests data from the ECM, which means it has the mode request and data stream info in the Arduino sketch (I'm only doing mode 1 requests).

But when when the bluetooth is paired, I used TunerPro in testing today, the gauge lets the external software submit the requests. That way you can do other things like mode 10, etc.

At some point I might implement a microSD card so you can put an ADX file on it instead of hard coding the ALDL info into the sketch, but for now I'm just going to set it up for my specific installation.

3400tZ
11-15-2013, 04:47 AM
Sounds good, sounds like you have done quite a bit already :)

I think it's better to do config at compile time for such project, instead of loading file from an SD card. From experience, it was so slow streaming a file from a SD card and then you still have to write a parser :D Of course, its not as sexy to do a compile time config but give better (faster loading and stuff) results IMO.

mikew
11-17-2013, 02:50 AM
Well, here's a prototype of my ALDL Gauge:


http://youtu.be/o7cHG4JSi70

It's not real data, just experimenting with visuals and packaging.

The colors are a little over saturated making them hard to distinguish, but the "sweep" changes from green to yellow to red depending on the RPM.

The Arduino NANO, HC-05 Bluetooth, display "sandwich" and another board for input and power conditioning will all easily fit in the gauge case. I will have an external rotary encoder that has a momentary push switch too for changing what is displayed on the gauge.

Now to modify my existing ALDL logging code so that it works with the new display.

Here's some pictures of the OLED text display / RGB LED Sweep sandwich. This ring on the last image is a 2" gauge bezel, for size comparison.

581658175818

3400tZ
11-17-2013, 03:21 AM
Looks sweet! It's cool that you can use the Flora stuff for your project... 2.5KB of SRAM is not enough for mine :/ I want to see once you have yours installed into the gauge casing now! You should create a bit bucket (or GitHub) account and use GIT to have version control on your code. It would also allow easier sharing with everyone :)

mikew
11-17-2013, 03:36 AM
Ended up using an Arduino Nano instead of the Flora because I didn't want to deal with 3.3v / 5v level shifting.

I might run out of memory too.... The Adafruit OLED library reserves a 1k buffer for building the screen images! Too big! If I can't find a different library the Nano won't cut it and I will have a tough time shoving everything in the case.

By the way, have you seen this: http://jkdevices.com/arduino-megamini

You can get an optional Accelerometer/Gyro/Compass (MPU-9150) chip on-board too.

3400tZ
11-17-2013, 03:46 AM
Yeah that library is using so much RAM, I noticed that too. With the OLED, CAN , GPS, Accelerometer and Compass libraries, I think I'm at almost 3k SRAM.

Pretty cool about the megamini! I wonder if it fit in a gauge, it looks like it might be a bit too big still ?

Personally, I know my prototype is not going to fit in a gauge anyway tho. I got my Arduino Mega 2560 this week and I've ordered the ultimate GPS w/ 10Hz updates and the accelerometer+compass from Adafruit. Still waiting for my CAN bus shield from Sparkfun and the Leoshield as well. So no progress is gonna be made on this project this weekend but I should receive most of my stuff, if not all, next week!

http://i.imgur.com/56QTspf.jpg

mikew
11-17-2013, 04:06 AM
Mega is what I've used on my other projects too. 8k of memory and 3 hardware serial ports are real handy.

The Arduino-MegaMini is 3" long and the Teensy++ 2.0 is 2", neither will fit in the 2 1/16" x 1 5/8" gauge case.

I'm not optimistic about getting everything in the case at this point...unless I put two Nano's in the case (they should fit) one for ALDL communications and one for display. Is that just getting carried away?

3400tZ
11-17-2013, 04:16 AM
Maybe the easiest thing to do is just to optimize that library for the display. It shouldn't need that much RAM... :) If you don't want much else then the display and ECM communication tho, it might be OK.

Six_Shooter
11-17-2013, 04:57 AM
You guys have to start thinking less Arduino and more custom PCB.

Arduino and Teensy++ 2/3.0 are great for prototyping/proof of concept, but when it comes to actually producing something, even as a one off for yourself to fit in a specific form factor, custom PCB is the way the to go.

3400tZ
11-17-2013, 05:08 AM
I don't mind having the "brain" of the gauge external for now.

But yeah, Chris, if you feel like getting the ball rolling on a PCB with the atmega2650, power supply circuit, CAN controller, CAN transceiver, GPS module, Accelerometer module, etc, please go for it :D

Six_Shooter
11-17-2013, 08:54 AM
I don't mind having the "brain" of the gauge external for now.

But yeah, Chris, if you feel like getting the ball rolling on a PCB with the atmega2650, power supply circuit, CAN controller, CAN transceiver, GPS module, Accelerometer module, etc, please go for it :D


I'll wait until you have final prototype, so that all known components will be accounted for, and then can see what parts can be stripped out...

In most cases the main processor can be swapped out for a smaller physical one with less IO, or a smaller foot print, such as going to an SMD device that uses a smaller pin pitch can save a LOT of space, and then there are a bunch of components that's present on an Uno or similar Arduino that can be eliminated from a final design, saving on space. Then there's usually components on the shields that are extra and not needed, when a uniform design is achieved.

3400tZ
11-18-2013, 01:47 AM
It would be based on the Mega CPU, that's already SMD. But yeah, there is way too many I/O's on it. Downgrading the numbers of pins on the processor will be fine as long as it doesn't require rewriting the whole code. I would like to keep the Arduino bootloader on the processor so the Arduino stuff can still be used.

Today I got my 100nF capacitor so I did the hardware debouncing for the push button. Works much better now :)

http://i.imgur.com/03iN9E8.jpg

Six_Shooter
11-18-2013, 06:16 AM
Sometimes some of the code needs changes when going to a more efficient IC, by more efficient, I mean a size of EPROM, RAM, and IO that matches the application, but usually it's just pin re-assignments, which if you do the set-up correctly is a few minute process to change the pin assignments, with going down only a few lines from the top. ;)

The boot loader can be programmed to the Atmel ICs, and then used just like an Arduino, but sometimes that space used by the bootloader is much better used for the code, and then use an ICSP connector to program the IC instead. Once I get a few of my projects a little farther along to the point where I will be making the custom PCB, etc, the ICSP header is my planned way of going about the programming. Obviously there might be some projects that would benefit from the USB connectivity, but most of the ones I have planned don't need that convenience.

Jim85IROC
11-18-2013, 05:00 PM
This is great stuff! Prior to reading this thread, I'd never even heard of the Arduino stuff. Now I've got an Uno, a couple LCDs, and a "starter" pack on the way. To get re-acquainted with coding (I'm almost 15 years out of college, and haven't used it since then), I'm going to follow some of the simple tutorials to make lights blink, etc, and then build a little display to show coolant temp, fuel level, battery voltage, oil pressure, etc, right from the sensors. After I accomplish that, I want to follow in the footsteps that you guys are taking and start grabbing some of the OBD II data so I can display that as well. My end goal is to simplify the instrumentation in my IROC when I do my LS swap by having a 2.8" TFT between the speedo & tach (like a lot of the newer vehicles utilize) to display sensor data as well as OBD II data.

One question for you guys... how are you interfacing to the OBD port? Are you using some sort of ELM327 device, or are you connecting directly to the OBD port?

3400tZ
11-19-2013, 03:02 AM
For ODB1, there is a circuit that need to be build (or a cable that need to be purchased). For ODB2, as you said, with an ELM327 adapter, its very easy. I would say its probably the easier beside ALDL and MegaSquirt (Megasquirt CAN being the hardest :P). That adapter can be Bluetooth or USB. If you wouldn't have already bought your Arduino stuff, I would have told you to look at http://arduinodev.com/hardware/, he got a good collection of Arduino kit for ODB2. He got a pretty clean ODB2 Arduino library that you can look at here (https://github.com/stanleyhuangyc/ArduinoOBD/blob/master/libraries/OBD/OBD.cpp) (and still use with whatever Arduino you bought). Also, he has this ODB2 emulator (http://arduinodev.com/freematics-emulator/) which seems pretty damn cool, no ECM bench test needed for testing from what I've understood, the emulator will emulate the whole ECM, not only the sensor like the JimStim does when we use it for ALDL or MegaSquirt. I might have to buy one at some point :)

Jim85IROC
11-19-2013, 06:35 AM
For ODB1, there is a circuit that need to be build (or a cable that need to be purchased). For ODB2, as you said, with an ELM327 adapter, its very easy. I would say its probably the easier beside ALDL and MegaSquirt (Megasquirt CAN being the hardest :P). That adapter can be Bluetooth or USB. If you wouldn't have already bought your Arduino stuff, I would have told you to look at http://arduinodev.com/hardware/, he got a good collection of Arduino kit for ODB2. He got a pretty clean ODB2 Arduino library that you can look at here (https://github.com/stanleyhuangyc/ArduinoOBD/blob/master/libraries/OBD/OBD.cpp) (and still use with whatever Arduino you bought). Also, he has this ODB2 emulator (http://arduinodev.com/freematics-emulator/) which seems pretty damn cool, no ECM bench test needed for testing from what I've understood, the emulator will emulate the whole ECM, not only the sensor like the JimStim does when we use it for ALDL or MegaSquirt. I might have to buy one at some point :)
I found that arduinodev.com site, and I like that setup. I'm not sure yet if I prefer that setup or this one from sparkfun: https://www.sparkfun.com/tutorials/294

The sparkfun version seems to have a fair number of people who are unable to get it to work, plus I think I like the cleaner 4-wire installation of the arduinodev version. After I get familiar with the Arduino, I'm going to dive in. I made some LEDs blink tonight. :twirls-finger:

3400tZ
11-19-2013, 06:47 AM
My experience with SparkFun is that their products are great but the documentation sucks! It's usually example code written by costumer that couldn't find any example code. I try to buy from elsewhere whenever possible. Adafruit has awesome tutorials, no OBD2 related products unfortunately but a bunch of other great stuff.

Arduinodev definitely seems to be good stuff but I haven't deal with that guy yet.

Jim85IROC
11-19-2013, 08:20 PM
Yeah, when the time comes, I suspect that I'll give the arduinodev guy a try. For now I'm going to stick with getting meaningful data from a temp sensor, oil pressure sender, fuel level sender, etc, and pushing that to a TFT through a halfway decent looking GUI. It looks like that will actually be harder than getting the OBD II data.

3400tZ
11-23-2013, 07:55 AM
So I've made some progress on this. I received my CAN bus shield and I'm now pulling data from the CAN bus of the MS with an Arduino Uno. It's a different Uno then the one my display is on as I'm running out of RAM to run everything otherwise. I've got an Arduino Mega but I'm still waiting on my leoshield. I've also ordered a GPS and accelerometer from Adafruit that I should receive sometime next week.

Code for the CAN stuff is here: https://gist.github.com/sebgiroux/7575688 if somebody is curious. That would be the first full MS can bus arduino example on the net I assume as I couldn't find anything else (and its not that easy to do!). It's going to be merged with the rest once I got the Mega setup as I said.

I've also received my cheap gauges that I wanted to use to install the screen in. Turned out those gauges don't have removable bezel so I had to saw the damn thing :/ I will figure out a way to put it back together, I might buy a plastic welder, or just hot glue the bezel back on or something...

I'm pretty happy with the result of the screen behind the tinted face tho, looks pretty good. I will add a black thing to hide the PCB of the screen.


http://i.imgur.com/ZF7tVdn.jpg
http://i.imgur.com/Qal4W19.jpg
http://i.imgur.com/rKGLOKg.jpg

3400tZ
11-24-2013, 08:05 AM
Today, I've added a buzzer that will eventually be used for when alarm values are reached. It will make a perfect alarm as its super annoying and for only 1.50$ :)

On my other Uno currently running the CAN bus shield, I started coding the data logging on SD card stuff but I'm already running out of RAM, lameeeeee. Just loading the SD library use half the Uno RAM and the CAN library use like 1/4 so I end up with very little for the main sketch.

And waiting for ordered hardware to arrive sucks! And I'm always realizing I need something else I didn't thought about until now. This should move much faster once I have the hardware prototype done.

http://i.imgur.com/qWP9aTR.jpg

3400tZ
11-25-2013, 01:31 AM
So, is it just me or it looks like the SparkFun CAN bus shield doesn't have the CD (card detect) pin for the SD card connected to anything ? See https://www.sparkfun.com/datasheets/DevTools/Arduino/canbus_shield-v12.pdf

I want to start/stop data logging as the SD card is inserted/removed. I was looking for the best way to do that and it looks like using the CD pin and an interrupt would be best, but for some reason, they didn't connect the pin (WHY?!). The only other way I see to do this is doing polling in the main loop but that's an ugly solution and not to mention that it will slow down everything else. I'm really starting to hate SparkFun more and more...

I will start with what I have but looks like Adafruit board (http://www.adafruit.com/products/254) will be a better option down the road.

I really cannot wait to have the hardware prototype all figured out, this is getting annoying (and expensive!). :D

Six_Shooter
11-25-2013, 02:08 AM
I think a better solution would be to have a button that starts and stops datalogging.

I know personally I would HATE to have to insert and eject the SD card whenever I would want to start and stop a datalog. I would rather leave the SD card in place and just press a button.

I don't see a CD pin anywhere on that schematic. Wrong schematic?

3400tZ
11-25-2013, 02:41 AM
Well, what is the difference between pushing a button or a card ? :P I personally want a clean look for the gauge (can't have 15 buttons on a 2 1/16 gauge anyway) so I'm trying to avoid having buttons for everything.

But I like your reply because it shows that everybody has different needs/interests. I want that project to go in that exact direction. Like you were saying earlier in this thread I think, you bought a similar device that wasn't doing what you wanted it to do and you was stuck with whatever you bought because it was impossible to customize it. I want both the code and hardware for this project to be super flexible so people can really have it the way they want. For example, one advantage of having the card always in like you're proposing is that you could create different data logging trigger events. For example, start data logging when TPS > 25% and stop when TPS < 15% or something... That's isn't something I'm interested in but I'm sure it could be the case for some people. In that case, you obviously need the card to be in all the time.

For that particular SD card discussion, I think the firmware doesn't even care about the hardware for button or card detection. It will just monitor a pin and will start/stop the data logging when the pin is LOW/HIGH.

I think it's very important that the code of this project is very modular and easily tweak-able but it does mean that anybody that want to build their own gauge will have to do a bit of coding / hardware but they will also end up with the exact product they want if they put the effort into it.

My version of the project probably is going to be overkill for most people. To be honest, I think it is overkill as well but I want to go all out. So it is going to include the following:

- ECU monitoring of whatever parameters chosen at compile time
- Data logging on SD card
- Data logs info (free space on SD card, number of data logs, etc)
- Quarter mile time (with 60', 1/8 E.T. and MPH, 1/4 E.T. and MPH)
- 0-60 times
- Alarm when specific values reached (w/ buzzer)
- Switching between pages of the gauge using a key fob
- Temperature sensor
- Humidity sensor
- Altitude sensor
- Real-time clock so the data log file name use the current date
- GPS data (w/ data logging)
- Triple axis accelerometer
- Compass

All into a 2 1/16 gauge (with external box).

The good news is that all can be disabled at compile time so you end up with just what you need. What you decide to use can be tweaked for you need as said above.

3400tZ
11-25-2013, 02:45 AM
I don't see a CD pin anywhere on that schematic. Wrong schematic?

It is the right schematic. It's probably CD1 and CD2 (the holder seems to have two little tabs thingy). They are both connected to ground.

Six_Shooter
11-25-2013, 03:00 AM
I see those pins now, I wasn't looking at the external connections (traces) but the pin names in each device.

You hit the nail on the head, leave the card in and have the ability to trigger whenever, including the software detectable ones like you suggest.

There's less likely chance that you will damage a button, or lose it, by pressing it to start/stop a datalog there there is when you insert/remove an SD card. ;)

I always found it annoying when I had to perform similar operations with other devices, such as (and this will date me a little) cassette players in cars, for many years you had to insert the cassette to listen to it, which is fine, but then to go back to radio, you had to eject the cassette, instead of just hitting a source button. ;)

With the source code being open, that does change things a little. :)

3400tZ
11-25-2013, 03:15 AM
Exactly!

For some reason, with Arduino, most people just put all their code into one .ino file and that's it. This is definitely not the way I want to go for this project. I want everything to be organized and each module into their own .cpp file. In the end, it will probably require a bit more RAM and flash to do it this way (and maybe that's why people don't use OOP as much with Arduino ?) but the code is going to be soooo much cleaner.

Here is what I have in mind:

ECU comms (choose one)
- ALDL 8192 baud
- ALDL 160 baud
- MegaSquirt Serial
- MegaSquirt CAN
- OBD 2

Display pages (choose 0 or more):
- ECU monitoring pages (can be enabled as many time as wanted)
- 0-60 time
- Quarter mile time
- SD card info (if SD card data logging enabled)
- Weather (Temperature/Humidity/Altitude)
- G-force and compass
- GPS data

Optional modules (choose 0 or more):
- SD card data logging
- RTC (to properly name data logs files)
- Data logging trigger (if data logging enabled)
- Alarms (w/ buzzer)

3400tZ
11-25-2013, 05:05 AM
Just realized this is already getting out of control a bit :innocent2:. I bought more stuff tonight, and I think I'm at about 500$ into this already :yikes: Of course I will end up with A LOT of spare parts after I'm done but still a bit crazy. I just bought a Due, I want to use the Mega but I might give the Due a try at some point. In the end, it's cheaper then the Mega (doesn't matter for me now that I've bought both :P) and it has more hardware then this project will ever need (I hope).

Now, I need to stop buying stuff, receive everything and start the real coding!

3400tZ
11-27-2013, 06:33 AM
I've renamed this project "DIY ECM Gauge" which seems to fit better with where I want to go with this then "MS CAN Gauge" :)

So repo is now at https://bitbucket.org/SebGiroux/diyecmgauge

(Still on hold on the project, waiting for a bunch of stuff to arrive still)

mikew
11-27-2013, 07:06 AM
My ALDLGauge is pretty much done. Hooked it up to the '59 Jaguar. Got live data on the gauge and can transmit via BlueTooth to TunerPro!

Inside of the gauge case is a 16 pixel RGB LED ring, a 128 x 64 OLED display, two Arduino Pro Mini's (one handles the RGB ring and OLED display, one handles communications), a bluetooth transceiver and a 5v DC-DC power supply. There is a digital encoder that is remotely mounted to navigate through the display screens.

5905590659075904

And exciting video of the gauge in action!


http://youtu.be/b1hTfXrwIAo

3400tZ
11-27-2013, 07:22 AM
Looks awesome Mike! What are you using for a power supply circuit for 12V ?

mikew
11-27-2013, 07:31 AM
I use these:

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=321180078985

2A DC-DC converter.

5908

3400tZ
11-27-2013, 07:58 AM
Cool, ty. I will have to get one of those at some point!

3400tZ
12-01-2013, 04:49 AM
So I moved everything over to an Arduino Mega.

Updated code is always here: https://bitbucket.org/SebGiroux/diyecmgauge. Still have a ton of work to do but all the component are working and basic stuff is hapening.

I can't wait to have finally received everything and start cleaning up this rat nest :)

http://i.imgur.com/G5FOMIM.jpg

And here is the schematic:

https://bitbucket.org/SebGiroux/diyecmgauge/raw/9da9afd57c4287a549c47b4a5625de207701ae58/schematics/breadboard.png

Jim85IROC
12-03-2013, 07:39 PM
Your progress looks great! Just a couple comments:
Your issues with using all your Ram for the libraries is one that it seems a lot of people run into. Generally it seems that people trim the fat out of the libraries to help save space (as well as make things faster - something that's important when driving TFTs). You may want to fish through those libraries and dump the sections that you're not utilizing.

If you decide to add a button, you can look into the "joystick" style buttons. This gives you 5 buttons in one. I picked one up for my project, since I want to be able to scroll through various selections and be able to select one in order to change my display.

BTW Mike, that ALDL gauge is fantastic! Do you have any plans to share the source code? Quite a lot of what you implemented is similar to what I'm hoping to do, albeit mine will be interfacing OBDII and pushed to a TFT.

mikew
12-03-2013, 08:10 PM
Thanks Jim85IROC,

I will post code and construction information shortly. Getting the parts to all fit in the case was the real challenge!

I'd think my stuff would be easily adaptable to ODBII.

I did the B/W OLED because they are quite readable in different lighting conditions. Color OLED would be nice too but the Arduino Pro Mini's definitely don't have the memory for that. I'd considered a Teensy 3.0 or MegaMini, plenty of memory, but neither will fit in the case but are small enough to be packaged in the gauges external wire harness.

I'm using a rotary encoder for input, it's also got a momentary pushbutton. Two Arduino pins let's you navigate up and down through the available ALDL parameters. One more Arduino pin let's you use the pushbutton to do something, not yet implemented on mine.

The next version, I'm never quite done with toys I build, will probably use the Teensy 3.0, maybe color OLED and for sure utilize the pushbutton for min/max average display of values.

Converting the last ALDL logger I built to CANBUS for OBDII might be a thought, Arduino Mega2560, color LCD, touchscreen, SD card, LiPo battery powered as is, adding bluetooth would be a snap. http://www.xm381.com/xm381/aldl.html#5

3400tZ
12-05-2013, 03:46 AM
Jim, I agree that the libraries can usually be trimmed down. While that bring some good points like lower RAM usage and better performance like you mentioned, it can also introduce bugs and make updating the library a lot more painful (have to redo the changes every time). At this point, I really want to focus on the main sketch and not worry about those libraries. That's a reason why I try to buy most of the stuff from Adafruit, they have good tutorial with their products and usually a decent library as well that get you going pretty fast. Throwing hardware at the problem at first for the prototype is a good way to work around that issue at first. The only reason I started with an Uno is because I had one laying around :) And now I will probably be fine with the Mega but the reason I bought the Due anyway is really just to give it a try :P

Good idea about the button, I will have to keep that in mind for sure :)

Jim85IROC
12-05-2013, 07:26 PM
FYI, this is the 5-way button I'm using:
http://www.adafruit.com/products/504?gclid=CMPlmp--mbsCFeFlOgodlUMAcQ

Sparkfun also has a number of joysticks that use pots for X & Y movement. This is a neat idea because you use less input pins for X & Y movement, plus you get proportional control. These are pretty popular and have a lot of usage code available to draw from.
Here's one on Sparkfun that I want to try: https://www.sparkfun.com/products/9032

Arduino's site has joystick tutorials, and Jeremy Blum also has one in the Arduino book I'm reading. There's also one right in the Sparkfun link above.
http://www.arduino.cc/en/Tutorial/JoyStick

mikew
12-09-2013, 06:35 AM
Here's a link with info and code for the three projects below, ALDL_Communication (the basic Mode 1 request), ALDL Bluetooth Repeater (ECU to ALDLdroid / TunerPro via bluetooth) and the ALDL Gauge: http://www.xm381.com/xm381/aldl.html

601060116012

Jim85IROC
12-10-2013, 12:20 AM
Awesome, thanks for posting that. Looking at your display code especially should prove very helpful when it comes time to start making mine do what i want it to. Just doing simple things like getting the display to update from double-digit numbers down to single-digit numbers (i.e. decreasing speed in a digital speedo) proved to be much more complicated than I'd imagined. I'm expecting similar issues associated with hysteresis and I'm anxious to look at your code tonight to see how you're handling that sort of stuff.

3400tZ
12-22-2013, 03:39 AM
Time for an update on this project! I pretty much spent all day on it. I finally have a working and somewhat decent looking prototype. The prototype probably won't change anymore in term of hardware for this year but the firmware will change / improve A LOT!

Again, all the following is working in both hardware and firmware:
- MS communication with CAN bus
- Triple axis accelerometer + Compass
- Temp + humidity sensors reading
- GPS
- SD card for data logging
- Buzzer

Mike (mikew) sent me a empty gauge case and it turned out to be a much better option then the crap gauge I had. I've used 20% window tint on the gauge face to hide the screen PCB a bit. I've realized that I'm putting way too much crap on a single page now that the screen is in the gauge so I will increase the font size and reduce the number of items on one page so its easier to read. This is all easy stuff.

Also, I'm working on a computer side software that will allow to configure the gauge using the USB port. I'm writing it in Java so it works on any platform (Windows, Linux, Mac OSX) and could also be somewhat easily converted to Android at some point. It will allow to changes what the gauge is displaying as well as hopefully listing and downloading logs from the SD card and a bunch of other stuff. All this will be open source like the firmware.


http://monbazou.com/filedump/seb/diyecmgauge/IMG_0655.JPG

http://monbazou.com/filedump/seb/diyecmgauge/IMG_0658.JPG

http://monbazou.com/filedump/seb/diyecmgauge/IMG_0661.JPG

http://monbazou.com/filedump/seb/diyecmgauge/IMG_0662.JPG

http://monbazou.com/filedump/seb/diyecmgauge/IMG_0666.JPG

http://monbazou.com/filedump/seb/diyecmgauge/IMG_0670.JPG

http://monbazou.com/filedump/seb/diyecmgauge/IMG_0671.JPG

3400tZ
12-22-2013, 04:32 AM
Bigger text is definitely better :)

http://monbazou.com/filedump/seb/diyecmgauge/IMG_0672.JPG

mikew
12-22-2013, 04:55 PM
Looks very nice!

I ran into the same issue with too much tiny text on the screen.

I decided to go with two lines; the top line is for the parameter value with a text size of 5 (which gives you four characters to work with) and the bottom line for the parameter name with a text size of 2 (which gives you ten characters to work with). It's very readable even at a glance.

I also used some of the Neopixel rings LEDs for status: malfunction, open loop/rich/lean, idle/torque converter lockup, cooling fan on.

mikew
12-23-2013, 04:50 AM
Built a second ALDLgauge for my '74 Jaguar.

I used an original Jaguar gauge case because I wanted it to match the others in the dash. I'll replace the cars voltage gauge with the ALDL gauge.

Stuffed inside the case are: 128x64 OLED display, 16 segment Adafruit "NEOpixel Ring", two Arduino Pro Mini's and a 12v to 5v DC-DC converter. External to the case are the bluetooth transceiver (I'll put some heat shrink around it before installation) and a rotary encoder. Only three wires to connect it to the car, ground, power and ALDL.

61156116

3400tZ
12-23-2013, 08:39 AM
Awesome, you seems to have a lot of cool cars too! And now some cool gauges to use in them :)

jbxx
01-11-2014, 09:01 PM
Any updates? I am real interested in this project.
J.B.

3400tZ
01-11-2014, 09:36 PM
I've been working on this is my spare time, which I don't have that much these days with ALDLdroid and stuff. I still made decent progress.

Here is a break down and descriptions of the classes used in the project.

1. Alarms: https://bitbucket.org/SebGiroux/diyecmgauge/src/3506c94a399433e142d18c760947452e82737149/Firmware/Alarms.cpp?at=master

At the beginning of this file, you can see an alarm definition for an "AFR Safety". You can see the structure definition of an alarm here: https://bitbucket.org/SebGiroux/diyecmgauge/src/3506c94a399433e142d18c760947452e82737149/Firmware/AlarmData.h?at=master

Each alarm can show a warning on screen, trigger the buzzer and start data logging.

I like the way the alarms are defined and think it make it easy to read. Eventually, everything will be moved to a software to configure those alarms at run time.

2. Data logging: https://bitbucket.org/SebGiroux/diyecmgauge/src/3506c94a399433e142d18c760947452e82737149/Firmware/CSVDataLogging.cpp?at=master

The data logging is working well now. It uses the RTC (real time clock) for proper file timestamp. The ECU signature is fetched over the CAN bus and added to the file.

3. Displayable items: https://bitbucket.org/SebGiroux/diyecmgauge/src/3506c94a399433e142d18c760947452e82737149/Firmware/DisplayableItems.cpp?at=master

This is the name I gave to the stuff that can be displayed on screen. This will make the configuration of what is displayed on the screen pretty easy. You just can give it some label and the definition of a displayable item tells it how it should be rendered. For example, AFR error is not calculated by the MS. So I need to calculate it on the fly with the AFR and AFR target. I use a callback function that can do that kind of thing.

4. ECU: https://bitbucket.org/SebGiroux/diyecmgauge/src/3506c94a399433e142d18c760947452e82737149/Firmware/ECU.cpp?at=master

Main ECU communications class. For now, this is MS CAN but I might rename the class to say that's what it is and then more class could be defined (ex: ALDL8192Baud, etc.)

5. GPS: https://bitbucket.org/SebGiroux/diyecmgauge/src/3506c94a399433e142d18c760947452e82737149/Firmware/GPS.cpp?at=master

Just a simple GPS class to fetch data from the GPS module

6. Pins: https://bitbucket.org/SebGiroux/diyecmgauge/src/3506c94a399433e142d18c760947452e82737149/Firmware/Pins.h?at=master

Pins definition in a central header file to make it easy to change the hardware

7. Settings: https://bitbucket.org/SebGiroux/diyecmgauge/src/3506c94a399433e142d18c760947452e82737149/Firmware/Settings.cpp?at=master

Helper class to read / write settings to EEPROM. Under construction.

3400tZ
01-13-2014, 04:09 AM
Got some work done this week end. I've working on the PC side of things and now I can fetch the datalogs on the SD card of the Arduino over the USB port. I can also delete them and download them (the hardest part). It's a bit slow right now but increasing the baud rate and some other optimizations should improve that. There is no error checking mechanism as well for now... But it's good progress, I wanted to do that for a while.

Again, the code for all this is committed on bitbucket so feel free to have a look (or even use in your own project ? :)). Hopefully someone is interested by this and I'm not wasting my time writing post on here :D

http://i.imgur.com/b7dQdgK.png

jbxx
01-13-2014, 04:51 AM
I don't think you're wasting your time at all. I think when word of this gets round you could actually make some money on this.

EagleMark
01-13-2014, 05:10 AM
1300 views and only 64 posts! :laugh:

Your not wasting your time and there's loads of interest. But the subject requires a lot of knowledge most of us GearHeads don't have, so how do we converse back?

When you start building? I'll take one for myself! :rockon:

3400tZ
01-13-2014, 05:34 AM
We'll see if I end up finding someone interested to build proper hardware for this thing but this is not something I enjoy doing so it looks like I'm stuck the hardware I have. In the bright side, that hardware works perfect, its just not super pretty in the case, but until I open it, I don't see it :P Otherwise the hardware can be DIY with the current list I have pretty easily. It's really not that hard. After that, the firmware can be used as is, you just need to write a class to talk to whatever ECU you're running, really not that hard either!

Any specific technical questions about the project guys, just ask :)

EagleMark
01-13-2014, 05:38 AM
Wish I could think clearly right now and I'd be all over this! But the health situation really slows me down.

I do promise you a sticky in the writeup section when done so others who are intrested will have the information we all need!

So no! Your not wasting time at all! This is way cool stuff! :happy:

3400tZ
01-14-2014, 03:43 AM
Might as well add the option for histogram page, that will display an histogram of whatever value you want. It's a pretty basic one but it scroll very smoothly, looks pretty decent.


Histogram class is here: https://bitbucket.org/SebGiroux/diyecmgauge/src/dcbdc0e54710f2f41d25fced9541e6dca883ce1d/Firmware/Histogram.cpp?at=master

http://i.imgur.com/HAcF8zn.jpg?1

Six_Shooter
01-14-2014, 04:12 AM
I'm not sure I'd actually use a histogram on my dash, but it's cool.

3400tZ
01-14-2014, 04:44 AM
I agree that its mostly useless. I think I might use it when tuning idle, to see how stable AFR is... or maybe RPM ? We'll see. It might turns out being totally useless. Cool factor is at least one thing :P

But in the end it doesn't really matter, everything can be configured so I can replace that histogram by just 3 basic read out values... or a 1/4 mile widget or whatever else :D I'm mostly just coding all the idea I have in mind for pages.

mikew
01-17-2014, 07:39 PM
3400tZ,

You need to check out this new $20 piece of hardware:

http://www.indiegogo.com/projects/navspark-arduino-compatible-with-gps-gnss-receiver

TECHNICAL SPECIFICATION:
GENERAL SPECS
· Support Arduino IDE (custom integration of Wiring libraries, Windows platform)
· GPS on board
· Breadboard compatible
· 38mm x 18mm size


HARDWARE SPECS
· 100MHz 32bit LEON3 Sparc-V8 + IEEE-754 Compliant FPU
· 1024KB Flash Memory + 212KB RAM

· ~80uA/MHz @ 3.3V
· Powered and programmed by mini USB connector
· 1 full duplex asynchronous UART
· 1 asynchronous UART transmit

· 2 SPI with master/slave mode configurable
· 1 I2C
· 1 24bit PWM
· 17 digital I/O pins (shared with above functional pins)

· Atomic clock synchronized P1PPS time reference with +/-10nsec accuracy

3400tZ
01-18-2014, 02:59 AM
Good stuff Mike. This looks a lot like a teensy with a bit more powerful hardware.

Actually guys, I have some real hardware planned for this project now. Found a really really good hardware guys that is currently working on some more serious hardware (I've already seen the schematic / boards stuff, it looks awesome). Everything would fit in the gauge (the case you sent me Mike, I have to order a few more this week). It will have the hardware to do both CAN and RS232 (so ALDL) and will be able to do OBD2 as well with an extra ELM327 chip added. Code will still be Arduino based, so its going to be easy to manage.

On the firmware side, its progressing really good as well, I should have updates in a near future.

CenTexBiker
01-25-2014, 11:35 PM
Love reading these forums. Some of you guys are friggen geniuses. I wish I could wrap my head around this stuff but TBI ( tramatic brain injury) stops me from gathering the information and applying it.

If you get to the point of selling it, please let me know.

3400tZ
01-27-2014, 12:50 AM
Some screenshots of the desktop side of thing as well as features description and what is coming here: https://bitbucket.org/SebGiroux/diyecmgauge/wiki/Home

mikew
01-27-2014, 08:56 PM
3400tZ,

Dang! Your project is looking great!

I got my homemade gauge mounted in the '74 Jaguar this weekend:

6337

3400tZ
01-28-2014, 03:22 AM
Yes man, its quite a bit of work. :) It went a bit out of control and I ended up adding a lot more stuff then I first thought. You should add an sd card slot to your gauge and borrow some of my stuff to stream data logs over the USB port!

Your gauge fit really well in your cluster :)

Six_Shooter
01-31-2014, 08:31 PM
I looked through the thread (twice) and didn't see mention of this:

http://www.fivemanconspiracy.com/catalog/18

Could be handy for these projects. ;)

3400tZ
02-01-2014, 04:49 AM
Yeah I knew about them already but it's good that you mention it for other people. The price is right but my personal opinion is that they look a bit too much "made in china". I could be wrong and I should really order one to see tho. The gauge I got from Mike, I just ordered 3 more and they are pretty much exactly 3 times more expensive then this one, each :/ But they're really nice.

3400tZ
02-01-2014, 09:03 PM
Added a bar graph option:

http://i.imgur.com/qWGCL4e.jpg

Now I'm out of RAM as well as CPU. Time for the real hardware to come in so I can continue coding :)

corrado s2
09-05-2014, 11:51 AM
Great project, I want the same in my car, quickly thereafter.
It is I who send you a private message.

Davis_1377
08-26-2015, 02:02 AM
how well will this work with $42 on the 1227747 ecm?

3400tZ
08-26-2015, 06:25 AM
Currently, it wouldn't work. No ALDL support yet at all unfortunately.

Davis_1377
09-03-2015, 05:38 AM
At the time I was trying to see if I could get the arduino to recieve anything from the 160baud cause I thought I could write the arduino to work with it. I had the screen on the arduino display what information it received from the obd1 port but it showed some odd characters. Looking for another alternative then laptop or cellphone display.