This STM32-based system provides precise temperature-controlled ventilation, featuring automatic and manual fan control, real-time monitoring, and comprehensive alert mechanisms.
- Collaborators
- Project Overview
- Features
- Hardware Components
- System Logic
- Implementation
- How to Run
- Documentation
- License
This project was developed through the valuable collaboration of:
The system controls indoor temperature using an LM35 sensor and displays real-time temperature on an LCD1602 display. An electric DC fan can be controlled automatically or manually:
- Automatic Mode: The fan adjusts direction and speed based on predefined temperature thresholds.
- Manual Mode: The user controls fan direction (forward/reverse) and speed using push buttons.
Visual (LEDs) and audible (buzzer) alerts notify users when the temperature is outside the safe range.
- LM35 analog sensor
- Real-time display on LCD1602
- Updates triggered by ≥0.5°C change
-
Auto Mode:
- Above 20°C → Counter-clockwise (cooling mode)
- Below 10°C → Clockwise (heating mode)
- Between 10–20°C → Fan stops
-
Manual Mode:
- 5 push buttons control fan direction (FWD, REV, STOP)
- PWM speed control (
+10%
/-10%
per button press)
- L298N Dual H-Bridge for direction control
- PWM-based speed control (0–100%)
- Red LED + Buzzer: Danger zone (Temp <10°C or >20°C)
- Green LED: Safe range (10–20°C)
- UART (Serial Output): Transmits PWM duty cycle for monitoring
- EXTI interrupts handle button inputs for real-time control
lcd1602.h
driver written from scratch using STM32 HAL GPIO functions
Component | Description |
---|---|
MCU | STM32F103R6 |
Sensor | LM35 Analog Temperature Sensor |
Motor Driver | L298N Dual H-Bridge |
Display | LCD1602 (16x2 Character Display) |
Fan | DC Motor with adjustable direction/speed |
Push Buttons | 5 (FWD, REV, STOP, PWM+, PWM-) |
LEDs + Buzzer | Red & Green LEDs + Buzzer for alerts |
UART | Virtual terminal output for PWM monitoring |
-
Initialize hardware
-
Loop:
-
Read LM35 sensor
-
Update LCD if temp changes ≥0.5°C
-
Check mode:
-
Manual Mode: Set direction & speed via buttons
-
Auto Mode:
-
20°C → Fan CCW + Alerts
- <10°C → Fan CW + Alerts
- 10–20°C → Fan stops, green LED on
-
-
-
Mode | Direction | Purpose | GPIO |
---|---|---|---|
Summer Mode | Counter-clockwise | Cooling airflow | PC8=HIGH, PC9=LOW |
Winter Mode | Clockwise | Warm air circulation | PC8=LOW, PC9=HIGH |
- STM32CubeMX: Peripheral configuration
- Keil MDK-ARM: Embedded C programming
- Proteus 8.17: Circuit simulation
Function | STM32 Pin |
---|---|
LM35 Sensor | PA1 (ADC) |
LCD Control | PA2–PA4 |
LCD Data | PC0–PC6, PC10 |
Fan PWM | PC7 (TIM3_CH2) |
Fan Dir | PC8, PC9 |
UART TX | PA9 |
Red LED | PB11 |
Green LED | PB10 |
Buzzer | PA0 |
Buttons | PB0–PB4 |
![]() Safe Temp |
![]() High Temp |
- Proteus 8.17+
- Keil MDK-ARM 5+
- STM32CubeIDE (Optional)
git clone https://github.com/Seymagocmez/STM32_Temperature_Ventilation_Control.git
cd STM32_Temperature_Ventilation_Control
- Open the
ventilition_system.pdsprj
file in Proteus. - Open the Keil project (
ventilition_system.uvprojx
) in Keil MDK-ARM. - Build the project in Keil to generate the
.hex
file. - Load the generated
.hex
file into the STM32 MCU component in the Proteus schematic. - Start the simulation in Proteus to observe the system behavior.
For a more detailed documentation, please refer to the project docs.
For a more detailed explanation of the system design, implementation details, and usage instructions, please refer to the project documentation (PDF).
This project is licensed under the MIT License.
See the LICENSE file for details.