VanBus
Vehicle Area Network (VAN) bus packet reader/writer for ESP8266 and ESP32
Install / Use
/learn @0xCAFEDECAF/VanBusREADME
📝 Table of Contents
🎈 Description<a name = "description"></a>
This module allows you to receive and transmit packets on the ["VAN" bus] of your Peugeot or Citroen vehicle.
VAN bus is pretty similar to CAN bus. It was used in many cars (Peugeot, Citroen) made by PSA.
In the beginning of 2000's the PSA group (Peugeot and Citroen) used VAN bus as a communication protocol between the various comfort-related equipment. Later, around 2005, they started to replace this protocol in their newer cars with the CAN bus protocol, however some models had VAN bus inside them until 2009. This overview lists vehicles that are supposedly fitted with a VAN (comfort) bus.
Both the ESP8266 / ESP8285 and ESP32 platforms are supported by this library.
🔌 Schematics<a name = "schematics"></a>
You can usually find the VAN bus on pins 2 and 3 of ISO block "A" of your head unit (car radio). See http://web.archive.org/web/20230315215552/https://en.wikipedia.org/wiki/Connectors_for_car_audio and https://github.com/morcibacsi/esp32_rmt_van_rx#schematics .
There are various possibilities to hook up a ESP8266/ESP32 based board to your vehicle's VAN bus:
-
Use a [MCP2551] transceiver, connected with its CANH and CANL pins to the vehicle's VAN bus. As the MCP2551 has 5V logic, a 5V ↔ 3.3V [level converter] is needed to connect the CRX / RXD / R pin of the transceiver, via the level converter, to a GPIO pin of your ESP8266/ESP32 board. For transmitting packets, also connect the CTX / TXD / D pins of the transceiver, via the level converter, to a GPIO pin of your ESP8266/ESP32 board.
A board with the MCP2551 transceiver can be ordered e.g. here or here.
Example schema using a [Wemos D1 mini] (ESP8266 based):

Example schema using a [LilyGO TTGO T7 Mini32] (ESP32 based):

👉 Notes:
- <img src="extras/Schematics/MCP2551%20terminator%20resistors.jpg" align="right" width="200px"/>The two terminator resistors R3 and R4 (2 x 100 Ohm, near the CANH and CANL pins) on this transceiver board are meant for operating inside a CAN bus network, but are not necessary on a VAN bus. In fact, they may even cause the other equipment on the bus to malfunction. If you experience problems in the vehicle equipment, you may want to remove (unsolder) these terminator resistors. See also this issue.
- CANH of the transceiver is connected to VAN BAR (DATA B), CANL to VAN (DATA). This may seem illogical but in practice it turns out this works best.
- The clamping circuit (D1, D2, R1) seems to (somehow) help in reducing the amount of bit errors (packet CRC errors).
-
Use a [SN65HVD230] transceiver, connected with its CANH and CANL pins to the vehicle's VAN bus. The SN65HVD230 transceiver already has 3.3V logic, so it is possible to directly connect the CRX / RXD / R pin of the transceiver to a GPIO pin of your ESP8266/ESP32 board. For transmitting packets, also connect the CTX / TXD / D pins of the transceiver to a GPIO pin of your ESP8266/ESP32 board.
A board with the SN65HVD230 transceiver can be ordered e.g. here, here or here.

👉 Notes:
- <img src="extras/Schematics/SN65HVD230%20terminator%20resistor.jpg" align="right" width="200px"/>The terminator resistor R2 (120 Ohm, near the CANH and CANL pins) on this transceiver board is meant for operating inside a CAN bus network, but is not necessary on a VAN bus. In fact, it may even cause the other equipment on the bus to malfunction. If you experience problems in the vehicle equipment, you may want to remove (unsolder) the R2 terminator resistor. See also this issue.
- CANH of the transceiver is connected to VAN BAR (DATA B), CANL to VAN (DATA). This may seem illogical but in practice it turns out this works best.
- The clamping circuit (D1, D2, R1) seems to (somehow) help in reducing the amount of bit errors (packet CRC errors).
- The simplest schematic is not to use a transceiver at all, but connect the VAN DATA line to GrouND using two 4.7 kOhm resistors. Connect the GPIO pin of your ESP8266/ESP32 board to the 1:2 [voltage divider] that is thus formed by the two resistors. This is only for receiving packets, not for transmitting. Results may vary.

👉 Notes:
- This schematic seems to work well only with an ESP8266-based board, like the [Wemos D1 mini]. With an ESP32-based board I get a lot of CRC errors.
- I used this schematic during many long debugging hours, but I cannot guarantee that it won't ultimately cause your car to explode! (or anything less catastrophic)
🚀 Building your Project<a name = "building"></a>
Before proceeding with this project, make sure you check all the following prerequisites.
Install Arduino IDE
See Arduino IDE. I am currently using version 1.8.19 but other versions may also be working fine.
ESP8266-based board
An example of an ESP8266-based board is the [Wemos D1 mini].
1. Install Board Package in Arduino IDE
For an ESP8266-based board you will need to install the ESP8266 Board Package.
I am currently using version 3.1.2 but other versions seem to be also working fine (I tested with versions 2.6.3 ... 3.1.2).
Follow this tutorial to install the ESP8266 Board Package.
2. Install the VAN Bus Library<a id="install_library"></a>
In the Arduino IDE, go to the "Sketch" menu → "Include Library" → "Manage Libraries..." and install the Vehicle Area Network (VAN) bus packet reader/writer library. Hint: type "vanbus" in the search box.
For more explanation on using the Arduino library manager, you can browse to:
- this tutorial from Arduino, and
- this explanation from Adafruit
3. Board settings
In the Arduino IDE, go to the "Tools" menu, and choose:
- CPU frequency: 160 MHz
Here is a picture of board settings that have been tested to work:

ESP32-based board
An example of an ESP32-based board is the [LilyGO TTGO T7 Mini32].
1. Install Board Package in Arduino IDE
For an ESP32-based board you will need the ESP32 board package installed.
I am currently using version 3.3.5 but other versions may also be working fine. (I tested with version 1.0.6, 2.0.17 and 3.3.5 .)
Follow this tutorial to install the ESP32 Board Package. Alternatively, turn to this page for instructions.
2. Install the VAN Bus Library
See section 'Install the VAN Bus Library', above.
3. Board settings
In the Arduino IDE, go to the "Tools" menu, and choose:
- CPU frequency: 240 MHz
Here is a picture of board settings that have been tested to work:

