Streaming data from CAN bus with Teensy

In my project to build an E85 conversion kit based on an Arduino, I find it valuable to set up a testing environment. An Arduino expanded with a CAN bus shield would serve as a CAN bus simulator — transmitting data — and I’ll use my Teensy 3.6 as a prototype for the E85 conversion kit, conviently embedding 2 CAN bus controllers. Here’s the initial code for the Arduino CAN bus simulator, which sends a dummy message every 100ms:

On the other side, I connect both wires for the CAN bus to the CAN-0 controller pins of the Teensy 3.6 (pins 3 and 4). If a 120 ohm resistor is already present on the Arduino CAN shield , this not the case on the Teensy, so I add a 120 ohm resistor linking both pins on the Teensy. You can check you have the right impedance on the CAN bus with a multimeter positioned e.g. on both screws of the CAN shield port when no voltage is applied: it should read 60 ohms.


Here’s the initial code that reads data from the CAN bus to write to the Teensy:

Go ahead and run both program, you should see the messages displaying on the serial monitor attached to the Teensy. According to this post  a transceiver is required in a “real” CAN bus configuration, like in your vehicule. I leave this development for later.