ESP-IDF project to create a listen only device to log CAN Bus messages.
The ESP32 contains a built-in TWAI Controller peripheral that can be used for CAN communication by adding an external CAN transceiver that provides the required physical level for the Bus. A CJMCU-1051 board is used, it has a TJA1051T CAN transceiver, however this variant used doesn't allow to supply diferent power levels for control logic (no Vio pin available; TJA1051T/3 and TJA1051TK/3 only), so a power level shifter is also required to protect the ESP32 GPIOs.
Here is a basic connection diagram:
Once firmware is flashed in the ESP32 and the CANH and CANL signals are connected to a CAN Bus, open a Serial console at 115200 bauds speed and start logging CAN messages and CAN Bus events (as errors).
Log result example:
- ESP-32 TWAI Documentation
- SUSTerm used as Serial console.