Teensy-based CANbus gauge (and more)

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

Moderators: jsmcortina, muythaibxr

Monoaural
MS/Extra Newbie
Posts: 3
Joined: Mon Feb 01, 2016 7:01 pm

Re: Teensy-based CANbus gauge (and more)

Post by Monoaural »

Really considering building one of these. What is the rotary encoder used for? I am hoping to build a slightly stripped down one, with no accelerometer, and no gps.
Long term goal would be to add gps, and feed fuel level into it as well to replace the entire dashboard. Looks like larger 128x64 displays are available, which will work well to replace my broken tach.
litneon
Helpful MS/Extra'er
Posts: 67
Joined: Mon Apr 29, 2013 5:19 pm

Re: Teensy-based CANbus gauge (and more)

Post by litneon »

I want one. Take my money!
ChristianK
MS/Extra Newbie
Posts: 31
Joined: Sun Aug 24, 2014 4:40 pm

Re: Teensy-based CANbus gauge (and more)

Post by ChristianK »

The main problem are the displays. The are no displays all around over the world in 1.3" :cry:
Golf MK1 Cabrio 1,8T MS2
412Hp at 20psi
xrattiracer
Experienced MS/Extra'er
Posts: 301
Joined: Fri Aug 01, 2008 2:25 pm

Re: Teensy-based CANbus gauge (and more)

Post by xrattiracer »

Monoaural, the encoder is for changing functions on the display. watch the video i linked in one of the early posts to see it in action. you can just omit the gps and accelerometer and it will work just fine, however for simple gauges you might want to look into my other project http://www.msextra.com/forums/viewtopic ... 67&t=57948
humjaba
Helpful MS/Extra'er
Posts: 35
Joined: Fri Sep 26, 2014 11:17 am

Re: Teensy-based CANbus gauge (and more)

Post by humjaba »

Hey guys

I'm getting down to business creating my own CAN gauge to replace the dummy oil light in my car, because it sounds like a fun project and I'd like to learn. This would be my first time designing a PCB but I wanted to know, where do you guys go for your board creation? I've seen a couple circular prototype boards floating around here - is that possible from the folks at oshpark or seeedstudio?

Also, how do you go about assembling surface mount components? Smear solder paste over the screen and pick-n-place with tweezers?

Just trying to figure out the best/easiest way to get stuff done once I have it working on a breadboard. Thanks!
dontz125
Super MS/Extra'er
Posts: 4221
Joined: Mon May 11, 2009 7:14 pm
Location: York, ON
Contact:

Re: Teensy-based CANbus gauge (and more)

Post by dontz125 »

humjaba wrote:Hey guys

I'm getting down to business creating my own CAN gauge to replace the dummy oil light in my car, because it sounds like a fun project and I'd like to learn. This would be my first time designing a PCB but I wanted to know, where do you guys go for your board creation? I've seen a couple circular prototype boards floating around here - is that possible from the folks at oshpark or seeedstudio?

Also, how do you go about assembling surface mount components? Smear solder paste over the screen and pick-n-place with tweezers?

Just trying to figure out the best/easiest way to get stuff done once I have it working on a breadboard. Thanks!
I haven't used seeedstudio, but Itead is very similar, and quite good. I've recently started using Elecrow for both bare boards and short runs of assembled boards. They have no minimum, and their engineering / sourcing / set-up fees are in the $60-80 range. I have a batch of boards from them in hand - quite nice, and I expect my first batch of assembled boards from them today.

SMT is a little trickier than TH, but it can be done. You want a fine-tip soldering iron, fine-pitch solder (or solder paste), and a steady hand. A desk magnifier helps; those big honkin' stereo microscopes are neat, but not needed at the scale we're talking. The bigger components - 1206 or 0805 resistors and caps, SOIC-8 chips, etc are easy. SOT-23 transistors & diodes need a little care. 0.5mm processor chips CAN be done by hand, but it takes practice.

