Arduino-based CANbus gauge

A forum for discussing the MegaSquirt related (but non-B&G) board development, assembly, installation, and testing.

Moderators: jsmcortina, muythaibxr

bittertech
MS/Extra Newbie
Posts: 19
Joined: Thu Jun 23, 2011 5:27 pm

Re: Arduino-based CANbus gauge

Post by bittertech »

Still working on this off and on (life seems to pop up at the most inconvenient times) adding features, making things prettier/extendable. Thinking about designing a PCB around a teensy for stuff and giggles, now that they have a viable CAN library - make it standard OBDII compatible just for people to hack on.

https://github.com/kckr for some of the basic code. Apologies, just realized I never actually pointed a link to the code. The main gauge code (Squirtview) is.. pretty ugly. I'm starting to wrap my head around object oriented a bit better, so I've made lots of changes - but it all needs a refactor.

In the meantime - I 3D printed up a bezel and put the gauge inside the gauge cluster of my miata and made a simple demo mode.
Image
https://www.youtube.com/watch?v=PyqZvAkLr4k

Running into some problems with the LC1 - or least, something that explains why my XD16 gauge stopped working correctly. Air/Fuel Ratio = ((lambda) + 500)* (stoich) / 10000 - for some reason my benchtop LC1 thinks that's 4.9 instead of 14.7. Easy enough to code around, but won't fix my XD16 (unless I start playing man in the middle). It is sorta fun burning pieces of paper to lower the oxygen content of a jelly jar to verify it's working - plus piece of mind knowing it's not sending bogus values to MS before I enable it on my car. I'll have to try reflashing once I find my cable/remember who I lent it to.
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Arduino-based CANbus gauge

Post by racingmini_mtl »

You can use an unlit butane lighter under the O2 sensor to get a rich reading. That might be more practical than burning paper. And if not then you have a lighter to light up the paper.

And I assume it's a typo but there is one '0' too many in the divider in your equation.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
bittertech
MS/Extra Newbie
Posts: 19
Joined: Thu Jun 23, 2011 5:27 pm

Re: Arduino-based CANbus gauge

Post by bittertech »

copy/pasted from http://www.innovatemotorsports.com/supp ... llog-2.pdf - though yeah, my code is actually LC1_AFR = ((LC1_lambda + 500) * LC1_programmed_AFR ) / 1000
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Arduino-based CANbus gauge

Post by racingmini_mtl »

That's because they use AFRx10, i.e., 147 for 14.7. That's obviously what you need to do if you work in integer-only but that can get confusing if that's not specified.

And the teensy CAN library does work fine with the MS protocol.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
richyvrlimited
Master MS/Extra'er
Posts: 568
Joined: Mon Jun 26, 2006 1:03 pm
Location: Warrington, NorthWest England

Re: Arduino-based CANbus gauge

Post by richyvrlimited »

bittertech wrote:Still working on this off and on (life seems to pop up at the most inconvenient times) adding features, making things prettier/extendable. Thinking about designing a PCB around a teensy for stuff and giggles, now that they have a viable CAN library - make it standard OBDII compatible just for people to hack on.

https://github.com/kckr for some of the basic code. Apologies, just realized I never actually pointed a link to the code. The main gauge code (Squirtview) is.. pretty ugly. I'm starting to wrap my head around object oriented a bit better, so I've made lots of changes - but it all needs a refactor.

In the meantime - I 3D printed up a bezel and put the gauge inside the gauge cluster of my miata and made a simple demo mode.
Image
https://www.youtube.com/watch?v=PyqZvAkLr4k

Running into some problems with the LC1 - or least, something that explains why my XD16 gauge stopped working correctly. Air/Fuel Ratio = ((lambda) + 500)* (stoich) / 10000 - for some reason my benchtop LC1 thinks that's 4.9 instead of 14.7. Easy enough to code around, but won't fix my XD16 (unless I start playing man in the middle). It is sorta fun burning pieces of paper to lower the oxygen content of a jelly jar to verify it's working - plus piece of mind knowing it's not sending bogus values to MS before I enable it on my car. I'll have to try reflashing once I find my cable/remember who I lent it to.
That's brilliant.

Nice gauge cluster too!
2003 MX5. Coldside MP62
-
MS3, RTC, & Knock board, Release 1.2. LC-1 Wideband.
bittertech
MS/Extra Newbie
Posts: 19
Joined: Thu Jun 23, 2011 5:27 pm

Re: Arduino-based CANbus gauge

Post by bittertech »

Thanks - KG Works panel with revlimiter warbird gauges, and a PLX gauge in the bottom right, red gel over the odo, and wiped the needles with acetone and painted red with fingernail paint.

