石榴姐

[Graduation] Design of household appliance switch control system based on GSM

 
Overview

Design of household appliance switch control system based on GSM

1: Graduation task design requirements

       Under the background of the widespread popularity of smart homes and smart phones, this topic proposes a smart home appliance switch control system with remote monitoring and remote control functions based on GSM smart phones, taking the currently popular smart home as an entry point. .

       The specific requirements for the home control system based on the GSM mobile network platform are as follows:

    (1) Using the GSM mobile phone network as a platform, remotely query the switch information of four-way household appliances.

    (2) User telephone inquiry, the system sends the switch information of household appliances to the user terminal through SMS.

    (3) Users can control the on and off status of four-way household appliances by sending text messages.

    (4) The four-channel home appliances in the home use centralized control. When there is no remote control, they form a centralized control system. Android phones can be used to realize remote control on and off functions.

    (5) The switch is controlled by a relay, and the relay current is 10A.

IMG_256

Figure 1 Design flow chart explanation

Two: Design plan

Power supply: The Hailingke HLK-10M05 ultra-small series module is used to convert household 220V power into V direct current. The post-stage circuit uses UTC (Youshun) 3.3V LDO to step down and provide working voltage for the microcontroller and relay. Provides a variety of operating voltages at all levels.

Main control: Choose STM32LO53C8T6 microcontroller and 3 UARTs to meet the system design requirements. Other redundant ports can be used to expand other functions.

GSM module: select SIM900A. Use a 4G mobile phone card. The reason for choosing this module is the convenience of supporting 4G mobile phone cards.

On the relay module: select Taobao four-way relay and select low level trigger.

Key switch input design: use light touch key switch 12*12mm round micro switch, buy it and design the circuit board yourself and weld it yourself.

Figure 2 Schematic diagram of design plan

Three: Programming

System initialization includes: GPIO initialization, serial port initialization, etc. After the initialization is completed, enter the module communication program, followed by the offline button processing program. If the system receives text messages and phone calls, it will perform text message and phone call data processing procedures.

I will introduce the important program flow chart here, and other simple codes will be understood by everyone here and will not be embarrassing.

wps

Overall system flow chart

Step one: Use STM32CubeMX initialization code program. Configure each GPIO port to meet functional requirements.

Secondly, select the appropriate clock frequency, and select the internal clock frequency of 16MHz. The development board has an 8MHz crystal oscillator, but if it does not, the internal crystal oscillator is used.

I introduced the serial communication program and AT command sending function by referring to the video of Lichuang EDA that I wanted to know in detail. I modified it according to this.

Link    https://www.bilibili.com/video/BV1eV411t7fn?p=28

This is the serial port generation function that I understand

The specific process of serial port implementation is that when USART1 receives the debugging information sent from the computer, it enters the serial port 1 interrupt, waits for the completion of data transmission, and the microcontroller sends the received data to the GSM module through serial port 2. The module sends the data to the microcontroller through serial port 2, and then the microcontroller forwards the data to the computer. Implemented AT command debugging of the module by computer. It facilitates the debugging process of later AT writing.

 

This is my AT command generation function

The previous two programs realize efficient AT command control between the microcontroller and the module. At the same time, the computer side can also receive the debugging information returned by the module. The module information identification program I designed includes an SMS phone data processing program, an SMS communication identification program, and an SMS sending program.

The implementation is to call the above function and provide the encapsulated uint8_t Send_Cmd (uint8_t *Cmd, uint8_t Len, char *recdata) for execution. Please see my demonstration video for the specific implemented functions.

This subroutine first parses the AT commands sent by the GSM module. When a call is made to the GSM module, the module will return the "RING" character to the microcontroller through the AT command. When the microcontroller receives the character and waits for 5 seconds to hang up to make the call, it will read the system status and send the system information to the preset via SMS. on a mobile phone when accepting an instruction received other than a phone call. The microcontroller detects whether the GSM module has received the text message. When the "+CMTI: "SM",XXX" character is detected, the text message information at that location is read. At the same time, it is identified whether there is a setting instruction in the text message. For example, when the "query" instruction text message is received, the system status is read and the system information is sent to the preset mobile phone via text message. If it is not the time to "query" text messages, other instructions will be detected. For example: when the "open all sockets" command is detected, all relays will be turned on.

 

 

The language recognition program has not been perfected yet and will be released after it is perfected. At present, only language recognition has been implemented, and serial port communication has not been completed.

Four: Control instructions

The supported commands are as follows

User action

Command content

System execution action

Call to check the status of electrical switches

Send system electrical switch status information

Query electrical switch status via SMS

Inquire

Send system electrical switch status information

SMS control electrical switch status

Open socket one

Open relay one

Turn off socket one

Close relay one

Open socket two

Open relay two

Close socket two

Close relay two

Open socket three

Open relay three

Close outlet three

Close relay three

Open socket four

Open relay four

Close socket four

Close relay four

Note: Designate users to receive text messages.

Five physical demonstrations

Demonstration video: Graduation project-Design of home appliance switch control system based on GSM_bilibili_bilibili

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2024-11-22 22:35:38

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号