SUGISAKAMASANORI

Journal of Advances in Artificial Life Robotics
Vol. 1(4); March (2021), pp. 199–203
ON LINE ISSN 2435-8061; ISSN-L 2435-8061
https://alife-robotics.org/jallr.html

Research Article

Design of smart home security system based on 52 MCU
Hongbo Hao1, Fengzhi Dai1,2

Tianjin University of Science and Technology, China
Tianjin Tianke Intelligent and Manufacture Technology CO., LTD, China

12

ARTICLE INFO
Article History
Received 08 November 2019
Accepted 26 November 2020
Keywords
STC89C52 microcomputer
Temperature and humidity sensor
LCD1602r

ABSTRACT

Before the smart home has appeared in people's vision, people do not have a deep understanding.
But we may think something is insignificant in daily life. The article designs a simple, convenient,easy way to operate, and connected with the real life of smart home system. This design is basedon the STC89C52 microcomputer as the control system, the smoke sensor and temperature andhumidity sensor is used to detect the external environment. The system uses the button to adjust
the threshold of the smoke concentration limit. LCD1602 can display the sampled externalenvironment information in real time. This system can be used for anti-theft in shopping malls,warehouse, bank and other occasions. The device has a strong guiding significance for the current
people's daily life.

© 2022 The Author. Published by Sugisaka Masanori at ALife Robotics Corporation Ltd.
This is an open access article distributed under the CC BY-NC 4.0 license(http://creativecommons.org/licenses/by-nc/4.0/).

1. Introduction

design of software program is considered. Finally itsummarizes and predicts the design of this system.
The design mainly consists of five parts, namely
temperature and humidity detection, smoke concentration
detection, human infrared sensing, alarm information anddisplay screen information [1].
• The DHT11 temperature and humidity sensor sends
the detected data to the LCD1602A LCD screen
through a single-chip microcomputer. If the detection
result is not within the setting range, an audible andvisual alarm is issued.
• The smoke sensor can analyze and check the indoor
carbon dioxide, methane and smoke concentrations.
When the concentration of these gases exceeds apredetermined alarm value, the LED lights up and thebuzzer sounds to alarm.
•When the owner leaves the house or rests, he/she canenter the password on the keyboard of the security system
to arm, and the system will enter the arming state. Whensomeone invades the room, the human body infrared
sensor can quickly locate the human's range of motion andToday, with the continuous growth of economy,
people's life quality has also been improved. In addition,
the level of science and technology has been constantly
improved, and new technologies have been added topeople's lives, which all announce that intelligence is nolonger a fantasy.
Different from the traditional home, the smart home isvery convenient, it can give people a variety of intelligent
services, so as to meet people's various needs. For example,
even if we work in a distant company, we can operate thehome’s bathtub, so that we can take a warm bath soon after
we come home. We can also monitor our homes by remotemonitoring, which greatly reduces the security risks ofburglary, and fire-prevention is no longer a very difficult
problem.
The paper introduces the concept of the overall
framework of this topic and the selection of circuit module
components of each module, then the circuit diagram ofeach module and the principle are analyzed. Then theCorresponding author’s E-mail: daifz@tust.edu.cn, URL: www.tust.edu.cn

199send corresponding command signals along with the area
where the human body moves [2].
2. Overall system design
2.1. Design scheme
This design is the indoor environment monitoring system
based on a single chip microcomputer. The reference stylechosen for this design is about 120 square meters, withthree bedrooms, one living room and one bathroom.

Fig.1 Reset circuit schematic

3.1.2. Clock Circuit
An internal clock circuit is used, and the selected external
crystal is 12MHz. C1 and C2 are load capacitors with acapacitance of 30pF. The function of the two capacitors is
to improve the frequency stability and the quickness ofoscillation. The selection range of the capacitor is 5-30pF,
and the oscillation frequency selection range of the crystal
is 1.2-12 MHz. The internal clock circuit of MCU is shownin the Fig.2 below.

2.2. System composition
The smart home control system in this paper includes thedetection and control of temperature, humidity, smokeconcentration. The doors and windows will be opened
when the temperature, humidity and smoke concentration
reach the upper limit.
This paper uses the single chip microcomputer (52MCU) as the main operating system, the external sensor as
the detection unit. We used the stepping motor, MQ-2
smoke sensor, keypad, DHT11 temperature and humidity
sensor, buzzer, relay and other external modules. All thedata sampled by the sensor are collected, and then are feedback to the single chip microcomputer [3].

Fig.2 MCU internal clock circuit

3. Hardware circuit design

3.1.3. Interrupt System

3.1. Main control circuit

Interrupt technology is mainly used for real-timemonitoring and control. It is required that the single-chip
microcomputer can respond to the service request made by
the interrupt request source in time, and make a quick
response and timely processing. This is achieved by theon-chip interrupt system. When the interrupt request
source issues an interrupt request, if the interrupt request
is enabled, the single-chip microcomputer temporarilysuspends the main program currently being executed andtransfers to the interrupt service handler to process theinterrupt service request [4].

STC89C52 is a low power, high performance CMOS 8-bit
microcontroller with 8K system programmable flash
memory. The minimum system includes a single-chip
microcomputer and its required power, clock, reset, andother components, which can keep the single-chip
microcomputer in a normal operating state at all times.
Circuits such as the power supply and clock are necessary
conditions for the single chip microcomputer to beoperated. The minimum system can be taken as the core
part of the application system. By performing memory
expansion and A/D expansion, the single chip
microcomputer can complete more complex functions.

3.1.4. Temperature and humidity detection
DHT11 is a temperature and humidity composite sensor
with a calibrated digital signal output. It uses special
digital module acquisition technology and temperature andhumidity sensing technology. The sensor includes a
resistive humidity sensing element and an NTCtemperature measuring element, and is connected to ahigh-performance 8-bit microcontroller. The typicalapplication circuit of DHT11 is shown in Fig.3.

3.1.1. Reset circuit
The reset operation selected in this design is performed
manually. The capacitor in the circuit and the switch used
are operated in parallel to meet the predeterminedrequirements. The resistor R1 plays a role of protecting thecircuit. The schematic diagram of the reset circuit is shownin the Fig.1 below.
200other port is usually grounded. Generally, the single-chip
microcomputer is operated at a high-potential position in
the initial state.
3.6. Design of human detection module
The passive infrared detectors are used for humandetection. Passive infrared sensing technology uses
infrared light-sensitive devices to convert trace infrared
rays emitted by living organisms into corresponding
electrical signals, which are amplified and processed.
It can distinguish the moving organisms from falling
objects. At the same time, it also has the characteristics oflarge monitoring range, good concealment, strong antiinterference ability and low false alarm rate [6].

Fig.3 Typical application circuit of DHT11

3.2. MQ-2 smoke module
The MQ-2 smoke detection module mainly uses the MQ2 gas sensor to detect hydrogen in coal gas and other gas
components. This chip is mainly composed of ceramic
tubes, sensitive layers, measuring electrodes, heaters andother sensitive components.
The structure and shape of MQ-2 gas sensor is shown inFig.4. The heater is fixed in the cavity made of plastic orstainless steel, and it provides necessary working
conditions for the gas sensor. The packaged gas sensor has
six needle pins, four of which are used for signal extraction
and two for providing heating current [5].

4. Software design
In the single-chip application system, Keil software and C
language are used for programming. Then Proteus is usedfor simulation. Finally, the data is analyzed whether it
achieves the purpose. The program source code isdownloaded to the single-chip microcomputer. Check
whether the actual circuit achieves the expected effect. The
overall flow chart of security system design based on 52
single chip microcomputer smart home is shown in theFig.5 below.
startInitialize

Fig.4 Outline structure of MQ-2 components

3.3. Alarm module

Read AD conversion values,
temperature and humidity
valuesLight-emitting diode is short for LED. It uses asemiconductor device to convert physical signals into
electrical signals. In addition, the component uses tungsten
wires and phosphors to emit different colors of light asalarm signals. This design scheme is to use LED lights toemit different colors of light as an alarm signal.

Determine the current smoke,
temperature and humidity
range

Implement appropriate alarmcontrolN

3.4. LCD Module Design

If the key is pressed？

YLCD1602A uses a digital liquid crystal display, which iseasy to operate, small in size, fast in response, high insensitivity, and clear in picture.

Set the corresponding
parameter value

3.5. Button module design

EndThe key design of this project uses a stand-alone keyboard.
Because the different output and input pins in this type of
key will be stringed together with a certain coded key. The

Fig.5 System flow chart of smart home201

5. System testing and conclusion
5.1. Hardware testing
The physical circuit diagram of the hardware is shown in
Fig.6. In Fig.6, the key1 is the setting key to set thetemperature and humidity module and smoke module. TheKey2 is the plus key, and key3 is the minus key. The key4
is the arm/disarm key.

Fig.7 Arming simulation circuit diagram

Acknowledgements

Fig.6 Hardware physical circuit diagram

The research is partly supported by the Project of Tianjin
Enterprise Science and Technology Commissioner toTianjin Tianke Intelligent and Manufacture TechnologyCo., Ltd (19JCTPJC53700). It is also supported by theIndustry-University Cooperation and Education Project(201802286009) from Ministry of Education, China.

When it is detected that the indoor smoke density ishigher than the setting values, the first LED light turns
white and an alarm is given. The detection distance ofpersonal infrared is 7 meters. When a person intrudes, theLED light turns purple and alarms. Only pressing key4 tocancel the arming. When the temperature is lower than thesetting lower limit values, the LED turns yellow and gives
an alarm.

References
1. Samuel Bimenyimana, Aimable Ishimwe, GodwinNorense
Osarumwense Asemota, et al. Web-Based Design andImplementation of Smart Home Appliances Control System.
2018, 168(1).
2. Jianhua Cai, Chao Huang, YuLong Li, et al. Intelligent
Home Anti-theft System Based on MCU and GSM. 2013,
2(4):24-29.
3. Qing Ye, Si Meng Yu, Yi Sun. Design and Implementationof the Security Subsystem in the Smart Home System. 2014,
3468:3906-3910.
4. Kong, Fan Rong, Wang, Wenxin, Zhu, Jiajun. A Smart
Home Control System Based on Controller Area Network
Bus. 2013, 11(9):1667-1671(5).
5. A. Singaravelan, M. Kowsalya. Design and Implementationof Standby Power Saving Smart Socket with WirelessSensor Network. 2016, 92:305-310.
6. Sandy Suryo Prayogo, Farid Al Rafi, Yulisdin Mukhlis.
Design and Built IoT Home Panic Button for Smart City.
2019, 1175(1)7. Chong-Yao Xu, Xin Zheng, Xiao-Ming Xiong. The Designand Implementation of a Low Cost and High Security Smart
Home System Based on Wi-Fi and SSL Technologies. 2017,806(1)5.2. Software testing
When the indoor temperature and humidity, smoke
concentration exceed the setting values, the buzzer willalarm. When the simulated pyroelectric signal is pressed,
it represents someone enter and the human body infrared
alarms [7].
For the human infrared sensor module, pressing thekey4, the LCD screen displays "Z". Next the LCD screen
displays "B" for about 20 to 30 seconds and the systementers the armed state. Protues simulation arming circuit
diagram based on smart home is shown in the Fig.7.

202

Authors Introduction
Ms. Hongbo Hao

She is a second-year mastercandidate in Tianjin University ofScience and Technology, majoringin pattern recognition, principle ofautomatic control, engineering
mathematics and other importantcontrol disciplines. Her research areais about deep learning and image
processing. During her study, she has
published several research papers.

Dr. Fengzhi Dai

He received an M.E. and Doctor ofEngineering (PhD) from the Beijing
Institute of Technology, China in 1998 andOita University, Japanin
2004
respectively. His main research interests
areartificialintelligence,patternrecognition and robotics. He worked in
National Institute of Technology, Matsue College, Japan from2003 to 2009.Since October 2009, he has been the staff in
Tianjin University of Science and Technology, China, where
he is currently an associate Professor of the College ofElectronic Information and Automation.

203