ESP32 SmartCar

  • Author: Andrei Tulpan
  • Email: andrei.tulpan@stud.acs.pub.ro
  • Master: SRIC

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.

🔗 [Frontend Demo] (https://smartcar.thezion.one)

💻 [GitHub Repository] (https://github.com/andreitulpan/smart-car_esp32)

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

  • Firebase – Real-time database, user authentication, and cloud hosting

📟 Embedded Software (ESP32)

Developed using the Arduino Framework, with the following libraries:

  • jandrassy/TelnetStream@^1.3.0 – Telnet-based debugging and serial stream
  • mobizt/Firebase Arduino Client Library for ESP8266 and ESP32@^4.4.17 – Interface for Firebase Realtime Database
  • mobizt/FirebaseJson@^3.0.9 – Lightweight JSON handler for embedded devices
  • coryjfowler/mcp_can@^1.5.1 – MCP2515 CAN bus interface library for OBD-II data access

Challenges

Integrating all the advanced features into a single ESP32 board pushed the microcontroller to its operational limits. When all major systems are active — including WiFi, Firebase communication, Bluetooth Low Energy (BLE), and real-time logging — the ESP32 begins to exhibit instability, such as random exceptions and core dumps.

These issues are likely caused by limited RAM and processing capacity, making resource optimization and careful task scheduling essential for reliable performance.

Prototype

References

iothings/proiecte/2025sric/smartcar.txt · Last modified: 2025/05/29 10:12 by andrei.tulpan
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0