PNKP237 / EHU32

ESP32-based bluetooth audio integration for Opel/Vauxhall vehicles. Control bluetooth audio source with steering wheel buttons, show coolant temperature and battery voltage on the integrated display and more!
The Unlicense
10 stars 1 forks source link
astra audio bluetooth can canbus cid corsa display esp32 gid hacking mscan opel vehicle zafira

EHU32

This Arduino sketch enables ESP32 to communicate over MS-CAN bus in Opel vehicles such as Astra H, Zafira B, Vectra C, Corsa D (and more) in addition to acting as a bluetooth audio receiver.

Features

How it looks

Demo video:

Click here to watch EHU32 demo on YouTube

IMG_20240217_172706

VID_20240224_174250 mp4_snapshot_00 11 305

Video showing measurement data displayed in real time (warning, contains music!) https://www.youtube.com/watch?v=uxLYr1c_TJA

How it works and general usage tips

While this project aims to make the experience as seamless as possible, there are some shortcomings that have to be addressed:

If you came here looking for inspiration I'd recommend checking out the wiki page. I have documented some basics that might come in handy when developing your own addons for these vehicles.

Building it yourself

Required hardware: ESP32 board with antenna connector and an antenna (of the classic flavor, A2DP doesn't work on ESP32-C3), PCM5102A DAC module, any CAN transceiver module (in my case MCP2551). Required connections:

This repo contains a PDF schematic outlining which connections are required to make this work and this post shows how to install the modules within a CD30MP3 radio unit.

Discrete PCB with everything on board is in the making, once software quirks are resolved and I find some free time to finish the layout.

Note that this should be soldered directly in the radio unit as the OBD-II port only provides unswitched 12V. Powering it from a 5V car charger also works. Do not connect headphones to the DAC module, its output is supposed to only be connected to amplifier input - in case of this project either the AUX socket of radio's internal AUX input.

If you're successful in putting it together and satisfied with operation of EHU32 then I would be extremely grateful if you can share a photo or a short video showing the module in action! Any kind of feedback is valuable to me - be it issues, general usage or recommendations for additional functionality, I'll be happy to hear them.

Compilation notes

TWAI driver written by ESP as part of their ESP-IDF framework isn't perfect. To ensure everything works properly you'll need to modify "sdkconfig" which is located in %USERPROFILE%\AppData\Local\Arduino15\packages\esp32\hardware\esp32\version\tools\sdk\esp32\

Under "TWAI configuration" section enable CONFIG_TWAI_ISR_IN_IRAM and modify CONFIG_TWAI_ERRATA_FIX_TX_INTR_LOST so the errata fix is not applied. The whole section should look like this:

#
# TWAI configuration
#
CONFIG_TWAI_ISR_IN_IRAM=y
CONFIG_TWAI_ERRATA_FIX_BUS_OFF_REC=y
CONFIG_TWAI_ERRATA_FIX_TX_INTR_LOST=n
CONFIG_TWAI_ERRATA_FIX_RX_FRAME_INVALID=y
CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT=y
# CONFIG_TWAI_ERRATA_FIX_LISTEN_ONLY_DOM is not set
# end of TWAI configuration

In Arduino IDE set the following: Events on core 0, Arduino on core 1, partition scheme - Minimal SPIFFS.

Credits

Depends on Arduino ESP32-A2DP library by pschatzmann: https://github.com/pschatzmann/ESP32-A2DP

Reverse engineering of the vehicles various messages was done by JJToB: https://github.com/JJToB/Car-CAN-Message-DB

This project comes with absolutely no warranty of any kind, I'm not responsible for your car going up in flames.