Solder paste should not be 'smeared' on; there's too good a chance of causing a hidden short. Apply it carefully, with a stencil or with a syringe. OSH Stencils sells Kapton pieces for a very reasonable cost. And yes, placing is done with tweezers and dental picks (to carefully poke into place). Alignment isn't too important, as the surface tension of the molten solder (when reflowing) will pull the parts into position. Just be careful when removing the hot parts from the skillet / iron / whatever; realising the SOIC-14 chip has shifted south by at least 2 pins because you bumped it is quite annoying ... :lol:

Removing shorts - or removing parts - involves lots of flux, and lots of fresh desoldering braid. Don't try and cheap-out on the braid by using a particular section too long; you'll just burn the board and lift pads. Ask me how I know ... :roll: :cry:

There are a number of good YouTube how-tos out there; do a quick search, then pick a few that look good!
Temporarily shut down - back soon!
QuadraMAP Sensor Module -- PWM-to-Stepper Controller -- Dual Coil Driver
Coming soon: OctoMAP Sensor Module
TTR Ignition Systems
humjaba
Helpful MS/Extra'er
Posts: 35
Joined: Fri Sep 26, 2014 11:17 am

Re: Teensy-based CANbus gauge (and more)

Post by humjaba »

dontz125 wrote:
humjaba wrote:Hey guys

I'm getting down to business creating my own CAN gauge to replace the dummy oil light in my car, because it sounds like a fun project and I'd like to learn. This would be my first time designing a PCB but I wanted to know, where do you guys go for your board creation? I've seen a couple circular prototype boards floating around here - is that possible from the folks at oshpark or seeedstudio?

Also, how do you go about assembling surface mount components? Smear solder paste over the screen and pick-n-place with tweezers?

Just trying to figure out the best/easiest way to get stuff done once I have it working on a breadboard. Thanks!
I haven't used seeedstudio, but Itead is very similar, and quite good. I've recently started using Elecrow for both bare boards and short runs of assembled boards. They have no minimum, and their engineering / sourcing / set-up fees are in the $60-80 range. I have a batch of boards from them in hand - quite nice, and I expect my first batch of assembled boards from them today.

SMT is a little trickier than TH, but it can be done. You want a fine-tip soldering iron, fine-pitch solder (or solder paste), and a steady hand. A desk magnifier helps; those big honkin' stereo microscopes are neat, but not needed at the scale we're talking. The bigger components - 1206 or 0805 resistors and caps, SOIC-8 chips, etc are easy. SOT-23 transistors & diodes need a little care. 0.5mm processor chips CAN be done by hand, but it takes practice.

Solder paste should not be 'smeared' on; there's too good a chance of causing a hidden short. Apply it carefully, with a stencil or with a syringe. OSH Stencils sells Kapton pieces for a very reasonable cost. And yes, placing is done with tweezers and dental picks (to carefully poke into place). Alignment isn't too important, as the surface tension of the molten solder (when reflowing) will pull the parts into position. Just be careful when removing the hot parts from the skillet / iron / whatever; realising the SOIC-14 chip has shifted south by at least 2 pins because you bumped it is quite annoying ... :lol:

Removing shorts - or removing parts - involves lots of flux, and lots of fresh desoldering braid. Don't try and cheap-out on the braid by using a particular section too long; you'll just burn the board and lift pads. Ask me how I know ... :roll: :cry:

There are a number of good YouTube how-tos out there; do a quick search, then pick a few that look good!
Thanks for the tips - smear was a little exessive, but I was referring to the tutorial I found somewhere (I think sparkfun?) where they used a stencil and a squeegee to get the paste in the right spot. That seems, to me, to be the easiest way so long as you have a stencil. I've done a couple of soic-8 chips by hand and that was not fun, but I think I need a finer tip for my iron.

However, $60-$80 for some assembled boards wouldn't be bad if some other folks were interested in what I'm working on. I'd much rather do it by hand once...
xrattiracer
Experienced MS/Extra'er
Posts: 301
Joined: Fri Aug 01, 2008 2:25 pm

Re: Teensy-based CANbus gauge (and more)

Post by xrattiracer »

i get my boards done at oshpark (hence the purple).
with such a low parts count i just use a syringe to deposit the solder paste and a hot air rework tool to flow it.
i highly recommend a stereo microscope for placing the parts and doing rework.
humjaba
Helpful MS/Extra'er
Posts: 35
Joined: Fri Sep 26, 2014 11:17 am

Re: Teensy-based CANbus gauge (and more)

Post by humjaba »

Thanks guys for the feedback. I'm just getting started.

I suppose I'll start my own thread so as to not derail this one with questions as I go.

Cheers!
mickeymarrows
Master MS/Extra'er
Posts: 415
Joined: Fri Sep 23, 2005 6:35 am
Location: Ropley, Hampshire, UK

Re: Teensy-based CANbus gauge (and more)

Post by mickeymarrows »

Just an update to this thread and for anyone who has struggled with errors and compiling issues. I haven't played with this gauge for over a year and have just revisited it and when I tried to recompile the code with an updated Arduino IDE I got all the same issues as others have.

I've installed the latest version of the Arduino IDE #****.12

I've then installed a beta version of Teensyduino (that is compatible with *.12)

I still get errors.

I renamed the metro.h in the main Arduino library in order to force the IDE to use the teensy version of metro.h
(basically study the error log and anytime the IDE uses the stock Arduino library file rather than the teensy version then edit the name of the Arduino version so that it only ever uses the teensy library)

I edited the code from #include <time.h> to #include <timeLib.h> (eliminated the setTime etc.. errors)

I edited the Adafruit_SSD1306.h file to include the 64 pixel display

And it compiled and works!!!

Hope this helps others as this is a great little gauge!
'82 Golf GTI ABF 16v MS2 Extra sequential COP
'77 Scirocco G60 MS2 Extra sequential
mickeymarrows
Master MS/Extra'er
Posts: 415
Joined: Fri Sep 23, 2005 6:35 am
Location: Ropley, Hampshire, UK

Re: Teensy-based CANbus gauge (and more)

Post by mickeymarrows »

OK, I spoke too soon, the gauge works, it connects, but all the values are zero. I've read the manual repeatedly and cannot see what my CAN settings should be in Tunerstudio.. i.e broadcast interval..

:(
'82 Golf GTI ABF 16v MS2 Extra sequential COP
'77 Scirocco G60 MS2 Extra sequential
mickeymarrows
Master MS/Extra'er
Posts: 415
Joined: Fri Sep 23, 2005 6:35 am
Location: Ropley, Hampshire, UK

Re: Teensy-based CANbus gauge (and more)

Post by mickeymarrows »

OK, one more step last night, the code as downloaded from Github contains the line:

Encoder myEnc(7, 6); // interrupts on pin6, 7

In reality the encoder is wired to 17 and 16, so I edited that and now my encoder works. :)

Still got lots of zeros though.

I've read the help sections within TS and I've read both the old megamanual and the up to date Megasquirt Extra manuals and non of the sections on CAN are really much help with regard to what the settings should be.. :(
'82 Golf GTI ABF 16v MS2 Extra sequential COP
'77 Scirocco G60 MS2 Extra sequential
Alfagta
Experienced MS/Extra'er
Posts: 239
Joined: Wed Aug 21, 2013 2:54 am

Re: Teensy-based CANbus gauge (and more)

Post by Alfagta »

Post your actual used code.
Otherwise we can't help really much.
Alfa 156 GTA
Alfa 75 Race Car MS III -- alway latest FW
Alfa 164 V6 Turbo
Alfa 155 2,5TD RIP
Test MS II --always latest FW
Tunerstudio V2.6.11 Registered
MegaLog Viewer V3.4.04 Registered
mickeymarrows
Master MS/Extra'er
Posts: 415
Joined: Fri Sep 23, 2005 6:35 am
Location: Ropley, Hampshire, UK

Re: Teensy-based CANbus gauge (and more)

Post by mickeymarrows »

Alfagta wrote:Post your actual used code.
Otherwise we can't help really much.
I understand your point, however, I've spent about 2 hours testing different CAN settings on Tunderstudio so which MSQ should I post? the one from 21:02hrs or the one from 21:06hrs because they're totally different, if you see my point :). I've tried pretty much all variables within the CAN parameters menu in TS and the same with the various CAN broadcasting options under that menu.

