Smart Home Alarm System Based on LabVIEW

Using LabVIEW to make a smart home alarm system PC software, very fun, although the function is not much, the structure is simple, but the technology used is very important for people learning LabVIEW.

First, post the picture on the front panel. The frame format sent by the MCU to the host computer is: 0x0A + 3 bytes of temperature data + 0x0B + 4 bytes of smoke density data + 0x0C + 1 byte of the switch gate signal (total of 11 bytes), sent porter The rate is 9600 and the transmission period is 200ms. The host computer acquisition software reads 11 bytes of data from the serial port buffer every 10ms (that is, the queue cycle on the front panel), and then parses and displays it.

Smart Home Alarm System Based on LabVIEW

Figure 1 screenshot of the front panel of the software (click on the image to see the larger image)

Then, the block diagram will be shown to everyone.

Smart Home Alarm System Based on LabVIEW

Figure 2 Serial port configuration and serial port receive/transmit program diagram (click on the image to view larger image)

As shown in Figure 2, VISA reads 11 bytes of data from the serial port buffer every 10ms, and then sends the data to the serial port receive data queue. Here is the loop structure of the producer-consumer model. The read serial port uses the producer loop structure, and the parsing data uses the consumer loop structure.

Smart Home Alarm System Based on LabVIEW

Figure 3 program diagram of data analysis and data display (click on the image to view larger image)

As shown in FIG. 3, the consumer loop is used to parse the data, and the temperature value, the smoke concentration value, and the switch gate signal are respectively parsed and displayed according to the three attribute bytes 0x0A, 0x0B, and 0x0C, and the waveform display uses a waveform chart. The temperature value can be displayed by a thermometer, and the smoke concentration can be displayed by the pointer type instrument panel, and the display effect is intuitive and generous.

Smart Home Alarm System Based on LabVIEW

Figure 4 program diagram of the sound alarm part (click on the image to view larger image)

As shown in Figure 4, the program diagram of the audible alarm part, the upper part is the temperature alarm program, the alarm sound duration is 2 seconds, the alarm sound frequency is 3KHz; the lower part is the smoke concentration alarm program, the alarm sound duration is In 1 second, the alarm sound frequency is 1KHz. Since the audible alarm lasts for 1~2 seconds, if the alarm program is placed in the big loop that parses the data, the execution of the large loop will be delayed by 1~2 seconds. Therefore, the alarm program must be raised. Write it separately, making it into two separate threads.

The above is the introduction of the software, the software still has some small BUG, ​​for example: Sometimes after starting the software for the first time, the data frame read by the serial port is not 0x0A + 3 bytes of temperature data + 0x0B + 4 bytes The smoke concentration data +0x0C+1 bytes of the switch gate signal, through the probe I see the 1-byte switch gate signal +0x0A + 3 bytes of temperature data +0x0B + 4 bytes of smoke concentration data + 0x0C, the switch gate signal went to the beginning of the frame, and the phenomenon of frame breakage occurred. This result is caused by setting the serial port to read 11 bytes each time. When the number of bytes in the serial port buffer is greater than 11, the ending will occur. Therefore, the serial port buffer area needs to be cleared after the software is turned on. And the rate required to read the serial port is greater than the rate at which the microcontroller sends data.

3 times
Window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "2", "bdMiniList": false, "bdPic": "", "bdStyle": " 0", "bdSize": "24" }, "share": {}, "image": { "viewList": ["qzone", "tsina", "tqq", "renren", "weixin"], "viewText": "Share to:", "viewSize": "16" }, "selectShare": { "bdContainerClass": null, "bdSelectMiniList": ["qzone", "tsina", "tqq", "renren" , "weixin"] } }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share. Baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];

Aluminum Embossed Coil

Embossed Steel,Embossed Aluminum,Aluminum Embossed Coil,Embossed Aluminum Sheet

SHAOXING YOTO IMPORT&EXPORT CO., LTD , https://www.sxyotoes.com