introduction
With the development of electronic technology, the anti-theft alarm system has evolved from the original simplification and localization to intelligence and integration. At present, the common communication methods of the anti-theft alarm system on the market include fixed-line dial-up and broadband network. However, the alarm implemented by fixed-line dial-up is easy to be damaged and may not be able to alarm when in a call state. Broadband network also faces the risk of line cut-off and is not easy to popularize.
This article proposes a smart home alarm system that uses the reliable and mature GSM mobile network to achieve remote alarm and monitoring in the most intuitive Chinese short message or phone form to achieve security monitoring of the home environment. It uses infrared sensors for detection and is equipped with smoke sensors and gas leak sensors to achieve fire prevention and gas leak prevention. The security system with GSM network function allows users to arm, disarm or query the security system through text messages no matter where they are.
System composition and main functions
The home burglar alarm system mainly consists of a GSM network module, an infrared sensor, a gas leak sensor, a smoke sensor, an ATmega128 microcontroller, an audible and visual alarm, and a Flash memory. The system hardware structure is shown in Figure 1.
Figure 1 System hardware structure diagram
The front-end sensors of the system mainly include anti-theft, fire prevention and gas leakage prevention sensors. They are selected and installed in appropriate places according to needs to collect illegal intrusion and danger signals and transmit them to the single-chip microcomputer; the single-chip microcomputer is responsible for receiving and processing sensor signals to determine whether there is any danger. The single-chip microcomputer continuously detects various sensor signals. If a high level is detected, the system controls the GSM network module to realize short message alarm, and sends the alarm information to the user's mobile phone through the GSM service network. At the same time, the sound and light alarm is activated to send the corresponding alarm signal as needed. If the community network has been realized, the alarm information will also be sent to the community security office of the network center; the household owner can also turn on the *microphone on the host by sending a text message to further confirm whether there is any danger at home. This system can effectively achieve the purpose of anti-theft and alarm.
System hardware design
ATmega128 Functional Features Description
This system uses Atmel's AVR microcontroller ATmega128 as the control core. ATmega128 is an 8-bit low-power CMOS microprocessor based on AVR RISC structure. Due to its advanced instruction set and single-cycle instruction execution time, the data throughput of ATmega128 is as high as 1 MIPS/MHz, which can alleviate the contradiction between power consumption and processing speed of the system. ATmega128 has the following features: 128K bytes of in-system programmable Flash, 4K bytes of EEPROM, 4K bytes of SRAM, 53 general-purpose I/O lines, 32 general-purpose working registers, real-time clock RTC, 4 flexible timers/counters (T/C) with comparison mode and PWM function, two USARTs, byte-oriented two-wire interface TWI, 8-channel 10-bit ADC (with optional programmable gain), programmable watchdog timer with on-chip oscillator, SPI serial port, I2C, JTAG test interface compatible with IEEE 1149.1 specification, and six power saving modes that can be selected by software.
GSM module structure and communication interface
The GSM module uses Siemens industrial-grade GSM module TC35i, which can quickly and safely implement the short message service (Short Message Service) in the system solution. The TC35i module is mainly composed of six parts: GSM baseband processor, GSM radio module, power supply module, flash memory, ZIF connector, antenna interface, etc. It has a compact design, greatly reducing the product size, is compatible with GSM2/2+, and complies with ETSI standards GSM0707 and GSM0705. The module's operating voltage is 3.3~4.8 V, compatible with dual-band (GSM 900/GSM l800) operation, and has an RS232 data communication port. The module integrates radio frequency circuits and basebands, provides users with a standard AT command interface, and provides fast, reliable and secure transmission for data, voice and short messages. TC35i has 40 pins led out through the ZIF connector.
Since the RS232 level of the PC does not match the level of the TC35i, the serial communication of the TC35i follows the RS232 standard, so the connection and communication between the PC and the TC35i can be realized through the serial port level conversion circuit MAX232. In this system, the ATmega128 microcontroller and the TC35i communicate through the serial port. Both ATmega128 and TC35i are TTL levels. The operating voltage range of ATmega128 is 2.7~5.5V, and the operating voltage range of TC35i is 3.3~4.8V. They can be directly connected by adding resistors, but generally they must be connected through the interface circuit. The interface circuit is implemented with the 7407 buffer/driver chip. The interface circuit is shown in Figure 2.
Sensor selection and interface circuit
The security functions such as anti-theft, fire prevention, and gas leakage prevention must be realized by installing corresponding sensors. For the anti-theft sensor, this design uses an infrared reflective sensor.
Install the infrared reflective sensor on both sides of the door and window or in the passage. When someone enters, the infrared reflective sensor will detect it and send a high level to the microcontroller to start the anti-theft alarm system. The infrared reflective sensor can even form a detection system for opposite beams to increase the control range. The interface circuit structure of the infrared reflective sensor and the ATmega128 microcontroller is shown in Figure 3.
This design uses semiconductor gas sensors as gas leak sensors. It detects gas by using the changes in physical properties such as conductivity produced when the gas to be tested contacts the surface of a semiconductor (mainly metal oxides). In addition, this design uses an ion smoke sensor (NIS-09C), which is widely used in various fire alarm systems and has better performance than gas-sensitive resistor fire alarms.
Storage Components Introduction
In order to store preset telephone numbers, record alarm information, and store Chinese and English character dot matrix, this system uses an off-chip Flash memory AT24C1024 that can ensure that data is not lost when power is off. This chip is an I2C bus memory. Data communication with the MCU only requires two pins, SDA and SCL. Compared with the usual parallel memory, it can greatly save the MCU's port pin resources and PCB wiring area. The I2C flash memory and the single-chip microcomputer interface circuit are shown in Figure 4. AT24C1024 uses a two-wire protocol serial bus (I2C bus) and its transmission protocol for bidirectional transmission.
GSM SMS sending principle and process
AT commands are used to operate TC35i, which includes the control of GSM voice and short messages. In order to support Chinese text messages, this design uses PDU mode to send and receive text messages, and Chinese characters use hexadecimal Unicode encoded characters. The text message module sends text messages controlled by AT commands. There are two formats of text messages sent: text format and PDU format. The former can only send characters and letters, while the latter can send characters, letters and Chinese characters. In order to make it easy for users to read the content of text messages, this article chooses to use PDU format. The transmission uses 8 data bits and 1 stop bit, no parity bit, and the baud rate is 19200bps. The basic commands for sending short messages are as follows:
1. Set the short message service center address AT+CSCA="+8613753485894" (Taiyuan)
2. Set the short message sending format (0-PDU, 1-text) AT+CMGF=1;
3. Send a short message (the content of the short message is "test") AT+CMGS="13753485896" (destination address) >test^z
4. List all short messages AT+CMGL=
"ALL"
5. Read the content of the short message (Once more), assuming INDEX=6, AT+CMGR=6
6. Delete short message AT+CMGD=
The implementation process of the short message sending system is shown in Figure 5. First, the serial port is initialized, and the AT command is used to check whether the GSM module is successfully connected. If the single-chip computer detects the high level of infrared, gas leakage, smoke and other sensors, the corresponding high level information is encoded according to a certain encoding method, and then the PDU format data is generated according to the short message center number, the destination user number of the short message, the encoding method and the short message validity period. Finally, the AT command [AT+CMGS] is used to send the short message to the user's mobile phone.
System software design
The software design of the system is written in C language of AVR series microcontroller. The software part focuses on the detection of sensor alarm signals and the control of TC35i SMS module. The flow chart of the system main program and interrupt program is shown in Figure 6. The system first initializes the serial port, interrupt and TC35i SMS module of the microcontroller. The ATmega128 microcontroller continuously detects the I/O port of the remaining sensor interface circuits. When the switch value of the sensor is detected to be 1 (high level), it means that an alarm is needed. The interrupt is opened to enter the interrupt processing subfunction. The interrupt processing subfunction completes the sending of short messages for corresponding anti-theft, fire prevention, gas leakage and other events, and starts the sound and light alarm at the same time. By using ATmega128 to send a series of AT commands to the TC35i GSM module through UART0 serial communication, the sending, receiving, searching and management of short messages based on GSM can be realized.
Figure 6 Main program and interrupt program flow chart
in conclusion
This paper discusses the design and implementation of a short message anti-theft alarm system based on ATmega128 and TC35i, proving that it is completely feasible to use TC35i short messages for alarm. The system overcomes the defects of traditional sound and light alarms and provides users with a convenient and practical home anti-theft alarm system. This design has the advantages of simple implementation, low cost, wide application range, safety and reliability, and has broad application prospects. By adding or reducing functional modules and modifying the microcontroller firmware, monitoring and anti-theft systems for other occasions can be produced, such as car anti-theft, warehouse anti-theft liquid level alarm, etc.
Previous article:Closed-loop linear speed control system based on single-chip microcomputer and rotary encoder
Next article:Simple sine wave control of brushless DC motor based on XC866
- Popular Resources
- Popular amplifiers
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- 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
- I have published some theoretical articles before. Today I will simulate and verify the real theoretical data.
- SensorTile.box Sound Control LED Brightness
- Automobile complete vehicle EMC testing, complete vehicle electromagnetic compatibility testing, automobile parts EMC testing
- Motor control video FOC sensorless
- Interrupt controller of C6678 developed by DSP
- Apply for free evaluation: Anxinke WiFi + Bluetooth audio development board ESP32-Audio-Kit!
- [Dry goods sharing] Lithium battery power supply circuit design (boost, charging management, etc.)
- [Register now, see you in Guangzhou on February 25, 2019! ] World Peace Group WPI / GDSM Visual Retail Summit
- Thank you for being there +2019
- What are the high frequency characteristics of capacitors?