This project is an advanced automotive control simulation built on the STM32F401RE microcontroller. It integrates multiple sensors to automate windshield wipers and vehicle lighting while providing real-time environmental telemetry. The system balances autonomous sensor-driven logic with high-priority manual user overrides.
The system simulates a smart windshield wiper using a Servo Motor controlled via PWM.
- Automatic Mode: Uses a water sensor (ADC) to detect rain intensity. If the value falls between 1900 - 3000, the wipers activate at Level 1 (Slow).
- Manual Override: An external push-button managed by External Interrupts (EXTI) and a State Machine allows the user to cycle through modes:
- Press 1: Level 1 (Slow Speed).
- Press 2: Level 2 (High Speed).
- Press 3: Stop/Off.
- Logic Priority: Manual button commands take precedence over autonomous sensor readings to ensure driver control.
Simulates automatic headlights using dual LDR (Photoresistor) sensors for increased accuracy.
- Differential Sensing: The system calculates the average of two LDR inputs via ADC to filter out noise or localized shadows.
- Threshold Trigger: If the average light intensity drops below 1900 (indicating darkness), the RGB LED illuminates in a "Plasma" color (Green + Blue). It automatically turns off when ambient light increases.
Real-time data is processed and displayed on a 20x4 Character LCD:
- DHT11 Sensor: Captures Temperature and Humidity via a custom single-wire protocol implementation.
- ADC Monitoring: Displays live Water Level and Light Intensity values.
- LCD Management: Contrast is adjustable via a potentiometer. The display is refreshed every 500ms using non-blocking timers (
HAL_GetTick) to ensure system responsiveness.
- ADC (Analog-to-Digital Converter): Multi-channel configuration used to read LDRs and Water sensors. Implemented a dynamic
ADC_Read_Channelfunction for efficient switching. - PWM (Pulse Width Modulation): Generated via TIM1 at 50Hz to precisely control the Servo motor angle (0° to 180°).
- Timers (TIM2): Configured for microsecond-level precision (
delay_us) required for DHT11 and LCD timing. - EXTI (External Interrupt): Used for the control button to ensure immediate response to user input.
- GPIO Bit-Banging: Custom drivers developed for 4-bit LCD communication and DHT11 handshake protocol.
- Nucleo-F401RE Development Board
- 20x4 LCD Display
- SG90 Servo Motor
- DHT11 Temperature & Humidity Sensor
- Water Level Sensor
- 2x LDR (Photoresistors)
- RGB LED & Push Button
- Potentiometer (for LCD contrast)
Core/Src/main.c: Core application logic, peripheral initialization, and sensor drivers.Core/Inc/main.h: Pin mapping, macro definitions, and function prototypes.water_sensitive_car_wiper.ioc: STM32CubeMX configuration file.
Ceren Sultan Çetin
- Software Engineering Student @ Ostim Technical University
- Embedded Software Intern in the Defense Industry
- Board Member of the OSTIMTECH Software Club