If you're referring to the actual code I've used on the Teensy that is as per https://github.com/merkur2k/MSCan_Gauge/tree/teensy from the first post in this topic, last week I started again with a fresh copy downloaded from github and made the couple of small edits as above.. I cannot attach it on this forum as the forum software only allows msq's and datalogs to be attached.. not .ino files.
'82 Golf GTI ABF 16v MS2 Extra sequential COP
'77 Scirocco G60 MS2 Extra sequential
tpsretard2
Master MS/Extra'er
Posts: 662
Joined: Thu Feb 14, 2008 4:59 am

Re: Teensy-based CANbus gauge (and more)

Post by tpsretard2 »

you could ether put in in a dropbox/google drive or fork the repository.
Alfagta
Experienced MS/Extra'er
Posts: 239
Joined: Wed Aug 21, 2013 2:54 am

Re: Teensy-based CANbus gauge (and more)

Post by Alfagta »

If you use the hosted code from github put a serial.println() to this

Code: Select all

  if ( CANbus.read(rxmsg) ) { 
    commTimer.reset(); 
    connectionState = true; 
    ledBlink(); 
    Serial.println(rxmsg.id);

So you will se if the teensy receive something from the canbus and which id it was.

BR
Alfa 156 GTA
Alfa 75 Race Car MS III -- alway latest FW
Alfa 164 V6 Turbo
Alfa 155 2,5TD RIP
Test MS II --always latest FW
Tunerstudio V2.6.11 Registered
MegaLog Viewer V3.4.04 Registered
mickeymarrows
Master MS/Extra'er
Posts: 415
Joined: Fri Sep 23, 2005 6:35 am
Location: Ropley, Hampshire, UK

Re: Teensy-based CANbus gauge (and more)

Post by mickeymarrows »

Alfagta wrote:If you use the hosted code from github put a serial.println() to this

Code: Select all

  if ( CANbus.read(rxmsg) ) { 
    commTimer.reset(); 
    connectionState = true; 
    ledBlink(); 
    Serial.println(rxmsg.id);

So you will se if the teensy receive something from the canbus and which id it was.

BR
Thanks, I'll try that later.. :)
'82 Golf GTI ABF 16v MS2 Extra sequential COP
'77 Scirocco G60 MS2 Extra sequential
mickeymarrows
Master MS/Extra'er
Posts: 415
Joined: Fri Sep 23, 2005 6:35 am
Location: Ropley, Hampshire, UK

Re: Teensy-based CANbus gauge (and more)

Post by mickeymarrows »

Could it be that the code Im using (from bittertechs original gauge) http://www.msextra.com/forums/viewtopic ... 67&t=52539 is using the original Megasquirt CAN protocol, but because I'm using the most up to date MS Extra code and TS thats the newer version of CAN protocol?
'82 Golf GTI ABF 16v MS2 Extra sequential COP
'77 Scirocco G60 MS2 Extra sequential
xrattiracer
Experienced MS/Extra'er
Posts: 301
Joined: Fri Aug 01, 2008 2:25 pm

Re: Teensy-based CANbus gauge (and more)

Post by xrattiracer »

it requires the newer CAN broadcasting that is only in MS3 last I knew, and that this be configured to send the correct pages. you can see which pages are used starting at line 1054.
mickeymarrows
Master MS/Extra'er
Posts: 415
Joined: Fri Sep 23, 2005 6:35 am
Location: Ropley, Hampshire, UK

Re: Teensy-based CANbus gauge (and more)

Post by mickeymarrows »

xrattiracer wrote:it requires the newer CAN broadcasting that is only in MS3 last I knew, and that this be configured to send the correct pages. you can see which pages are used starting at line 1054.
Ah, so that means I cannot use this gauge with my ms2?
'82 Golf GTI ABF 16v MS2 Extra sequential COP
'77 Scirocco G60 MS2 Extra sequential
Post Reply