Project finished product image:

Bilibili video link:
https://www.bilibili.com/video/BV11orNYeEN1/?share_source=copy_web&vd_source=097fdeaf6b6ecfed8a9ff7119c32faf2
(See the end of the article for material sharing)
01
—
Project Introduction
1. Function Details
STM32 Smart Window
The functions are as follows:
-
Based on STM32F103C8T6 minimum system board
-
MQ135 sensor detects air quality
-
DHT11 detects environmental temperature and humidity
-
Photoelectric infrared sensor detects intruders
-
Rain sensor detects rainfall
-
All detection information is displayed on the OLED screen
-
In automatic mode, curtains are opened and closed on a timer, and windows are closed based on external conditions
-
Manual mode allows manual button control of curtain opening and closing
-
Buttons can set time and various parameter thresholds
-
Can connect to Bluetooth APP for remote information viewing and control
2. Material List
-
STM32F103C8T6 microcontroller
-
OLED screen
-
DHT11 temperature and humidity sensor
-
MQ135 air quality sensor
-
Photoelectric infrared sensor
-
Rain sensor
-
Stepper motor
-
Active buzzer
-
LED light
-
BT04A Bluetooth module
02
—
Schematic Design

03
—
PCB Hardware Design
PCB Diagram


04
—
Program Design
#include "sys.h"
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include "math.h"
#include "delay.h"
#include "gpio.h"
#include "key.h"
#include "oled.h"
#include "usart.h"
#include "adc.h"
#include "dht11.h"
#include "motor_bujin.h"
#include "rtc.h"
/*********** Main Function *****/
int main(void){
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); // Configure interrupt priority group
Delay_Init(); // Delay initialization
Gpio_Init(); // IO initialization
Key_Init(); // Key initialization
Oled_Init(); // OLED initialization
Oled_Clear_All(); // Clear screen
Usart1_Init(9600); // Serial port 1 initialization
Adc_Init(); // ADC initialization
while(RTC_Init()); // RTC initialization
Step_Motor_Init(); // Stepper motor initialization
while(DHT11_Init()); // DHT11 initialization
while(1) {
Key_function(); // Key function
Monitor_function(); // Monitoring function
Display_function(); // Display function
Manage_function(); // Management function
time_num++; // Timing variable +1
Delay_ms(10);
if(time_num %10 == 0)
LED_SYS = ~LED_SYS;
if(time_num >= 5000) {
time_num = 0;
}
}
}
05
—
Experimental Results


Material Sharing (Baidu Cloud)
https://pan.baidu.com/s/1QX_p5ZWWTM7eThRfEPMs0g?pwd=4id8 Extraction code: 4id8
(Or scan the QR code below to obtain)
For physical purchase, scan the QR code below