ESP32 firmware that emulates a VW CD Changer (CDC) to integrate a BT1036C Bluetooth module with VW RNS-MFD head units. This version uses a real-time operating system (FreeRTOS) for maximum stability and responsiveness.
- A2DP Audio Streaming - Play music from phone via Bluetooth
- AVRCP Controls - Track skip, play/pause from radio buttons
- HFP Hands-Free - Answer/hangup calls, mic mute
- RTOS-based Architecture - High stability and responsiveness by running CDC, Bluetooth, and Web UI in parallel tasks.
- Safe OTA Updates - Peripherals are paused during firmware updates to prevent crashes.
- Status Display - BT connection status via track number
- Web UI - WiFi configuration, live logs, manual AT command console, and OTA updates.
| Component | Description |
|---|---|
| ESP-WROVER-KIT | ESP32 development board |
| BT1036C | Bluetooth audio module (A2DP/AVRCP/HFP) |
| VW RNS-MFD | Head unit with CDC port |
| Signal | ESP32 Pin | Description |
|---|---|---|
| BT_RX | GPIO16 | ESP RX ← BT1036 TX |
| BT_TX | GPIO17 | ESP TX → BT1036 RX |
| CDC_SCK | GPIO18 | SPI Clock → Radio |
| CDC_MOSI | GPIO23 | SPI Data → Radio |
| CDC_NEC | GPIO4 | Button commands ← Radio |
Radio CD buttons are remapped to Bluetooth functions:
| Button | Function |
|---|---|
| CD1 | Play/Pause toggle |
| CD2 | Stop |
| CD3 | Mic Mute toggle |
| CD4 | Enter Pairing Mode |
| CD5 | Disconnect device |
| CD5 (Double) | Clear Paired List |
| CD6 | Toggle WiFi & Reboot |
| SCAN | Hangup call |
| MIX | Answer call |
| ◀◀ / ▶▶ | Previous/Next track |
The track number on radio display indicates BT status:
| Track | Status |
|---|---|
| 1+ | Normal playback mode |
| 88 | Waiting for BT connection |
| 33 | Mic Mute active |
| 44 | Pairing mode |
| 55 | Manual Disconnect |
| 54 | Paired list cleared |
| 60 | WiFi is OFF |
| 61 | WiFi is ON |
Connect to WiFi AP or use mDNS:
| Mode | Address |
|---|---|
| AP Mode | 192.168.4.1 (SSID: VW-BT1036, Pass: 12345678) |
| mDNS | http://vw-bt.local |
/- Main control panel/bt- Bluetooth debug logs & Manual AT Command Console/cdc- CDC protocol debug/logs- All logs combined/wifi- WiFi configuration/update- OTA firmware update
The firmware is built on the FreeRTOS real-time operating system to ensure that time-critical operations are never blocked. The logic is split into three main tasks:
cdc_task(High Priority): Manages all SPI communication with the head unit. Its high priority guarantees that the radio always receives responses in time, preventing "No CD Changer" errors.bt_task(Medium Priority): Handles the AT command queue and communication with the BT1036 module.webui_task(Low Priority): Serves the web interface and handles WebSocket communication. Its low priority ensures that user interface activity can never interfere with the core functionality.
Button presses from the head unit are safely passed from the ISR (Interrupt Service Routine) to the main logic loop via a thread-safe queue.
# Build
pio run
# Upload via USB
pio run --target upload
# Serial monitor
pio device monitorsrc/
├── main.cpp # Entry point, RTOS tasks, button mapping, state machine
├── bt1036_at.cpp/h # BT1036C driver (AT command queue)
├── vw_cdc.cpp/h # CDC emulator + button decoder
└── bt_webui.cpp/h # Web UI, WebSocket, OTA
- BT1036C AT command set links: docs/bt1036c_links.md
MIT License