Simulated Automotive ECU
A simulated automotive ECU that reads throttle and coolant temperature sensors, displays them on an LCD digital dashboard, and controls engine behavior, warning indicators, and a cooling fan using Rust on a microcontroller.
Author: Dorobantu Iulian-Adrian
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-adriandorobantu
Description
This project implements a simulated Electronic Control Unit (ECU) for an automotive system using the Raspberry Pi Pico WH microcontroller. It reads analog inputs from a throttle position sensor (potentiometer) and a coolant temperature sensor (thermistor), processes the data in real time, and outputs relevant system states.
A key feature of the project is its simulated digital dashboard, displayed on an LCD screen, which shows live throttle percentage and coolant temperature, mimicking a real vehicle interface. Based on sensor values, the ECU controls various outputs: activating a cooling fan when temperature exceeds a threshold, adjusting a simulated engine RPM, and triggering visual and audible warnings for overheating or abnormal behavior.
Motivation
I chose to develop this project because I’m deeply passionate about cars and fascinated by the technology that powers them. The Electronic Control Unit (ECU) has revolutionized the automotive world by shifting control from purely mechanical systems to intelligent, software-driven logic.
Architecture
Central control unit
- Role: Acts as the brain of the ECU system. It reads input from sensors, executes control logic in real time, updates the digital dashboard, and manages actuator outputs based on current conditions.
- Key functions: Input acquisition, data processing, threshold evaluation, system coordination.
Warning System
- Interface: GPIO, PWM
- Role: Provides visual and audible alerts when critical conditions occur, such as engine overheating, sensor faults, or when the rev limiter is reached.
- Components Managed: LEDs for visual warnings, passive buzzer for audible alerts.
- Control Logic: LEDs for visual warnings, passive buzzer for audible alerts.
Throttle Input Module
- Interface: ADC
- Role: Simulates the accelerator pedal by measuring voltage changes from a user-controlled input (e.g., potentiometer). Converts analog signal to throttle percentage for use in engine behavior simulation.
- Signal Processing: Reads analog value, applies scaling or smoothing, and forwards to control logic.
Temperature Monitoring Module
- Interface: ADC
- Role: Monitors coolant temperature using a thermistor sensor. Interprets temperature readings and flags overheat conditions for system response.
- Function: Inputs temperature data into the control unit for fan activation and warning generation.
Output Control Module
- Interface: GPIO, PWM
- Role: Controls actuators such as the cooling fan, warning LEDs, and buzzer based on logic provided by the Central Control Unit.
- Response Handling: Turns fan on/off, manages alerts, and simulates engine RPM response.
Digital Dashboard Interface
- Interface: SPI
- Role: Simulates a vehicle’s dashboard by displaying live data such as throttle percentage, engine RPM, coolant temperature, and fault warnings.
- Function: Receives data from the control unit and presents it to the user through a graphical interface.
Log
Week 5 - 11 May
I began to search for all of the neccesary components, in order to start putting the project together. The first lines of code are beggining to be written, and all of the hardware details are being sorted out. While I wait for the components to arrive, I am also looking into making a 3D printed case for my ECU.
Week 12 - 18 May
Week 19 - 25 May
Hardware
- Raspberry Pi Pico WH: Main microcontroller, reads sensors and controls outputs.
- 10kΩ Potentiometer: Simulates throttle input (gas pedal).
- 10kΩ NTC Thermistor: Measures coolant temperature.
- Passive Buzzer: Emits audible alerts for overheating or faults.
- LEDs with 220Ω Resistors: Provide visual warnings and rev limit indication.
- DC Fan: Simulates engine cooling, activated based on temperature.
- SPI LCD Display: Acts as a digital dashboard for real-time data visualization.
- Breadboard & Jumper Wires: For prototyping and interconnecting components.
Schematics
Bill of Materials
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico WH | The microcontroller | 39 RON |
10kΩ Potentiometer | Throttle input | 1,99 RON |
10kΩ NTC Thermistor | Measuring the coolant temperature | 6,49 RON |
Passive Buzzer | Audible warnings | 1,40 RON |
LEDs with 220Ω, 1k, 10k Resistors | Visual Warnings | Already owned |
DC Fan | Simulates coolant temperature regulation | 9,99 RON |
LCD Display | Digital Dashboard | 29,99 RON |
Software
Library | Description | Usage |
---|---|---|
st7735-lcd | ST7735-specific driver crate to send commands/data to the display | Used for the LCD display |
embedded-graphics | 2D graphics library | Used for drawing to the display |
embassy-rp | RP2040 Peripherals | Used for accessing the peripherals |
heapless | String Library | Used for making strings for writiing to the lcd |
embbeded-hal | Hardware abstraction layer | Used for interacting with hardware components. |
defmt | Logging crate (used with Embassy) | Used for debugging/logging to RTT (Real Time Terminal) |
embassy-time | Async timers/delays | Used for delays, blinking LEDs, buzzer timing, fan debounce |
embassy-executor | Async runtime | Used for running async fn tasks in Embassy |