Tuesday, February 22, 2011

PIC16F87X microcontroller based fire alarm system design

File format: HTM file sizes:

Publishing company: embedded online official website:

Introduction

Fire alarm system is all necessary security system network, reliable monitoring and data transfer is the system very important link.

Past fire alarm system often data conflicts on the bus, the long-distance data transmission and no extensions unreliable, as in recent years a number of low price, high-performance MCU is widely applied to various circuit system, especially in circuit control, these issues have been improved.

This system uses United States chipscreen company running speed, low power consumption and driving ability strong PIC16F87X series monolithic integrated circuit, as the system circuit logic control, bus listening, and data read and send units, reliable data monitoring, as well as long-range transport issues, you can accurately remotely monitor fire stations.

Hardware design

System hardware circuit design

System basic works as shown in Figure 1.

Sensor output current signal after current conversion voltage circuit into a voltage signal, then the signal amplifier the signal into suitable for analog to digital converters (A/D) of the input signal, the final results will be fed into the digital sampling PIC16F87X microcontroller, analysis of the data is the fire effect has been reached.

If there is fire from the analysis, the first bus to listen, when bus "idle" time you read an external ROM MCU immediately prior to store good information about indoor all data (including alarm device drop location), and then sends the data and these important data to a remote monitoring system of departments of liquid crystal display LCD, final output continuous pulse signal by driver driving alarm Horn to alert monitor has a fire hazard.

Sensor and its peripheral circuit design

The system uses sensors to HS series carbon monoxide electrochemical gas sensors to determine potential electrolysis as a basic principle.

When the carbon monoxide into gas sensor, its output produces a current output, the chemical energy into electrical energy. When the carbon monoxide gas concentrations change, gas sensor output current is proportional to the change.

Sensor measuring range: 0-1000ppm

Output current: 4010nA/ppm

Working pressure: 1atm 10%

The current signal is converted to a voltage signal is introducing a resistor R1, 0 ~ 40mA of current signal is converted to 0 ~ 4V voltage signal, and then make amplification filtering.

Figure OPA637 received into a voltage follower, its input impedance is high, you can reduce the effect of diverting R1. OP07 received into operational amplifier circuit, you can adjust the size of the Rf to changing operational amplifier-loop gain, to adjust in order to adapt to the A/D input voltage range.

PIC16F87X properties

PIC16F87X is chipscreen (Microchip) at the end of 1998, the company launched the products, the use of the Harvard bus structure, single-byte instruction, addressing the simple, streamlined RISC technology, only 35 of the directive.

It runs fast, low power consumption, driving ability, have USART module and MSSP module, is strong, there is no other way to decrypt copy directly. It's a great feature is the chip with 64, 128 or 256 bytes EEPROM data memory, the program memory is a Flash-memory, the memory can be wiped directly on the circuit board/write program.

PIC16F87X and external conspiracy-memory ROM hardware connections

In the select external memory ROM, because you want to install the alarm by SCM will install location for all the important information is written to the external storage, you must use the larger SRAM ROM to write as much of the information and data is lost after loss.

When a fire occurs, SCM immediately in its transposition RA0 mouth simulation out CLK clock and input to the external memory ROM CLK pin, RA1 mouth to mouth send read command SI, last read from memory SO output is already saved data, and to immediately apply these data into the remote monitoring system of departments on the monitor.

In considering the PIC and the system selected external serial memory AT25F1024 pin connection, since the power supply to PIC16F87X V CC = 5V, output level for CMOS, i.e. about 5V output, low level of approximately 0V.

But its input for TT L-level, and the supply voltage to about 2.7V ~ 3.6V AT25F1024, its V 0.6V ~ LL in? 0.3V CC V IH in between, CC ~ 0.7V V CC + 0.5. So if you set the microcontroller and ROM directly connected, when output to the microcontroller ROM, this value would exceed the threshold values of input ROM, and now it is possible to unrecognized data or burning storage tube feet. However, the output can be directly AT25F1024 and single-chip, because the PIC Microcontroller input for TTL level, so you only need to consider the input interface level ROM matching issues. Similarly, input and output current is analysis. In order to resolve the problem, the interface-level match many possible methods: using the dividing resistors divider, through the tertiary canals and the role of switching CMOS and other suitable chip to adjust the voltage, etc.

