Design of household appliances and home environment monitoring system based on GSM

Publisher:rocky96Latest update time:2011-10-20 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Abstract: A household appliance and home environment monitoring system based on GSM is designed. The system is mainly composed of GSM module TC35i, infrared receiver, 51 single-chip microcomputer, DS1820 temperature sensor, etc. First, the infrared control code of the home appliance remote control is parsed through the infrared receiver to learn the remote control; when the GSM module in the system receives a text message from the user, the system parses the information of the user's pre-control of the home appliance, and then transmits the corresponding control code through the infrared transmitter, so as to achieve the purpose of monitoring the home appliance; the home environment temperature information is collected through the temperature sensor, and when abnormal temperature occurs, the GSM module can be used to send an alarm to the user's mobile phone. Experiments have proved that the system is stable and meets the design requirements.

0 Introduction

At present, the remote control system of household appliances is generally realized through the Internet or the public switched telephone network. However, with the increasing popularity of mobile phones, it is possible to use GSM short messages to remotely monitor the home environment and household appliances. Compared with the telephone remote control method, it gets rid of the constraints of telephone lines on the equipment; compared with computer remote control, it reduces the equipment and use costs.

There have been many studies on using GSM network to realize monitoring of home security, greenhouse, street lamp, vending machine, etc. Most of these studies are realized by using GSM network to remotely control relays. The GSM-based household appliances and home environment monitoring system designed in this paper is mainly aimed at many household appliances with infrared remote controllers (such as water heaters, air conditioners, TVs, set-top boxes, etc.) at present, and the control of household appliances is realized through GSM network and the duplication of household appliance remote controllers.

1 System Working Principle

The GSM-based household appliances and home environment monitoring system consists of a GSM SMS module that can send and receive text messages as the host computer, an intelligent controller (microcontroller), a temperature sensor, and household appliances with infrared remote controls as the slave computers (such as water heaters, air conditioners, televisions, set-top boxes, etc.).

First, the system is initialized. The MCU reads the temperature upper limit set by the user and the target number to send the alarm SMS from the keyboard and displays them on the LCD display. When the MCU detects that the user presses the infrared learning key, it enters the infrared learning interrupt service program, reads the infrared signal emitted by the external home appliance remote control, decodes the infrared signal, redefines the code length, groups, and saves it, thereby learning the remote control [728].

After the initialization is completed, the microcontroller cyclically reads the value of the temperature sensor DS1820 and compares it with the temperature upper limit value set by the user in advance. Once it is found that the current temperature exceeds the temperature upper limit, the GSM module TC35i is controlled to send an alarm text message to the user's mobile phone through the GSM network.

At the same time, the MCU cyclically queries whether the serial port has received any information. If it has, it reads the information into the MCU, parses the content of the SMS to find out what kind of instruction the MCU is required to send to the household appliance, and transmits the infrared signal representing the instruction through the infrared transmitting tube, thereby controlling the household appliance. The system block diagram is shown in Figure 1.

Figure 1 System block diagram

2 System Hardware Design

The household appliances and home environment monitoring system based on GSM mainly uses AT89S52 single-chip microcomputer as the intelligent control center, 4@4 keyboard and 1602LCD display as human-computer interaction equipment, TC35i is selected as the GSM communication module, and DS1820 temperature sensor is used for temperature acquisition; infrared signals are received through HS0038B infrared receiving head to complete the demodulation and amplification of infrared signals; at the same time, the square wave generator function of AT89S52 single-chip microcomputer P1.0 port is used to form an infrared signal modulation device, and an infrared LED is used as an infrared transmitting device.

2.1 Connection between GSM module and microcontroller

GSM module TC35i is a 3.3 V CMOS component, requiring the startup current of the power supply to exceed 2 A and the startup voltage to reach 4.2 V. Therefore, the power chip LM2596, which can provide a maximum current of 3 A, is used. Pins 1 to 5 of TC35i are connected to the power output pins of LM2596, pins 6 to 10 are grounded, and pins 25 to 27 are connected to the SIM card. In order to display the working status of TC35i, an LED indicator is connected to the ground at pin 32.

After TC35i is started, data and commands can be sent to TC35i through the serial port of the microcontroller. The baud rate of TC35i is adaptive. Here, the baud rate is 9600. Just connect the RXD and TXD of TC35i to the TXD and RXD of the microcontroller respectively. See Figure 2 for the circuit diagram.

Figure 2 Connection between TC35i and MCU

2.2 Connection between infrared receiver and microcontroller

The infrared receiver HS0038B is an infrared receiver chip that integrates demodulation, filtering, amplification and other functions. It demodulates the infrared signal modulated on the 38 kHz square wave and outputs the square wave through the OUT pin. HS0038B usually outputs a high level. When there is a remote control signal input, its output is a high and low level pulse. Therefore, when receiving, a code is composed of a low level followed by a high level. Different codes can be formed by using a combination of high and low levels of different lengths. In this system, the infrared signal will be read by interruption, so the OUT pin of HS0038B is connected to the external interrupt 0 of the microcontroller. The connection between HS0038B and the microcontroller is shown in Figure 3.

