Smart Vehicle Monitoring System — An embedded project based on the STM32F401VE microcontroller. It acquires critical vehicle data (speed, tire pressure, battery level), environmental conditions (temperature, light), and AI-based obstacle detection, displaying them on a 16x2 LCD. The system also streams aggregated real-time data to an external server via UART.
(To display your images, place your image files inside the assets/ folder in your repository and update the paths below accordingly):
| Proteus Schematic |
|---|
![]() |
- Dual-Source Data Acquisition: Simultaneously receives data from two independent sources (Vehicle Module and Environmental/AI Module) using a hardware multiplexer (MUX).
- Interactive LCD Interface: Displays real-time information across four intuitive menus, easily navigable via physical Back and Next buttons.
- Server Data Aggregation: Sends consolidated system status to a server (or host PC) in JSON format via USART6 at 1-second intervals.
- Robust Error Handling: Implements automatic UART error recovery (Overrun/Noise) to maintain reliable communication in noisy environments.
- Synchronized Data Buffering: Employs a precise buffer clearing mechanism that synchronizes with the MUX switching to prevent data corruption.
The project follows a modular and efficient real-time architecture:
- RX Layer (Interrupt-Driven): Uses
USART1andUSART2interrupts to asynchronously capture incoming data frames. - Multiplexing Layer: Controls the
PC3MUX pin, switching channels every 1.5 seconds to route signals from both input sources into the MCU. - Parsing Layer: Analyzes incoming raw strings to extract numerical values and state flags (e.g.,
Speed,Temp,State,Battery). - UI Layer: Manages the LCD frame buffer and updates the display dynamically based on the active menu selection.
- TX Layer (Telemetry): Constructs a comprehensive JSON payload containing all sensor readings and transmits it over
USART6once per second.
Pressing the PE0 (Next) and PE1 (Back) buttons allows users to cycle through the following four screens:
| Menu ID | LCD Title (Line 1) | Information Displayed (Line 2) |
|---|---|---|
| 0 | > SPEED MENU < |
Vehicle Speed (Km/h) and Battery Percentage (%) |
| 1 | > SAFETY MENU < |
Tire Pressure (P) and Safety Status (DANGER / SAFE) |
| 2 | > ENV MENU < |
Ambient Temperature (°C) and Light PWM Level (L:%) |
| 3 | > AI MENU < |
AI Obstacle Detection Status (Clear / Obstacle!) |
The system expects incoming strings to follow these specific formats over the serial lines:
- From USART1 (Vehicle Module):
Speed=120Battery=85Tire Pressure: 32EMERGENCY(Triggers the danger state flag)
- From USART2 (Environmental/AI Module):
Temp:35C | Warn LED:ON | Lights PWM:50State:2(0= Path Clear,1to3= Obstacle Detected)
Every second, the system transmits a single JSON object string followed by \r\n (carriage return and line feed) to the server:
{
"safety": {
"tire": 32,
"danger": 0
},
"env": {
"temp": 35,
"pwm": 50
},
"status": {
"speed": 120,
"bat": 85
},
"ai": {
"obstacle": "Clear"
}
}- Clone the Repository:
git clone https://github.com/Smart-Car-Dev/Salar-SmartCar.git
- Open the Project: Launch STM32CubeIDE and import the project by opening the
.iocconfiguration file. - Verify Configuration:
- Ensure the system clock is set to the HSI 16 MHz source.
- Confirm that the UART and GPIO pins are configured exactly as defined in the Pinout Table above.
- Compile & Flash: Build the code and flash the binary to your STM32F401VE microcontroller.
- Hardware Setup: Connect a USB-to-UART converter to the
USART1andUSART2pins to interface with a PC or simulators, matching the Proteus schematic. - Proteus Simulation: Run the provided Proteus schematic. Use the virtual terminal components to send test data strings to the MCU and observe the LCD updating in real-time.
- STM32Cube HAL Library (F4 Series)
- CMSIS Core
- C11 Standard
Note: No external third-party libraries are required for compilation. All custom driver logic (LCD, UART parsing, JSON formatting) is natively implemented in the project source files.
Contributions are highly welcome! If you have ideas to enhance this system, please feel free to Fork this repository and submit a Pull Request. For bug reports or feature suggestions, please open an Issue in the GitHub repository.
This project is licensed under the MIT License. See the LICENSE file for details.
This project was developed and debugged by the following team:
| Role | Name | Contribution |
|---|---|---|
| Lead Developer & Project Creator | Salar Ghasemi | Architecture design, core firmware implementation, and system integration. |
| Debugging & Hardware Optimization | Sobhan Nasiri | Hardware debugging, low-level driver tuning, MUX routing optimization and Add Readme.md. |
| System Debugging & Software Testing | Hossein Ranjbar | Software logic verification, UART protocol refinement, and bug resolution. |
Built with ❤️ by the Smart Car Dev Team
