This article mainly explains in detail the design of the intelligent security alarm system based on the single- chip microcomputer . We introduce the solution based on the STC89C52 single-chip microcomputer. First, the STC89C52 pin diagram and function are introduced. Secondly, the hardware, software, system testing and other aspects of the intelligent security alarm system based on the STC89C52 single-chip microcomputer are explained. Follow the editor to learn more about it.
STC89C52 is a low-power, high-performance CMOS 8-bit microcontroller produced by STC, with 8K in-system programmable Flash memory. STC89C52 uses the classic MCS-51 core, but has made many improvements to give the chip functions that traditional 51 microcontrollers do not have. With a smart 8-bit CPU and in-system programmable Flash on a single chip, STC89C52 provides highly flexible and super-effective solutions for many embedded control application systems.
STC89C52 pin diagram and functions
STC89C52 pin description:
VCC (40 pin): power supply voltage
VSS (pin 20): Ground
P0 port: P0 port is an 8-bit open-drain bidirectional I/O port. As an output port, each bit can drive 8 TTL logic levels. When writing "1" to the P0 port, the pin is used as a high-impedance input. When accessing external program and data memory, the P0 port is also multiplexed as the low 8-bit address/data. In this mode, P0 has an internal pull-up resistor. During flash programming, the P0 port is also used to receive instruction bytes; during program verification, the instruction bytes are output. During program verification, an external pull-up resistor is required.
P1 port: P1 port is an 8-bit bidirectional I/O port with internal pull-up resistors. The P1 output buffer can drive 4 TTL logic levels. When writing "1" to the P1 port, the internal pull-up resistor pulls the port high, and it can be used as an input port. When used as an input, the pin pulled low by the external device will output current (IIL) due to the internal resistance.
In addition, P1.0 and P1.2 are used as external count input (P1.0/T2) and trigger input (P1.1/T2EX) of timer/counter 2, respectively , as shown in the following table. During flash programming and verification, port P1 receives the lower 8-bit address byte.
Pin No. Second Function
P1.0 T2 (external count input of timer/counter T2), clock output
P1.1 T2EX (capture/reload trigger signal and direction control of timer/counter T2)
P1.5 MOSI (for online system programming)
P1.6 MISO (for online system programming)
P1.7 SCK (for online system programming)
P2 port: P2 port is an 8-bit bidirectional I/O port with internal pull-up resistors. The P2 output buffer can drive 4 TTL logic levels. When writing "1" to the P2 port, the internal pull-up resistor pulls the port high, and it can be used as an input port. When used as an input, the pin pulled low by the external device will output current (IIL) due to the internal resistance.
When accessing external program memory or reading external data memory with a 16-bit address (such as executing MOVX @DPTR), port P2 sends the upper eight bits of the address. In this application, port P2 uses a strong internal pull-up to send 1. When accessing external data memory using an 8-bit address (such as MOVX @RI), port P2 outputs the contents of the P2 latch. Port P2 also receives the upper 8-bit address byte and some control signals during flash programming and verification.
P3 port: P3 port is an 8-bit bidirectional I/O port with internal pull-up resistors. The P3 output buffer can drive 4 TTL logic levels. When writing "1" to the P3 port, the internal pull-up resistor pulls the port high, and it can be used as an input port. When used as an input, the pin pulled low by the external device will output current (IIL) due to the internal resistance. P3 port is also used as a special function (second function) of STC89C52, as shown in the following table. During flash programming and verification, P3 port also receives some control signals.
In addition to being a general I/O port, the P3 port also has other multiplexing functions:
RST——Reset input. When the oscillator is working, a high level on the RST pin for more than two machine cycles will reset the microcontroller.
ALE/PROG - When accessing external program memory or data memory, the ALE (address latch enable) output pulse is used to latch the lower 8-bit byte of the address. In general, ALE still outputs a fixed pulse signal at 1/6 of the clock oscillation frequency, so it can output a clock or be used for timing purposes. It should be noted that an ALE pulse will be skipped whenever accessing external data memory.
This pin is also used to input the programming pulse (PROG) during programming of the FLASH memory.
If necessary, the ALE operation can be disabled by setting the D0 bit of the 8EH unit in the special function register (SFR) area. After this bit is set, only a MOVX and MOVC instruction can activate ALE. In addition, the pin will be pulled high slightly, and the ALE disable bit should be set to invalid when the microcontroller executes an external program.
PSEN - Program Store Enable (PSEN) output is the read select signal of the external program memory. When the STC89C52 fetches instructions (or data) from the external program memory, PSEN is valid twice per machine cycle, that is, two pulses are output. During this period, when accessing the external data memory, the PSEN signal will be skipped twice.
EA/VPP——External access is allowed. If the CPU only accesses the external program memory (address 0000H-FFFFH), the EA terminal must be kept at a low level (grounded). It should be noted that if the encryption bit LB1 is programmed, the EA terminal state will be internally latched during reset. If the EA terminal is high (connected to the Vcc terminal), the CPU executes the instructions of the internal program memory. When programming the FLASH memory, the +12V programming enable power supply Vpp is added to this pin. Of course, this must be the device using the 12V programming voltage Vpp.
Design of intelligent security alarm system based on single chip microcomputer
This design proposes an intelligent home alarm system based on STC89C52 single-chip microcomputer to control GSM, which can monitor and alarm the house disaster in real time. The system uses temperature sensor to detect the indoor temperature and display it on the digital tube; uses pyroelectric infrared sensor to detect whether there is illegal intrusion in the house, and transmits the detection data to the single-chip microcomputer, which analyzes and processes the data. If there is any abnormality, it will sound a buzzer alarm and control the GSM system to send information to the owner. The intelligent alarm system can respond to environmental changes in a timely manner to ensure the safety of the home environment.
1. System hardware design
1. Overall system design
The system is based on STC89C52 single-chip microcomputer. The main modules include pyroelectric infrared sensor module, temperature detection module, buzzer alarm module, digital tube display module and GSM SMS alarm module. The overall framework of the system is shown in Figure 1.
2. Temperature detection and display module design
The temperature detection and display module uses the digital temperature sensor DS18B20. The DS18B20 digital thermometer is easy to wire and can be used in a variety of occasions after being packaged. It is wear-resistant and impact-resistant, small in size, easy to use, and has super stability and excellent sensitivity. The temperature detection circuit is shown in Figure 2.
3. Design of pyroelectric infrared sensor module
The pyroelectric infrared sensor module is mainly used to detect whether there is a human body in the room. It is mainly composed of the pyroelectric infrared sensor RE20HDB and the BISS0001 processing chip. BISS0001 is a CMOS type with an independent high input impedance operational amplifier . It can match a variety of sensors for signal processing, effectively suppress the interference of other signals, and has high stability and a wide adjustment range.
If someone enters the scanning range of the pyroelectric infrared sensor, RE200B generates a slight voltage change to trigger the chip. After two-stage amplification by the BISS0001 chip, a voltage of about 3.3 V is generated at the VO signal output end. When no one passes by, the VO end outputs 0 V, and the output voltage is sent to the microcontroller for judgment and processing, thereby realizing human body detection.
4. GSM SMS alarm module design
The GSM module is mainly composed of TC35i, power supply circuit, serial port circuit and GSM protection circuit . The new version of TC35i Siemens industrial GSM module is an industrial-grade GSM module that supports both English and Chinese short messages. It supports SMS sending in both data and voice formats, and the format settings can be achieved through AT commands. The TC35i SMS module is small in size, light in weight, low in energy consumption, and has the advantages of SIM application toolkit and AT command set control. The power supply circuit provides the appropriate voltage for GSM. The GSM protection circuit is used to prevent the supply voltage from being too large.
2. System Software Design
The system uses C and assembly language as programming languages. The system detects indoor environmental conditions through sensors, and transmits the detection data to the single-chip microcomputer, which processes the data and takes corresponding measures. The system program flow is shown in Figure 3. After the system is started, the initialization operation is first performed. In order to display the temperature in time and alarm for illegal intrusion, the system adopts interrupt technology and uses the single-chip microcomputer timer interrupt TO, which interrupts every 500 ms. After turning on the interrupt, the system starts to work. When someone enters, the system calls the GSM SMS sending program and sounds a buzzer alarm. In order to make the alarm effective, the alarm time is delayed by 2 minutes. The flow chart of the GSM SMS sending program design is shown in Figure 4.
3. System Testing
After the system hardware and software design is completed, each module is tested. After the power is turned on, the digital tube can display the current indoor temperature normally, and it changes with the change of indoor temperature, indicating that the temperature detection and display module functions normally; then, whether the human body can be detected is tested. When someone enters the scanning range of the pyro-infrared sensor, the system alarms and sends a short message to the designated mobile phone. When no human body enters, the system does not alarm, indicating that the alarm and short message notification functions are normal. Therefore, the temperature detection, display, alarm and text message sending functions of the system are all normal.
IV. Conclusion
This home alarm system is mainly based on anti-theft and indoor temperature detection. The anti-theft alarm is reflected in sending SMS alarms and driving buzzer alarms. The indoor temperature detection is mainly displayed on the digital tube. The innovation of the whole design lies in the automation and intelligence of the system, which is highly practical. Using simple and practical sensors, integrating sound, temperature, electricity, network information transmission and other technologies, the system is easy to implement. In addition, the design concept of the system provides reference value for the development of smart home, smart security and other systems.
Previous article:WPG Group launches wireless smoke alarm solution
Next article:Design of two intelligent home anti-theft alarm systems
- Popular Resources
- Popular amplifiers
- Mir T527 series core board, high-performance vehicle video surveillance, departmental standard all-in-one solution
- Akamai Expands Control Over Media Platforms with New Video Workflow Capabilities
- Tsinghua Unigroup launches the world's first open architecture security chip E450R, which has obtained the National Security Level 2 Certification
- Pickering exhibits a variety of modular signal switches and simulation solutions at the Defense Electronics Show
- Parker Hannifin Launches Service Master COMPACT Measuring Device for Field Monitoring and Diagnostics
- Connection and distance: A new trend in security cameras - Wi-Fi HaLow brings longer transmission distance and lower power consumption
- Smartway made a strong appearance at the 2023 CPSE Expo with a number of blockbuster products
- Dual-wheel drive, Intellifusion launches 12TOPS edge vision SoC
- Toyota receives Japanese administrative guidance due to information leakage case involving 2.41 million pieces of user data
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- What is the difference between low inertia and high inertia of servo motors?
- Looking for a logic device like 74HC595
- UDP protocol peer-to-peer (P2P) communication (or NAT traversal) example
- CC2640R2F programming learning experience sharing
- TI-TM4C123x learning record: reading high and low levels
- Competition and adventure in digital circuits
- Record the failure of my first dsp project
- Which development board is better for self-learning Linux? What is the complete information?
- 18 kinds of motor step-down starting circuit diagrams [collection]
- Texas Instruments' solutions for sweeping robot systems
- Detailed explanation of the working principle of transformer-how transformer changes the size of AC voltage or current