Skip to content

sivaadityacoder/Advanced-Automotive-ECU-Simulation-Platform-with-Real-Time-Web-Telemetry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Advanced Automotive ECU Simulation Platform

This project is a real-time Engine Control Unit (ECU) simulator written in C. It runs a detailed engine model and broadcasts live telemetry data via WebSockets to an interactive web-based dashboard.

It's designed to be a professional portfolio piece that demonstrates a deep understanding of embedded systems, control algorithms, and modern web integration for automotive applications.


Architecture

The system consists of two main parts: a C-based backend that runs the core simulation and a frontend web dashboard for visualization and control. They communicate in real-time using WebSockets.

  [ Web Dashboard (HTML/JS) ] <---(WebSocket)---> [ C Backend Server ]
                                                      |
                                                      V
                                              [ ECU Core Logic ]
                                               - PID Control
                                               - Sensor Models
                                               - CAN Bus Sim
                                               - Safety Checks

Features

ECU Core (C99)

  • Real-time Engine Model: A state machine manages engine logic with a deterministic 100Hz (10ms) update loop.
  • PID Control: Closed-loop PID controllers manage idle speed and air-fuel ratio.
  • Sensor Simulation: Generates realistic data for sensors like throttle position, coolant temperature, and oil pressure.
  • CAN Bus Communication: Simulates the transmission of CAN messages for vehicle network integration.
  • Safety System: Includes over-rev protection, over-temperature limits, and other fault-handling logic.

Web Interface (HTML5/JavaScript)

  • Live Telemetry Dashboard: Displays real-time data on responsive gauges and charts (RPM, Temp, etc.).
  • Interactive Controls: An interactive throttle slider allows you to control the simulated engine load.
  • Fault Injection: Buttons on the dashboard allow you to trigger diagnostic faults to test the ECU's safety logic.
  • Data Logging: The web interface logs all incoming data to the browser console for inspection.

Build & Code Quality

  • Makefile Build System: A comprehensive Makefile handles building, testing, and packaging.
  • Unit Testing: A test suite validates the functionality of core ECU components.
  • Memory Safety: Integrated support for running tests with Valgrind and AddressSanitizer.
  • Static Analysis: make analyze target runs static analysis checks to ensure code quality.

Quick Start

1. Install Prerequisites

Ubuntu/Debian: sudo apt-get install build-essential git

macOS: xcode-select --install

2. Build and Run

Clone the repository, cd into the directory, and run the main command:

# This single command builds the C backend, starts the
# server, and serves the web interface.
make run

3. Access the Dashboard

Once the server is running, open your browser and navigate to http://localhost:8080.


Building and Testing

While make run is the fastest way to start, the Makefile provides several other useful targets for development:

Command Description
make all Builds the production executable.
make debug Builds a debug version with AddressSanitizer.
make test Runs the automated unit test suite.
make memcheck Runs the test suite under Valgrind for leak checks.
make analyze Runs static code analysis.
make clean Removes all build artifacts.

Future Enhancements

  • OBD-II Support: Add support for standard diagnostic trouble codes.
  • Hardware-in-the-Loop (HIL): Create a mode to interface with real hardware.
  • Cloud Integration: Stream telemetry to a cloud platform like AWS IoT for fleet analysis.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published