🚗 ESP32-C3 CAN Bus Controller This project turns your ESP32-C3 into a Wi-Fi–based CAN Bus interface with a built‑in web-based GUI for configuration, message control, and firmware updates.
It uses an MCP2515 CAN controller connected via SPI and allows you to:
Monitor BMW F-series drive mode messages Control a relay automatically based on CAN data Send, schedule, and manage custom CAN messages Update firmware via the web interface — over Wi-Fi! 🧠 Features Web GUI for sending/receiving CAN messages Persisting configuration (drive modes) in ESP32 preferences Create up to 10 custom CAN messages with scheduling Wi-Fi access point (no router required) OTA firmware upload and restart from GUI Real-time system info (firmware, uptime, free heap, etc.) ⚙️ Hardware Setup 🔌 Pin Connections (ESP32-C3 → MCP2515) ESP32-C3 Pin MCP2515 Pin Function 7 CS (Chip Select) SPI CS 10 SI (MOSI) SPI MOSI 9 SO (MISO) SPI MISO 6 SCK SPI Clock 8 Relay Output / Optional Load Controls external relay Make sure your MCP2515 module uses an 8 MHz crystal (code sets bitrate: CAN_500KBPS, MCP_8MHZ).
🛜 Wi-Fi Access Point Details Setting Value SSID ESP32-CAN-Config Password canbus123 IP Address Typically 192.168.4.1 (printed in serial monitor) 🌐 Accessing the Web GUI Power up the ESP32-C3 (via USB or 5V source). Wait for serial output: AP IP: 192.168.4.1 Web server started On your phone or PC: Open Wi-Fi settings Connect to ESP32-CAN-Config Password: canbus123 Open a browser and go to: 👉 http://192.168.4.1 You’ll see the ESP32 CAN Bus Controller main dashboard.
📋 GUI Overview 🏠 Main Page Shows connection status, firmware version, and uptime Form to configure drive mode values (Eco Pro, Comfort, Sport, Sport+) Section to add custom CAN messages Table of current messages with options to: ✅ Enable/Disable 🚀 Send Once 🗑️ Delete Button to go to Firmware Update page 🔧 Firmware Update Accessible at: http://192.168.4.1/update
Displays current firmware version and system info Upload new .bin files generated from Arduino IDE → Sketch → Export Compiled Binary Monitors upload progress Restarts automatically when update completes “Restart Device” button for manual reboot 🧰 Default Drive Mode CAN Behavior CAN ID Function Behavior 0x3FD Drive Mode Reads data[0] to detect mode Value 0x01 ECO PRO Relay OFF Value 0x02 COMFORT Relay OFF Value 0x03 SPORT Relay ON Value 0x04 SPORT PLUS Relay ON Relay control is handled automatically in handleIncomingCAN().
🔄 Firmware Update via Web Go to Firmware Update page (/update) Choose your new .bin file Click Upload Firmware Wait for upload and auto-restart (≈10s) Reconnect to the Wi-Fi AP if needed and revisit 192.168.4.1 🧱 Persistent Settings Drive mode hex values and boot info are stored in Preferences under the namespace can-config, e.g.:
eco_pro 0x01 comfort 0x02 sport 0x03 sport_plus 0x04 Every reboot increments the boot counter and updates are logged.
🪛 Serial Monitor Output Example CAN initialized AP IP: 192.168.4.1 Web server started Firmware Version: 1.0.0 Boot Count: 5 Last Update: 1d 3h 27m ago (from boot) Drive Mode - ID: 0x3FD Data: 03 SPORT MODE - Relay ON 🧾 Notes Default CAN speed is 500 kbps Adjust MCP2515 clock if you use a 16 MHz board You can add up to 10 custom CAN messages Be sure to use hexadecimal values (e.g. 01 02 03 04) when adding message data To return to factory Wi-Fi, erase flash or modify ssid/password in the sketch 🧑💻 Credits Built for experimentation with BMW CAN Bus decoding and ESP32 integration. Developed for ESP32-C3 + MCP2515 platform, Arduino framework.
📦 Version Info Item Version Firmware 0.0.3 Board ESP32-C3 Libraries mcp2515, WiFi, WebServer, Preferences, Update, SPI