Finally got the LC-1 Serial read stuff (mostly) working. Finding out that three of my old LC-1's have a bad habit of redefining stoich to some garbage value (ie, 4.9), which explains my XD16 gauge problems. Might try to capture the serial stream that LGProgrammer sends to have my arduino auto-correct that condition - doesn't appear to effect the 0-5v reference, just the digital AFR data. Weirdness.

I've got everything loaded in the car and will be heading to the megameet this weekend if anyone wants to check it out in person.
humjaba
Helpful MS/Extra'er
Posts: 35
Joined: Fri Sep 26, 2014 11:17 am

Re: Arduino-based CANbus gauge

Post by humjaba »

Hi OP

First, I'd like to thank you for posting up the code you've written to make this - it's helped me get started on my own gauge (I'm using a Teensy 3.1 in stead of an arduino though).
Second, could you possibly show how you have the whole set up mounted to the gauge cluster as you've shown in the picture?

Thanks!
ElDominio
MS/Extra Newbie
Posts: 1
Joined: Sun Sep 28, 2014 9:20 am

Re: Arduino-based CANbus gauge

Post by ElDominio »

I've been reading through this thread, and I've basically bookmarked it.
I'm going to try to implement CAN comms with an Arduino Mega so I can have full suspension datalogging and DC motor control with the Arduino, while relaying the info both ways between the Megasquirt and the Arduino.

I just wanted to ask you, bittertech, if it would be okay to drop by and ask some questions, whenever I begin implenting this (obviously, I'll try to Google myself out of problems, but just to know if you won't hate me for threadjacking lol) in our Formula SAE car for 2015.

Last year at comp the Electrical Design judge loved our car, so let's see how it goes this year! I wanna show people that this ECU kicks all sorts of ass XD
Last edited by ElDominio on Tue Sep 30, 2014 7:15 am, edited 1 time in total.
jsmcortina
Site Admin
Posts: 39615
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Arduino-based CANbus gauge

Post by jsmcortina »

I saw this gauge at the Megameet a week ago - very impressive work.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
bittertech
MS/Extra Newbie
Posts: 19
Joined: Thu Jun 23, 2011 5:27 pm

Re: Arduino-based CANbus gauge

Post by bittertech »

I wish I had more time to hang out at the megameet - a small emergency popped up and I had to leave. I couldn't even finish my beer. :cry:

Eldomino - sure, shoot me a PM any time with questions - I'm not on the forum too often but I've got email alerts on. I made a MSCan library that I need to push to github that might ease some of the functions with the MCP2515 - it is my first attempt at a library though.

humjaba - well, good news - on the teensy front I've begun to breadboard out the gauge components, about to start tackling the main bit of canbus porting. From there, PCB design begins. :D
Image

The gauge was mounted with a 3d printed bezel and then glued to the panel. The neopixel ring just happened to be exactly the right size. The whole affair is in the car right now so I don't have pictures of holes cut and wires run.
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Arduino-based CANbus gauge

Post by racingmini_mtl »

Just as a teaser here are a few pictures of an initial prototype which uses hardware very similar to your last picture (plus a whole lot more). There is also code to control all of it. I'll have more details with the updated version.

Image
Image
Image
Image

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
jsmcortina
Site Admin
Posts: 39615
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Arduino-based CANbus gauge

Post by jsmcortina »

Looking good also.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
Zaphod
Master MS/Extra'er
Posts: 390
Joined: Thu Aug 14, 2008 11:38 pm
Location: Germany

Re: Arduino-based CANbus gauge

Post by Zaphod »