In the design of the

Circuit, because the divider circuits are easy to implement, as shown in Figure 3, the first thing to consider using a resistor divider are appropriate level for serial ROM, after debugging is available for data communication. This circuit structure is simple and does not require too many electronic components, but generally used in this case.

In order to achieve better communication results.

As shown in Figure 4, this circuit chip select gate, the gate 74LVC04A supply voltage between the 1.2V ~ 3.6V, can and an external ROM use the same power, its pin high level voltage input range in 2.0V ~ .5V, low level input to 0V or so to identify single chip CMOS output level. The output voltage is the power supply voltage, low level voltage is approximately 0V or so, you can concatenate two 74LVC04A gate will SCM output signal is converted to accurately identify AT25F1024 input voltage, which improves the accuracy of the data transmitted.

Avoid the bus design of conflict

In this structure, in order to guarantee the correct and effective long-distance data transmission, use the switch tube RF634 to increase the capacity of the driver circuit, at the receiving end using the comparator LM393 to fix signal, and a back-end connections to NAND 7406 restore the original signal.

When a node needs to use a bus, in order to achieve the bus communication and reliable, the data needs to be sent to listen on the bus.

In the hardware interface, will alarm Terminal chip data send pin TX and INT0 interrupt pin connected to, and will receive pin RA2 mouth as, through the drive circuit and starting listening of SCM RA3 pin are connected. Alarm terminal network of SCM in sending data before you probe whether the RA2 mouth to maintain a high level of input. If so, then the bus "busy" and wait for the master side release bus; if not, then the bus "idle", you can send data. Because the master side in sending data but also data passed to the INT0 interrupt pin, the role of SCM since listening to receive data through its RA3 mouth to alarm all SCM network to broadcast communication send high level 1.

Alarm terminal network of SCM in ever INT0 interrupt pin query whether there is a level change, and query the RA2 receive port is a high level of input.

If the SCM RA2 estuary have high level input and another interrupt-level changes, continue to send data; if only the RA2 estuary have high level input INT0 interrupt PIN did not however level change, said its detection into the bus is "busy", the question to produce complete communication controlling party bus control, and then let it be bus control, so you better solve the conflict of the bus. In this way, the system has no master, slave nodes, all nodes on the bus use right is equal, thus effectively prevent the individual node communication burden heavier. Bus utilization and the efficiency of the system is to enhance communication, thereby allowing the system to respond in real-time to improve. Moreover, even if the system of individual node fails, it will not affect the other node's normal communication and work properly. This makes the system of "dangerous" spread, to some extent, enhance system reliability and stability of the work.

In the query or low level of INT0 pin changes, use a timer to periodically TIMER0, in a fixed time query whether there is a high and low INT0 pin level changes.

To avoid the sending of data has a continuous 1 or 0, INT0 PIN when it is sent without the high and low level changes, leading to the master side stops sending data.

System software design

Software key processes are as follows:

1) alarm terminal program: complete system initialization work, begin to start converting ADCs sends a signal to begin the work, the data will be converted and the concentration of carbon monoxide in the air (known data), if their concentration is much larger than the concentration of carbon monoxide in the air, there is fire, otherwise, continue with the conversion and comparison.

When the judgment of fire occurs, the first bus to listen, if testing to the bus data transfer, then wait for the bus free, if it has not detected, you immediately from the external ROM read data in the data sent.

2) listen circuit MCU program: determine whether there is data received, if it has data reception, you can send data to a remote terminal, and at the same time output for alarm unit MCU RA2 estuary.

3) data display program: determine whether there is data received, if so, you initialize the LCD, data is written to the LCD displays information.

The final output continuous pulse signals for driving alarm Horn.

Conclusions of the

PIC16F87X microcontroller based alarm network system, its simple circuit, low power consumption, power requirements of a single, high accuracy, system monitors a wide range of conflicts with detection bus function, you can remotely monitor the system displays the location of the fire and the important information.

The system reduces possible fire losses, easy to expand to a second monitor to monitor more alarm system network, in the petrochemical industry, aviation, coal, and other fire-prone areas, have practical value.

This article uses Haina sharp editing and reprint, copyright the original author.

No comments:

Post a Comment