Teensy CAN Gauge

Hardware inside and outside of the ECU
Post Reply
Keith
Posts: 26
Joined: Thu May 27, 2021 1:13 am
Github Username: Keith-N
Slack: Keith

Teensy CAN Gauge

Post by Keith »

I recently built a gauge with an 128x64 display that is capable of displaying AFR. My goal here was to put something together that was easy to assemble, and had basic functionality. I was looking to display AFR on it, so that is the way it is currently setup. I do plan on trying to make it a bit easier do use other data eventually. If you are looking for something else, it may be helpful to look here https://github.com/rusefi/rusefi/blob/2ce77778653348a91cc579e3cb6b5df243e2e969/firmware/controllers/can/can_verbose.cpp The value is shown as text printed on the screen. It has no inputs so any changes will need to be done in the code.

The gauge posted here https://rusefi.com/forum/viewtopic.php?f=4&t=2043 was helpful in getting started, and is significantly more featured.

The three major parts that I used are :
A Teensy 3.2 https://www.pjrc.com/store/teensy32.html
A SPI SSD1306 https://www.amazon.com/HiLetgo-Serial-Display-SSD1306-Arduino/dp/B01N1LZQA8/ref=sr_1_1?dchild=1&keywords=spi+oled&qid=1627260741&sr=8-1
A CAN transceiver board https://www.amazon.com/SN65HVD230-CAN-Board-Communication-Development/dp/B00KM6XMXO/ref=sr_1_1?crid=QWSW8O3ZS5I4&dchild=1&keywords=can+transceiver&qid=1627260854&sprefix=CAN+Transciever%2Caps%2C202&sr=8-1

The code can be found here https://github.com/Keith-N/Simple-CAN-Gauge

I soldered the parts to a prototyping board so I didn't need to keep running around with it on a breadboard.
GaugeDisplay.jpg
GaugeDisplay.jpg (3.64 MiB) Viewed 2876 times
Gauge.jpg
Gauge.jpg (3.15 MiB) Viewed 2876 times
Splash.jpg
Splash.jpg (2.2 MiB) Viewed 2876 times
Config.jpg
Config.jpg (2.12 MiB) Viewed 2876 times
It has 3 operating modes, a CAN receiver mode which will display any received CAN messages, an AFR gauge mode, and a demo mode which just shows an incrementing fake AFR value. It has an option for a splash screen and to display the CAN configuration on startup (enabled in the code).
To receive data, make sure that the CAN broadcast is enabled in Tuner Studio, and that the CAN bitrate and data base address match. By default in the code I had 500kbps and a base address of 1520.

Here is the wiring I used :
teensyPin.png
teensyPin.png (8.68 KiB) Viewed 2876 times
I have not tested this using I2C for the display, but that should be easy to add. I have not also tested with a Teensy 4.0 yet, but I did run into errors while compiling for one. I think it may require an update to use the FlexCAN_T4 library instead.
dexter_lab
Posts: 39
Joined: Sun Feb 02, 2020 8:01 pm

Re: Teensy CAN Gauge

Post by dexter_lab »

Nice work, go for it!
Keith
Posts: 26
Joined: Thu May 27, 2021 1:13 am
Github Username: Keith-N
Slack: Keith

Re: Teensy CAN Gauge

Post by Keith »

I made some updates and added a button input to cycle through the sensor values.

Also I did some restructuring of the code and set up another repo for it. Should be functionally very similar, but hopefully a bit easier to modify. https://github.com/Keith-N/Teensy-CAN-Gauge
Post Reply