Therefore, we use the STC89C52 microcontroller as the core controller of the alarm, select the DS18B20 temperature sensor to detect the ambient temperature, and select the MQ-2 smoke sensor to detect the smoke information. We have designed an alarm device that can detect fire hazards and alarm in time, which plays an extremely important role in safety protection in modern intelligent buildings.
1 Overall system design
The system uses the STC89C52 microcontroller as the main control chip, the DS18B20 temperature sensor to collect temperature, the MQ-2 smoke sensor to collect smoke information, and converts the collected smoke concentration information into an analog electrical signal. The analog signal is converted into a digital signal recognizable by the microcontroller through a voltage comparator and then sent to the microcontroller. The microcontroller then processes the signals collected by the temperature sensor and the smoke sensor, and analyzes the processed data, so that the voice chip can make corresponding alarms.
The system structure is shown in Figure 1.
2 System Hardware Design
2.1 Selection of MCU
In the design of fire alarm, the microcontroller is its core component. On the one hand, it receives the temperature and smoke signals sent from the sensor, and on the other hand, it analyzes and processes these two signals respectively to control the voice alarm circuit to perform corresponding actions. This system requires the microcontroller to have the characteristics of fast computing speed, strong anti-interference ability and low power consumption. Based on many aspects of comparison, the STC89C52 microcontroller produced by Hongjing Technology Company was selected as the core of the control system. STC 89C52 is a low-power, high-performance CMOS 8-bit microcontroller. STC89C52 uses the classic MCS-51 core and has made many improvements on its basis. The instruction code is fully compatible with the 8051 microcontroller. No special programmer or special emulator is required, and it can be directly downloaded using the serial port. Compared with the traditional 51 microcontroller, 89C52 has higher comprehensive performance. Its main parameters are: the clock frequency can reach up to 80 MHz, built-in 8 kB flash, 512B RAM and 2KB EEPROM; 3 16-bit timers/counters; a 6-vector secondary interrupt structure.
2.2 Design of temperature acquisition module circuit
This system uses the DS18B20 digital temperature sensor, which can realize 9-12-bit digital temperature direct reading through programming: the temperature range is -55~125℃, with a maximum resolution of 12 bits. At -10℃~85℃, the accuracy can reach 0.5℃, and the over-limit temperature alarm can be set; the field temperature is directly transmitted in a digital way of "one-line bus", which greatly improves the anti-interference ability of the system. The temperature acquisition circuit of this system is shown in Figure 2. The single bus DQ of the DS18B20 temperature sensor is connected to the P3.7 port of the STC 89C52 microcontroller, and the STC89C52 microcontroller reads and writes the DS18B20, thereby realizing the storage and reading of data by the microcontroller.
2.3 Smoke alarm module design
The design of the smoke alarm module uses the MQ-2 smoke sensor. The MQ-2 smoke sensor not only has the advantages of wide detection range, high sensitivity, fast response recovery, simple driving circuit, and long life, but also can detect fire and gas leakage. It is a sensor that can detect a variety of combustible gases, is widely used, and has low cost. In addition, the gas-sensitive material used by the MQ-2 smoke sensor is tin dioxide (SnO2) with low conductivity in clean air. When there is combustible gas in the environment where the sensor is located, the conductivity of the sensor increases with the increase of the concentration of combustible gas in the air. A simple circuit can be used to convert the change in conductivity into an output signal corresponding to the gas concentration. In this design, the 4-pin output of the MQ-2 sensor changes with the smoke concentration. The DC signal is added to the 2-pin of the comparator LM393, and R6 and VCC constitute the threshold voltage of the comparator. When the smoke concentration is high and the output voltage is higher than the threshold voltage, the comparator outputs a low level, and the LED lights up to alarm; when the concentration decreases and the output voltage of the sensor is lower than the threshold voltage, the comparator flips to output a high level, and the LED goes out. By adjusting R6, the threshold voltage of the comparator can be adjusted, thereby adjusting the sensitivity of the alarm output. The smoke alarm module circuit is shown in Figure 3.
2.4 Voice Alarm Circuit
The STC89C52 microcontroller P1.2, P1.3, and P3.0 control the smoke, temperature, and smoke and temperature alarms respectively. WT588D uses a one-line serial port mode. When the temperature is too high and exceeds the warning temperature, the P1.2 pin level is pulled low, triggering the voice WT588D chip to issue a "Temperature is too high, please check" sound. Similarly, when the concentration of combustible gas exceeds the limit value, P1.3 is set to a low level, and the WT588D voice chip alarms. The voice alarm circuit is shown in Figure 4.
3 System Software Design
3.1 System Software Design Process
The fire alarm system controller uses STC89C52 as the main control chip, and its main functions include: controlling I/O ports, logic judgment processing, driving external circuits, voice alarms, etc. This program is an infinite loop, and its process is: first, after power-on, the various parts of the system, including the setting of the output and input ports of the single-chip microcomputer, the data storage circuit, the peripheral drive circuit, etc., are initialized, and the digital tube displays the current ambient temperature. Next, the data acquisition program, fire temperature judgment, and alarm judgment of the fire alarm system and smoke alarm system are executed. After the system is initialized, P1 of STC89C52 is high, P1.2, P1.3, and P3.0 are high, and the voice chip does not alarm.
The main functions implemented by the program initialization part include the setting of various I/O input and output states, register initialization, interruption, temperature and smoke data collection program, fire judgment and alarm program, etc. The system program flow chart is shown in Figure 5.
3.2 Data collection program design
Data collection is an important part of the fire alarm system. In order to reduce the false alarm rate, the system design adopts a cyclic collection and cyclic judgment method for temperature and smoke. After each temperature and smoke data is collected, the data is stored in the register of the microcontroller. Then, in the fire judgment program, the collected data is compared with the set threshold to determine whether a fire has occurred at the scene.
The specific process is: after the system and program are initialized, DS18B20 is driven to collect temperature signals. The microcontroller receives the converted data and stores it in the register, which is completed by the INT1 interrupt service program; the system delays 10 ms and stores it in the register after the conversion is completed. The system delays 50 ms to collect temperature and smoke signals and stores the converted data in the register. Wait for data information collection, read the converted data through the interrupt service program, and issue a voice alarm when the temperature is too high or the smoke concentration exceeds the standard.
Since the design adopts modular design, the system realizes the alarm function by calling subroutines. In the data acquisition subroutine, the temperature and smoke signal acquisition delay is 10 ms. After the system acquires the temperature and smoke signal, the converted data is stored in the register of the microcontroller, and the system calls the fire judgment subroutine.
4. Physical system
The actual system is shown in Figure 6.
5 Conclusion
The fire alarm system with STC89C52 single chip microcomputer as the core can realize voice alarm, temperature display, alarm limit setting, delayed alarm and other functions. It is a fire alarm with simple structure, stable performance, easy use, low price and intelligence, and has certain practical value.
Previous article:Pulse meter and heart rate meter based on single chip microcomputer
Next article:Design of emergency call system in ward based on single chip microcomputer
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- 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
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- KEILC51 embedded assembly method
- Micron's New Year's Lucky JD E-Card is waiting for you to draw
- About JLink automatic firmware update problem
- On the feasibility of the traditional brake transformation of stepper motor
- Isolated Buck Converter PCB Layout Tips
- How GaN helps cable providers find the balance
- TI DaVinci Technology
- Award-winning review: Mir Allwinner automotive-grade CPU development board MYC-YT507
- [Evaluation of Anxinke Bluetooth Development Board PB-02-Kit] A/D data acquisition and testing
- MSP430 and ATK-NEO-6M GPS module