STM32 Project Share: Smart Window

Project finished product image:

STM32 Project Share: Smart Window

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:

  1. Based on STM32F103C8T6 minimum system board

  2. MQ135 sensor detects air quality

  3. DHT11 detects environmental temperature and humidity

  4. Photoelectric infrared sensor detects intruders

  5. Rain sensor detects rainfall

  6. All detection information is displayed on the OLED screen

  7. In automatic mode, curtains are opened and closed on a timer, and windows are closed based on external conditions

  8. Manual mode allows manual button control of curtain opening and closing

  9. Buttons can set time and various parameter thresholds

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

STM32 Project Share: Smart Window

03

PCB Hardware Design

PCB Diagram

STM32 Project Share: Smart WindowSTM32 Project Share: Smart Window

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

STM32 Project Share: Smart WindowSTM32 Project Share: Smart Window

Material Sharing (Baidu Cloud)

https://pan.baidu.com/s/1QX_p5ZWWTM7eThRfEPMs0g?pwd=4id8 Extraction code: 4id8

(Or scan the QR code below to obtain)STM32 Project Share: Smart WindowFor physical purchase, scan the QR code belowSTM32 Project Share: Smart Window

Leave a Comment