Do so much want! Make them buy-able over the winter please!
I would love to start with one (ore maybe more of those gauges in the spring!
--------------------------------
fun is not a straight line

Image

Sven
http://www.mx-5club-sachsen.de
http://miata.cardomain.com/id/svenmx5
NB-1998-1,6-Garrett T25 HGP Turbo Stage I
nuvolarossa
Experienced MS/Extra'er
Posts: 301
Joined: Tue Jul 27, 2010 6:15 am

Re: Arduino-based CANbus gauge

Post by nuvolarossa »

mmmm
JB I found the hw specs on another forum, so much stuffed there!
and also seems very customizable!
but sd, sensors and all that stuff wouldn't be overkill since megasquirt already does that?

http://i.imgur.com/qWGCL4e.jpg?1
http://i.imgur.com/HAcF8zn.jpg?1
http://monbazou.com/filedump/seb/diyecm ... G_0672.JPG

either ways these gauges are promising!
With such a small screen I prefer the one with neopixel ring, helps a lot to deliver info, being the oled so small.
_____________________________
Would the adafruit 1.5" color oled fit inside the pod, I mean physically, maybe trimming the corners of the board?
It would have such a lot more space! http://www.adafruit.com/products/1431

Maybe this one could fit better, 1.5" oled with sd, cutting out mounts (it's made for that):
dimensions 34.5mm across after cutting mounting tabs, 39mm from top to bottom and 6.8mm thick
https://www.tindie.com/products/miker/1 ... y-33v-50v/

I'm sure there are other available.
---
the plx dm-100 for example is 52mm and it uses 1.7" oled gauge... look at how many things it can show and big readable text!:
http://i4.photobucket.com/albums/y138/t ... 530-23.jpg
Robert
MS3x 1.4.1 | TS 3.0.28
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Arduino-based CANbus gauge

Post by racingmini_mtl »

Yes, these are images from Seb (93white3400z) who has done most of the firmware and all of the configuration software. There is a lot of flexibility and there's more to come. And I'm not sure of the hardware specs you saw because there is a lot of things but there should be very little, if any, overlap in the sensors between the gauge and the MS. And all the MS data is read over CAN.

There is no way to fit either of the 1.5" OLED boards you link into the case. But I agree that this would provide a lot more and I already had seen that. So what I have done is create a custom board that will fit and use the bare 1.5" colour OLED. So it will be possible to use either the small monochrome OLED or the larger colour OLED (at an additional cost). My board will use a surface mount connector on the bottom. And there is already a microSD card socket on the main board so there is no need for one on the OLED board.

And the 1.5" will cover almost as much of the gauge face as that 1.7" seems to do. So it should be possible to get almost the same effect.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
richyvrlimited
Master MS/Extra'er
Posts: 568
Joined: Mon Jun 26, 2006 1:03 pm
Location: Warrington, NorthWest England

Re: Arduino-based CANbus gauge

Post by richyvrlimited »

That is quite superb Jean.

Is there an eta on availability?
2003 MX5. Coldside MP62
-
MS3, RTC, & Knock board, Release 1.2. LC-1 Wideband.
krisr
Master MS/Extra'er
Posts: 799
Joined: Wed Aug 17, 2005 1:17 am
Location: Sydney, Australia

Re: Arduino-based CANbus gauge

Post by krisr »

Subscribing! Much want!
Sydney, Australia
1971 Holden Monaro HQ
MS3X Sequentially fuelled 400 Pontiac
93white3400z
Master MS/Extra'er
Posts: 685
Joined: Mon Aug 25, 2008 11:37 pm
Location: Montreal, Quebec

Re: Arduino-based CANbus gauge

Post by 93white3400z »

richyvrlimited wrote:That is quite superb Jean.

Is there an eta on availability?
I don't want to hijack this thread any further so that will be my last reply in this thread about that gauge Jean and I are working on. We're going to create on own thread in a near future. Status of the project is that I did prototype hardware with an Arduino Mega end of last year, Jean made prototype PCBs and we upgraded to a Teensy 3.1 and some other goodies early this year. Now, Jean fixed the minimal issues we had with the second prototype and added a couple more things and the PCBs are ordered. Jean will have to receive them, assemble a couple, send me one and I'll start modifying the firmware/softwares to fit the changes we did to the hardware in the second iteration. There is a TON of sensors on that gauge and some extra pins exposed to the connectors that allow for customization. I would say later this year is not impossible for a first batch of gauge to send to people but Jean and I haven't talk about that yet (because we're not quite ready).

The gauge already includes a desktop application and Android application to control it. Code for everything will be available for anyone to customize to their needs. The desktop and Android application are both Java (desktop app should run on any platform) and share a common code base to make everything cleaner and avoid code duplication. The code is pretty well documented and I think decently written so it's not too hard for someone to jump in.

I've probably said way too much already so that's it for now :D
1993 Chevrolet Cavalier Z24
3400 Turbocharged Inter-cooled
MS3 v3.57+MS3X
24c
Master MS/Extra'er
Posts: 847
Joined: Tue Jan 20, 2009 10:21 am
Location: Lancashire UK
Contact:

Re: Arduino-based CANbus gauge

Post by 24c »

93white3400z wrote:I've probably said way too much already so that's it for now
That's a good update, looking forward to more news, in the meantime well done to both of you. Cool project.

Mike
Yamaha GTS1000 v2 MicroSquirt, B&G 2.891
Yamaha GTS1000 v3 beta MicroSquirt, B&G3.760
Yamaha GTS1000 MSExtra 3.1, Dual VR Board
Yamaha YZF1000 MSExtra 3.1
humjaba
Helpful MS/Extra'er
Posts: 35
Joined: Fri Sep 26, 2014 11:17 am

Re: Arduino-based CANbus gauge

Post by humjaba »

Well doesn't that look familiar...
Image

As I don't yet have my megasquirt installed in my Miata, I got this gauge working with my Subaru. There are more interesting things to look at with that car anyway - it's turbocharged and I don't have boost, AFR, or temp gauges. SSM has a fast polling option and access to any variable in the ECU. So I'm going to get a couple of those OLED screens to replace the factory clock and information panel.

Where are you guys located? I'm only about an hour and a half north of suwanee on I85. I would like to see these in person too, if possible.
Post Reply