Figure 3 Connection between infrared receiver HS0038B and microcontroller

3 System Software Design

TC35i can send Chinese or English SMS. This system uses the Chinese SMS format, namely the PDU format. First, put the relevant information of the SMS into a PDU data packet. The beginning of the packet is the SMS center number. The following is the target mobile phone number, which is obtained by swapping the adjacent odd and even digits of the actual phone number and adding F. For example, if the original mobile phone number is 12345678901, the above method is used to obtain 2143658709F1.

Then comes the length of the number 0D, China national access code 91, decoding method 00, encoding method 08, and then the retention time of the message in the information center, which is generally selected to be retained for 10 days, that is, A0. Finally, the message length and message content are respectively. If you want to send / fire alarm 0, the message length is 4 hexadecimal 04, / fire alarm 0 is converted into hexadecimal data 706B 8B66 through the unicode code conversion program.

The content of the entire PDU data packet is: 0011000D91682143658709F130008A004706B8B66.

All the control of TC35i by the microcontroller is done by sending AT commands through the serial port. Each action of TC35i corresponds to an AT command, and each command must be followed by a carriage return to tell TC35i that the command has been sent. Some commonly used AT commands are shown in Table 1.

Table 1 Common AT commands

After the UDP data packet is completed, TC35i needs to be connected and a text message needs to be sent through TC35i. First, the command AT representing the connection is sent through the serial port, and then TC35i is set to send a text message in UDP format. Next, the length of the PDU data packet is sent to TC35i, and then the completed PDU is sent to TC35i. Finally, the ASC code 0x1A of ctrl+z and the ASC code 0x0D of carriage return are added at the end. In this way, a Chinese text message is sent out. The text message sending program flow is shown in Figure 4.

Figure 4 Flowchart of sending SMS

The information of the infrared signal emitted by the infrared remote control is represented by high and low levels of different durations. Taking NEC coding as an example, the leading code starts from 9 ms high level and ends with 4.5 ms low level; the code 0 starts from 0.56 ms high level and ends with 0.56 ms low level; the code 1 starts from 0.56 ms high level and ends with 1.69 ms low level. Since the HS0038 infrared receiver will invert the infrared signal after receiving it, the delay time of the high and low levels is exactly the opposite. Therefore, once the output signal of the infrared receiver triggers an external interrupt, if the microcontroller reads a low level from the input pin after a delay of 9 ms, it means that this is the boot code, and the system needs to start the infrared code acquisition program: first delay 4.5 ms to release the low level of the boot code, then delay 0.56 ms, release the low level part of the first code, and finally delay 0.8 ms to read the voltage of the input pin. If it is low, it means that the signal is code 0, save it, and increase the accumulator by one. If it is high, it means that the signal is code 1, save it, and increase the accumulator by one. After 32 cycles, the entire infrared signal is encoded.

According to the above idea, open interrupt 1 and set it as falling edge trigger, and open T0 timer counter and set it as 16-bit reload timer. Once the infrared receiver receives the infrared signal, it will cause interrupt 1 of the microcontroller, and then enter the interrupt service subroutine. In the interrupt service subroutine, close the counter and record the value in the counter; then, determine whether the value is within the time range of 0 code, 1 code or leading code. If so, record the value in the storage area. By analogy, after recording 32 codes, all infrared information has been recorded. The program flow chart is shown in Figure 5.

Figure 5 Infrared decoding flow chart

The transmission of infrared remote control signals requires that the high and low levels representing the infrared signals be modulated on a 38 kHz square wave and transmitted through the infrared LED. Therefore, on the one hand, by programming the two registers T2MOD and T2CON of the single-chip microcomputer T2 timer, T2 works in the programmable square wave generator mode and outputs a 38 kHz square wave at the P1.0 port. On the other hand, according to the NEC coding format, the high and low levels representing different durations of the infrared signal are generated at the P1.4 port through the delay program. The signals output by the two IO ports are ANDed on the AND gate to modulate the infrared remote control signal on a 38 kHz square wave.

4 Conclusion

As a public land mobile communication network, GSM has advantages that other communication methods cannot match. It has a wide communication range, high reliability of data transmission, and economical short message service. It is a relatively good data transmission method for remote wireless data transmission systems. The household appliances and home environment monitoring system based on GSM makes full use of the existing GSM network and related mature technologies. The mobile terminal composed of a single-chip microcomputer, a GSM module TC35i, an infrared receiving device and a temperature sensor can well complete the sending and receiving of short messages. It is suitable for remote control of household appliances with infrared remote controls and can report fire alarm information at home in a timely manner. Experiments have proved that this system can successfully remotely control Huawei C3100 set-top boxes, Kelon KFR226GW/ND1 air conditioners, and Changhong CHD29300 TVs. With the popularization of mobile phones, this system has good promotion prospects and practical value.

Reference address:Design of household appliances and home environment monitoring system based on GSM

Previous article:Evaluating the intelligence of monitoring products with intelligent analysis technology
Next article:Design of real-time monitoring and management system for core items based on RFID technology

Latest Security Electronics Articles
Change More Related Popular Components

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号