Codriver is an advanced IoT-based vehicle monitoring system that connects to a car's OBD-II interface via WiFi, displays real-time vehicle data on a TFT display, and streams telemetry data via Bluetooth Low Energy (BLE). The system monitors engine parameters, environmental conditions, and vehicle dynamics using integrated sensors.
- ESP32-S3 DevKit C-1 (with 4MB Flash, PSRAM support)
- TFT Display (240x240 SPI Display)
- MOSI: GPIO 11
- SCLK: GPIO 12
- CS: GPIO 10
- DC: GPIO 6
- RST: GPIO 7
- MPU6050 (6-axis IMU - Accelerometer & Gyroscope)
- SDA: GPIO 5
- SCL: GPIO 4
- I2C Address: 0x68
- DHT11 (Temperature & Humidity Sensor)
- Data Pin: GPIO 2
- WiFi OBD-II Adapter (ELM327 compatible)
| Component | Pin | ESP32 GPIO |
|---|---|---|
| TFT MOSI | MOSI | 11 |
| TFT SCLK | SCLK | 12 |
| TFT CS | CS | 10 |
| TFT DC | DC | 6 |
| TFT RST | RST | 7 |
| MPU6050 SDA | SDA | 5 |
| MPU6050 SCL | SCL | 4 |
| DHT11 Data | DATA | 2 |
- PlatformIO (VS Code Extension or CLI)
- Arduino Framework for ESP32
- Git (for version control)
The following libraries are automatically installed via PlatformIO:
moononournation/GFX Library for Arduino @ 1.4.7- Display graphicsbblanchon/ArduinoJson @ ^6.20.0- JSON parsingadafruit/DHT sensor library @ ^1.4.6- DHT11 sensor supportArduino_GFX_Library- TFT display driverBLEDevice- Bluetooth Low Energy communicationWiFi- WiFi connectivity (ESP32 core)LittleFS- File system supportWire- I2C communication
Codriver/
├── .gitignore
├── .vscode/
│ └── settings.json
├── lib/
│ ├── Bluetooth/
│ │ ├── bleconnection.hpp
│ │ └── bleconnection.cpp
│ ├── Datas/
│ │ └── livedata.h
│ ├── Obd/
│ │ ├── requests.hpp
│ │ └── requests.cpp
│ ├── Pitch_Roll/
│ │ └── complementary_filter.hpp
│ ├── Screen/
│ │ ├── screen.hpp
│ │ └── screen.cpp
│ └── Sensors/
│ ├── sensor.h
│ └── sensors.cpp
├── src/
│ ├── main.cpp
│ ├── global.hpp
│ ├── global.cpp
│ └── codes.txt
├── data/
├── test/
├── .gitignore
├── platformio.ini
├── partitions.csv
├── sdkconfig.esp32-s3-devkitc-1
└── README.md
main.cpp
- FreeRTOS task creation and management
- 5 concurrent tasks running on dual cores:
vOBDFetchTask- Fetches OBD-II data via WiFi (Core 0)vSENSFetchTask- Reads DHT11 and MPU6050 sensors (Core 0)vUITask- Renders TFT display (Core 1)vBLETask- Handles BLE communication (Core 0)vSaveTask- Persists settings to flash (Core 0)
global.hpp/cpp
- Shared data structures (
LiveData,OBDCommand_t,DataTypes_t) - FreeRTOS mutexes for thread-safe operations
- OBD-II PID definitions (RPM, Boost, Coolant Temp, etc.)
- State management and preferences storage
requests.hpp/cpp
- WiFi connection to OBD-II adapter
- ELM327 command protocol implementation
- Round-robin PID polling strategy
- Error handling and reconnection logic
screen.hpp/cpp
- TFT display initialization (GFX Library)
- Dynamic gauge rendering for different data types
- Multiple display modes (RPM, Boost, G-Force, etc.)
- Bitmap management and screen transitions
bleconnection.hpp/cpp
- BLE server setup with custom UUIDs
- Real-time telemetry streaming to mobile devices
- Characteristics for each vehicle parameter
sensors.cpp/sensor.h
- DHT11 temperature and humidity reading
- MPU6050 I2C initialization and configuration
- Accelerometer and gyroscope data acquisition
- Complementary filter for tilt/acceleration calculation
complementary_filter.hpp
- Sensor fusion algorithm for IMU data
- Combines accelerometer and gyroscope readings
- Removes drift and noise from motion tracking
- Install Visual Studio Code
- Install PlatformIO IDE extension
- Connect your ESP32-S3 DevKit to your computer via USB
# Open terminal in VS Code (Ctrl+`)
# Navigate to project directory
cd YourProjectDirectory\Codriver
# Build the project
pio runAlternatively, use PlatformIO GUI:
- Open the PlatformIO sidebar (alien icon)
- Click "Build" under "Project Tasks" → "esp32-s3-devkitc-1"
# Upload firmware to the board
pio run --target uploadOr via GUI:
- Click "Upload" in PlatformIO Project Tasks
# Open serial monitor
pio device monitor -b 115200Or via GUI:
- Click "Monitor" in PlatformIO Project Tasks
-
Configure WiFi Credentials (in requests.cpp)
- Set your OBD-II adapter's WiFi SSID and password
- Default OBD-II adapter IP:
192.168.0.10:35000
-
Build and Upload
pio run --target upload
-
Connect Hardware
- Plug OBD-II adapter into your vehicle's OBD-II port
- Power on the ESP32-S3 (via USB or external power)
- The system will automatically connect to the OBD adapter
-
Test Functionality
- Check Serial Monitor for debug output
- Verify TFT display shows vehicle data
- Connect via BLE to change screen via a mobile app
- First Boot: The system initializes all sensors and connects to WiFi
- Display Modes: Press Enter in the Serial Monitor to cycle through different display modes:
- RPM Gauge
- Boost Pressure
- G-Force Visualization
- Engine Temperature
- Internal Temps
- Battery Voltage
- Pitch and Roll Gauges
- RPM: Shows engine revolutions per minute
- Boost: Displays turbo boost pressure
- G-Force: Real-time acceleration visualization (braking, cornering)
- Temperature: Engine coolant temperature
- Voltage: Battery voltage monitoring
- Car Temp: Inside the car temperature and humidity
- Pitch and Roll: Side and front inclination of the car currently
- Enable BLE on your mobile device
- Scan for "Codriver" or the custom device name
- Connect to access the customization of the UI
- Use a BLE scanning app (e.g., nRF Connect) to view characteristics
For development without a vehicle:
- Uncomment
#define TESTINGin global.hpp - The system will generate simulated vehicle data
| Issue | Solution |
|---|---|
| Display not working | Check SPI wiring and power supply |
| WiFi connection fails | Verify OBD adapter is powered and WiFi credentials are correct |
| No sensor data | Check I2C connections (MPU6050) and DHT11 wiring |
| BLE not discoverable | Ensure BLE is enabled in code and ESP32 is powered |
- ✅ Engine RPM
- ✅ Turbo Boost Pressure
- ✅ Coolant Temperature
- ✅ Battery Voltage
- ✅ G-Force (Acceleration, Braking, Cornering)
- ✅ Cabin Temperature & Humidity
- ✅ Vehicle Tilt/Incline
- Dual-Core Processing: Separate UI rendering from data acquisition
- Round-Robin PID Polling: Optimized OBD-II query scheduling
- Persistent Settings: Saves display preferences to flash memory
- Error Handling: Automatic reconnection on WiFi/OBD failures
- Sensor Fusion: Complementary filter for accurate IMU data
- 📊 PowerPoint Presentation: Link to Presentation
- 🎥 YouTube Demo Video: Link to Video
This project was developed by a collaborative team with the following contributions:
- Designed and implemented the hardware wiring schematic
- Integrated MPU6050 IMU sensor and DHT11 sensor (sensor.cpp)
- Pitch and Roll calculation and handling (ComplementaryFilter.cpp)
- Graphics designer and implementation for the screen (screen.cpp)
- Tested and validated all sensor readings
- Tested the various screen functions with simulated values
- Developed OBD-II WiFi communication protocol (requests.cpp)
- Implemented ELM327 command parsing and error handling
- Created FreeRTOS task architecture in main.cpp & LittleFS memory partitioning
- Optimized round-robin PID polling strategy
- Implemented the preferences saving and upload on restart
- Hardware dependent testing and final full test
- Videomaker and prototype manufactoring (soldering, printing, ecc..)
- Implemented BLE server and characteristic definitions (bleconnection.cpp)
- Handled the BLE errors and retrials
- Full Android mobile app implementation (Mobile)
- Tested BLE connectivity with various mobile devices
- Created the 3D model for fitting the parts
- Created and Organized the GitHub workflow
- Code review and debugging sessions
- System integration and testing
- Documentation and presentation preparation
- Demo video production and review
- Refresh Rate: 50 Hz (20ms UI update cycle)
- OBD-II Polling: Variable (10-20ms per PID)
- Sensor Update: 150ms cycle
- BLE Streaming: 500ms update interval
- Flash: ~2MB (out of 4MB)
- SRAM: ~32KB heap usage
- PSRAM: Enabled for graphics buffering
- Active Mode: ~200-300mA @ 5V
- Display: ~80-100mA
- ESP32-S3: ~120-150mA (WiFi + BLE active)
This project is developed as part of an IoT university course. Please refer to your course guidelines for usage and distribution policies.
- Espressif Systems - ESP32-S3 platform
- PlatformIO - Development environment
- Arduino Community - Libraries and examples
- Course Instructors - Guidance and support
For questions or issues, please contact the team members or refer to the project repository's issue tracker.
Last Updated: February 2026