morcibacsi / esp32_rmt_van_rx

ESP32 RMT peripheral Vehicle Area Network (VAN bus) reader
MIT License
32 stars 9 forks source link
arduino automotive can can-bus car citroen esp32 library network peugeot protocol psa receiver rmt sniffer sniffing van-bus

ESP32 RMT peripheral Vehicle Area Network (VAN bus) reader

Arduino VAN bus reader library utilizing ESP32 RMT peripheral.

VAN bus is pretty similar to CAN bus. It was used in many cars (Peugeot, Citroen) made by PSA.

ESP8266 support

This library is built around the RMT (Remote control) peripheral of the ESP32. Therefore ESP8266 is NOT supported by this library as it does not have the peripheral built in. However on these boards you can use this library: PSA VAN bus reader for Arduino-ESP8266

Schematics

schema

Arduino

Copy the following files to your documents\Arduino\libraries\esp32_arduino_rmt_van_rx folder

Check the esp32_arduino_van_monitor folder for an example

Breaking change

In version 2.0.0 the library was rewritten and ESP-IDF support was dropped in favor of simpler code in Arduino framework. The change also makes it possible to monitor the VAN_COMFORT and VAN_BODY bus simultaneously by creating two separate instances of the ESP32_RMT_VAN_RX class. The example was updated to reflect the change, so you can check that as well.

Example code

// Instead of calling the Init function with the following parameters:
VAN_RX.Init(VAN_DATA_RX_RMT_CHANNEL, VAN_DATA_RX_PIN, VAN_DATA_RX_LED_INDICATOR_PIN, VAN_LINE_LEVEL_HIGH, VAN_NETWORK_TYPE_COMFORT);
//Receive() method was renamed to ReceiveData()
VAN_RX.Receive(&vanMessageLength, vanMessage)

// You need to pass the same parameters to the constructor like this:
VAN_RX = new ESP32_RMT_VAN_RX(VAN_DATA_RX_RMT_CHANNEL, VAN_DATA_RX_PIN, VAN_DATA_RX_LED_INDICATOR_PIN, VAN_LINE_LEVEL_HIGH, VAN_NETWORK_TYPE_COMFORT);
// And call the Start() method:
VAN_RX->Start();
// Receive data from the bus
VAN_RX->ReceiveData(&vanMessageLength, vanMessage);

See also