Introduction
With the rapid development of China's economic construction and the great improvement of people's living standards, people pay more and more attention to whether their environment is safe. Especially when there is no one at home or only the elderly and children, the safety of family members' lives and property is increasingly valued. Therefore, home anti-theft has become an important social issue. At present, the security of many residential areas mainly relies on traditional mechanical (anti-theft nets, anti-theft windows) anti-theft systems. This not only hinders the appearance, does not meet the requirements of fire escape, but also cannot effectively prevent the invasion of bad people. With the rapid development of electronic technology, the anti-theft alarm system has urgently developed from the original simplification and localization to intelligence and integration. At present, GSM short message service has been used as a basic service of GSM network. It is applied to the home wireless anti-theft alarm system based on the connection between GSM SMS module and single-chip microcomputer, making home anti-theft more timely and convenient, and directly reflecting the situation of the crime scene on the user's mobile phone screen in the most intuitive Chinese short message form. At the same time, a pyroelectric infrared sensor is used for detection, changing the tangible traditional anti-theft net and anti-theft window into an invisible monitoring, providing the most intuitive, efficient and reliable guarantee for home anti-theft.
1 Overall design and working principle of the system
The design block diagram of the GSM SMS alarm system is shown in Figure 1. The entire system [1] consists of an STM32 microcontroller module, a pyroelectric sensor module, a GSM module and a traditional speaker module. The GSM module uses the SIM900A chip and peripheral design circuit produced by SIMCom, while the pyroelectric sensor module uses the design circuit of the infrared dedicated chip BISS0001. First, when the pyroelectric sensor module detects the infrared light emitted by a person, it converts it into a voltage signal through its peripheral amplifier circuit and transmits it to the STM32 microcontroller. The microcontroller judges the data sent by the pyroelectric sensor module and sends a high level to the GSM module through the serial port, so that the GSM module sends a text message to the set mobile phone number, notifying the owner of what has happened at home in time,
and at the same time making the speaker sound an alarm, thereby realizing the expected function of the system. However, when the owner is at home during the day, there is no need to set the anti-theft function and
the function can be turned off; if the owner is leaving the house or sleeping at night, the protection function needs to be turned on. These "arm" and "disarm" functions can also be turned on and off by sending specific text messages to the GSM module through a mobile phone, and the pyroelectric sensor detection will take effect to avoid unnecessary trouble and false alarms.
Figure 1 System overall block diagram
2 System Hardware Circuit Design
2.1 STM32F103 Minimum System
The STM32 series of microcontrollers [2] produced by ST are designed for embedded applications that require high performance, low cost, and low power consumption. The STM32 used in this system is an interconnected product with the following standard functions: 72MHZ main frequency, 56k bytes of Flash, 64 bytes of SRAM, 2 watchdogs, multiple 16-bit timers, 80% of the pins can be used as general-purpose I/O ports, and communication peripherals such as USART and SPI. Its peripherals fully meet the functional requirements of this system. Therefore, this system uses STM32F103 as the main controller, and its minimum system is shown in Figure 2.
This system uses a 4-wire JTAG interface, namely TMS (test mode selection), TCK (test clock), TDI (test data input), TDO (test data output), and a conventional 20-pin interface. It can be connected to a PC through an emulator to achieve online simulation debugging, which is convenient and reliable. The system uses an 8MHZ crystal oscillator, and a load circuit needs to be connected at this time. In addition, the reset circuit is designed in a simple way, which can achieve reliable system reset.
Figure 2 STM32F103RBT6 minimum system [page]
2.2 GSM Module
The GSM module [3] uses SIM900A produced by SIMCom. It is a compact GSM/GPRS module with SMT packaging, STE-based single-chip design, ARM926EJ-S architecture, powerful performance, and support for AT commands. The GSM MODEM is
controlled by the STM32 serial port. The microcontroller and the GSM module generally use a serial asynchronous communication interface. The communication speed can be set, usually 19200bps. The GSM MODEM and the microcontroller use serial communication. The TXD and RXD of the MODEM are the transmitting and receiving ends, respectively, and are connected to the PA10 and PA9 of the microcontroller to form a serial communication. The GSM module is powered on by pulling the PWRKEY signal low for a period of time and then releasing it. When the module is powered on, AT commands can be sent to control the module. Users can set the baud rate and save the parameters through "AT+IPR=x". Once configured to a fixed baud rate, the character "RDY" will be received from the serial port when the module is powered on. These characters cannot be displayed when the automatic baud rate is activated. Similarly, the module can be shut down by pulling the PWRKEY signal low for a period of time and then releasing it. Or use the AT command "AT+CPOWD=1" to shut down the module. This command deregisters the module from the network, puts the software into a safe state, saves useful data, and then completely disconnects the power supply. Before shutting down, the module serial port will automatically send the following string "NORMAL POWER DOWN", after which AT commands cannot be executed. The module enters power-down mode, and only the RTC is active. The power-down mode can be detected by the STATUS pin, which outputs a low level in power-down mode. The GSM main module (including the SIM part) is shown in Figure 3.
Figure 3 GSM main module (including SIM part)
2.3 Pyroelectric sensor module
The pyroelectric sensor module [4] includes a pyroelectric sensor and a peripheral amplifier circuit. When a person enters the range that the sensor can detect, the sensor detects the energy change and converts it into a weak electrical signal. The signal is then amplified by the peripheral amplifier circuit and converted into a voltage signal and transmitted to the single-chip microcomputer. Its working principle is as follows: the human body has a constant body temperature, generally 37 degrees, so it will emit infrared rays with a specific wavelength of about 10um. The passive infrared probe works by detecting the infrared rays of about 10um emitted by the human body. The infrared rays of about 10um emitted by the human body are enhanced by the Fresnel filter and then focused on the infrared sensing source. Experiments have shown that the detection distance of the sensor without a Fresnel lens is less than 2m, but after adding a Fresnel lens, the detection distance can be increased to about 10m. The infrared sensing source usually uses a pyroelectric element. When the temperature of the human body changes, this element loses its charge balance and releases the charge to the outside. After subsequent circuit detection and processing, it can generate an electrical signal and send it to the single-chip microcomputer for processing.
The schematic diagram of the pyroelectric BISS0001 module is shown in Figure 4. In the figure, the operational amplifier OP1 (inside the chip) amplifies the output signal of the pyroelectric infrared sensor in the first stage, and then C104 couples it to the operational amplifier OP2 (inside the chip) for the second stage amplification. After being processed by the bidirectional amplitude detector composed of voltage comparators COP1 and COP2, the effective trigger signal Vs is detected to start the delay timer, and the output signal Vo is amplified by transistor T1 to drive the relay to connect the load. CDS1 is a photoresistor used to detect the ambient illumination. When used as a lighting control, if the environment is brighter, the resistance value of CDS1 will decrease, keeping the input of pin 9 at a low level, thereby blocking the trigger signal Vs. JP1 is the working mode selection switch. When the JP1 jumper cap jumps to port 2 or 3, it is connected to port 1, and the chip is in a non-repeatable triggering working mode. In this working mode, even if there is human activity in the detection area, the module will automatically stop outputting for a period of time (blocking delay) and then detect again. This working mode is generally called pulse output; when the JP1 jumper cap jumps to port 1 or 2, it is connected to port 2, and the chip is in a repeatable triggering working mode. As long as there is someone in the detection area, the module will always have output. This mode is generally called level output. In addition, the output delay time Tx is adjusted by the size of the external R33 and CY2, and the trigger blocking time Ti is adjusted by the size of the external R13 and CY1. The module uses a low-power voltage regulator 7133A-1, which can ensure a stable supply of 3.3V working voltage under a wide input voltage to ensure that the module can work normally.
Figure 4 Schematic diagram of pyroelectric module
2.4 Power Supply
The power supply module is divided into two parts: the MCU power supply module and the GSM power supply module. The MCU power supply adopts a typical power supply design scheme, as shown in Figure 5. Among them, C9 and C10 are bypass capacitors, which play a role in suppressing interference, while C11 and C12 are electrolytic capacitors, which play a role in filtering; generally, a small capacitor is connected in parallel next to a large capacitor to reduce the high-frequency internal resistance, because large electrolytic capacitors are generally manufactured using a winding process, so the equivalent inductance is relatively large; small capacitors can provide a high-frequency channel with a small internal resistance, reducing the full-band internal resistance of the power supply. This circuit is more common in practice.
Figure 5 Power supply circuit
The SIM900A module is powered by a single power supply with VBAT of 3.4V to 4.5V. Since it is different from the operating voltage of the microcontroller, it is powered by a separate power module, as shown in Figure 6. The VBAT output voltage of 4.2V is used by the GSM module.
Figure 6 GSM module power supply
[page]
2.5 Speaker
The speaker part mainly includes a relay. When the corresponding port of the microcontroller is set to a high level, the relay is driven, so that the speaker circuit is connected and a sound is emitted to serve as an alarm.
3 System Software Design
3.1 AT Commands
AT command set is sent from TEC (Terminal Equipment) or DTE (DataTerminal Equipment) to TA (Terminal Adapter) or DCE (DataCircuit Terminating Equipment). AT commands are sent through TATE to control the functions of MS (Mobile Station) and interact with GSM network services. Users can use AT commands to control calling, SMS, phonebook, data services, supplementary services, fax, etc. The following are some common AT commands related to short messages:
At present, Text and PDU (Protocol Data Unit) modes are commonly used to send short messages. The code for sending and receiving text messages using Text mode is simple and easy to implement, but the biggest disadvantage is that Chinese text messages cannot be sent and received; while PDU mode not only supports Chinese text messages, but also English text messages. Therefore, PDU mode is used here to send and receive text messages. There are three encodings that can be used to send and receive text messages in PDU mode: 7-bit, 8-bit and UCS2 encoding. 7-bit encoding is used to send ordinary ASCII characters, 8-bit encoding is usually used to send data messages, and UCS2 The encoding is used to send Unicode characters. The module integrates RF circuit and baseband, provides a standard AT command interface, and provides fast, reliable and secure transmission for data, voice, short message and fax.
First, use the command "AT + CMGF = 0
08 91 68 31 08 40 17 05 F0 11 000D 91 68 31 49 17 87 90 F6 00 08 00 06 4F60597D0021.
3.2 System program main flow chart
The main flow chart of the system program is shown in Figure 7. The system is initialized first, and then detects whether it is armed. Because the single-chip microcomputer uses AT commands to control the GSM module and transmit data. AT commands are written in the AT command format supported by the GSM module and sent out through the serial port of the single-chip microcomputer. Therefore, the "arming" and "disarming" of this module can be done in the following ways: If the module is set to the minimum function mode by the command "AT+CFUN=0", the RF function and the SIM card function are turned off. In this case, the serial port can still be used, but the AT commands related to the RF function and the SIM card function cannot be used. This is the disarming state. When the module is set to the minimum function by "AT+CFUN=0", the module can return to the full function mode by the command "AT+CFUN=1". This is the armed state. Once "armed", the system works normally. If the single-chip microcomputer detects that someone enters through the pyroelectric module, it immediately sends a high level to the GSM module through the serial port, causing the module to send a text message to the owner, and the speaker sounds an alarm.
Figure 7 System program main flow chart
4 Conclusion
The system has the following features: Since the system is equipped with "arming" and "disarming" functions, false alarms can be avoided; at the same time, the speakers and software in the system cooperate to quickly and effectively play the alarm role; in addition, with the help of advanced, stable, mature and efficient GSM mobile network, the alarm system is more intelligent and integrated, and the alarm method is more intuitive and reliable; finally, other functions can be developed according to the actual needs of the family, such as adding cameras, etc., to make the system more perfect.
In short, due to the reasonable design of the system structure, the application of STM32 microcontroller and GSM module technology, the good functional circuit, the good and stable system performance, and the good achievement of various indicators of home anti-theft requirements. Moreover, the system has low cost, strong practicality and operability, has certain application value, and can be widely used and developed.
Previous article:Coal Gangue Sorting System Based on ARM and CAN Bus
Next article:Design of intrinsically safe power supply for mines based on STM32
Recommended ReadingLatest update time:2024-11-16 15:26
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Circuit Design of Robot Positioning System Based on MSP430
- Schedule of the 2019 National Undergraduate Electronic Design Competition
- [NXP Rapid IoT Review] +1. Data preparation, first look at NXP Rapid IoT
- Is this the Keil5 that STM32 needs?
- Upload two photosensitive detection circuits. The target detects different voltages according to different light exposure. Which one is correct?
- MSP430F149, HC_SR04 distance measurement
- MM32F103 BUG reminder to avoid pitfalls
- Will MakeCode support Python?
- What are the specific differences between triodes and MOS tubes?
- How to set the GND pin of a separate component as a flower pad in PADS?