Skip to content

Smart-Car-Dev/Salar-SmartCar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚗 Salar-SmartCar

License Platform IDE

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.


📸 Project Gallery (Hardware & Schematic)

(To display your images, place your image files inside the assets/ folder in your repository and update the paths below accordingly):

Proteus Schematic
Proteus Schematic

✨ Key Features

  • 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.

🧠 Software Architecture & Data Flow

The project follows a modular and efficient real-time architecture:

  1. RX Layer (Interrupt-Driven): Uses USART1 and USART2 interrupts to asynchronously capture incoming data frames.
  2. Multiplexing Layer: Controls the PC3 MUX pin, switching channels every 1.5 seconds to route signals from both input sources into the MCU.
  3. Parsing Layer: Analyzes incoming raw strings to extract numerical values and state flags (e.g., Speed, Temp, State, Battery).
  4. UI Layer: Manages the LCD frame buffer and updates the display dynamically based on the active menu selection.
  5. TX Layer (Telemetry): Constructs a comprehensive JSON payload containing all sensor readings and transmits it over USART6 once per second.

📋 LCD Menu Structure

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!)

📡 UART Communication Protocol

1. Incoming Data (Received via USART1 & USART2)

The system expects incoming strings to follow these specific formats over the serial lines:

  • From USART1 (Vehicle Module):
    • Speed=120
    • Battery=85
    • Tire Pressure: 32
    • EMERGENCY (Triggers the danger state flag)
  • From USART2 (Environmental/AI Module):
    • Temp:35C | Warn LED:ON | Lights PWM:50
    • State:2 (0 = Path Clear, 1 to 3 = Obstacle Detected)

2. Outgoing Data (Transmitted via USART6)

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"
  }
}

🛠️ Getting Started & Execution Guide

  1. Clone the Repository:
    git clone https://github.com/Smart-Car-Dev/Salar-SmartCar.git
  2. Open the Project: Launch STM32CubeIDE and import the project by opening the .ioc configuration file.
  3. 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.
  4. Compile & Flash: Build the code and flash the binary to your STM32F401VE microcontroller.
  5. Hardware Setup: Connect a USB-to-UART converter to the USART1 and USART2 pins to interface with a PC or simulators, matching the Proteus schematic.
  6. 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.

📦 Dependencies

  • 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.


🤝 Contributing

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.


📄 License

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

👥 Authors & Contributors

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

About

Display node for real-time monitoring of Smart Car sensors with a modular architecture designed to support future protocol migrations.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages