This is an old revision of the document!
ESP32 SmartCar
Introduction
SmartCar is an innovative hardware-software solution designed to bring modern vehicle intelligence to any car, especially the old ones. By plugging a compact, futuristic OBD-II device into the car’s diagnostic port, SmartCar captures real-time data from the vehicle’s CAN network and integrates WIFI connectivity to transmit insights to a secure cloud-based backend. The companion mobile app gives users instant access to detailed insights about their car’s health, fuel consumption, driving habits, trip history, and more-all in an intuitive interface.
Context
A smart car telemetry and diagnostics system for ESP32, featuring CAN bus data acquisition, BLE and WiFi connectivity, OTA updates, and Firebase integration.
Features
CAN Bus Support: Reads vehicle data via MCP2515 CAN controller.
BLE Communication: Allows configuration and commands via Bluetooth Low Energy.
WiFi Connectivity: Connects to WiFi for cloud integration.
Firebase Integration: Sends sensor and log data to Firebase Realtime Database.
OTA Updates: Supports over-the-air firmware updates.
EEPROM Storage: Stores WiFi credentials and settings persistently.
Logging: Flexible logging system with optional Firebase upload.
Usage
On first boot, use BLE to send WiFi credentials (`WIFI,<SSID>,<PASSWORD>`).
The device will connect to WiFi, sync time via NTP, and start sending CAN data to Firebase.
For further configuration hold the button for 3 seconds to enable BLE.
Commands (via BLE)
`WIFI,<SSID>,<PASSWORD>`: Set WiFi credentials.
`CLEAR_EEPROM`: Clear stored credentials.
`DISABLE_BLE`: Disable BLE interface.
Customization (via UI)
CAN PIDs: Configure supported PIDs.
REQUEST INTERVAL: Configure the request interval for CAN network.
THRESHOLD: COnfigure the response threshold for the CAN network.
Logging: Enable or disable log upload via a button.
Hardware
Components
ESP32 development board
MCP2515 CAN bus module
Button
LED
OBD II Port
Power Switch
Hi-Link (9-36V to 5V)
Function | ESP32 Pin | Description |
Button | GPIO 3 | BLE button |
LED | GPIO 2 | Status indicator |
CAN CS (MCP2515) | GPIO 5 | SPI Chip Select for CAN |
SPI MOSI | GPIO 23 | SPI Master Out Slave In |
SPI MISO | GPIO 19 | SPI Master In Slave Out |
SPI SCK | GPIO 18 | SPI Clock |
SPI INT (MCP2515) | GPIO 4 | MCP2515 Interrupt |
Software
The SmartCar project integrates modern web technologies with embedded systems to turn any car into a smart one.
🖥️ Frontend
Vite – Lightning-fast frontend tooling
TypeScript – Strong typing for scalable codebases
React – Component-based UI framework
shadcn/ui – Accessible and elegant UI components
Tailwind CSS – Utility-first
CSS framework for fast styling
☁️ Backend
📟 Embedded Software (ESP32)
Developed using the Arduino Framework, with the following libraries:
Challenges
References