CHEMICAL ENGINEERING TRANSACTIONS VOL. 51, 2016 A publication of The Italian Association of Chemical Engineering Online at www.aidic.it/cet Guest Editors: Tichun Wang, Hongyang Zhang, Lei Tian Copyright © 2016, AIDIC Servizi S.r.l., ISBN 978-88-95608-43-3; ISSN 2283-9216 Real-time Monitoring System of Hazardous Chemicals Based on 6LoWPAN and WLAN Guoqiang Hu Network and Education Technology center, Northwest A&F University, Yangling Shaanxi, China hgq@nwsuaf.edu.cn To ensure the safe storage and use of lab hazardous chemicals, this paper designs and develops a 6LoWPAN and WLAN-based hazardous chemicals monitoring system. This system, consisted of 6LoWPAN sensing nodes, edge router, IPv4/IPv6 network and user terminal, adopts 6LoWPAN protocol to realize point- to-point communication between wireless sensor network (WSN) and internet. It transmits collected lab environment information to remote upper machine software through IPv4/IPv6 protocol, with a view to achieving real-time monitoring and abnormal data warning in terms of lab indoor temperature, humidity, CO density, CO2 density and hazardous gases (ammonia gas, aromatic compounds, sulfides, benzene vapors) density. This paper details the hardware framework and software framework realization process of this system, and finally based on Laboratory Virtual Instrument Engineering Workbench (LabVIEW), develops the upper machine management software for hazardous chemicals monitoring system. Experiment results show that this system can accurately obtain monitoring data and warn against abnormal data, so it meets the monitoring requirements for lab environment. 1. Introduction Chemical lab is the major place for teachers and students to carry out experiment researches and activities as well as a paradise of students for experiment and innovation, invention and creation. Normally, there is certain amount of hazardous chemicals stored in it. With increasing accidents of poisoning, fire and explosion in colleges and universities in recent years, immeasurable damages have been caused. Hence, it is very important to conduct safe management of hazardous chemicals in chemical labs, which have already become a research topic that has attracted a lot of attention from lab management personnel. If comprehensive monitoring over the storing environment information of hazardous chemicals in lab and harmful gases generated in the process of use is realized, then accidents can be significantly reduced or even avoided, thus ensuring the safe storage and use of hazardous chemicals in labs (Jie, 2010). At present, some experts and scholars at home have conducted researches on storage environment monitoring of hazardous chemicals (Amaro et al., 2014; Dohare et al., 2015; Pérez-Garrido et al., 2014), but most of them focus on utilizing certain technology to realize monitoring over chemicals transportation, use and storage, with few applying 6LoWPAN sensor network into the environment monitoring over hazardous chemicals in chemical lab. 6LoWPAN network is a new-type WSN developed by IETF 6LoWPAN team based on standard IEEE 802.15.4 and using 16-bit short address to realize IPv6 communication (Li et al., 2015). 6LoWPAN features strong adaptability, easiness to develop, enormous IPv6 addresses, ready connection to IPv4/IPv6 network and easy utilization of IP network technology for development. 6LoWPAN protocol has been applied into open source system Contiki and Tinyos. Users can control sensing nodes through visiting IPv6 addresses configured by the nodes. To meet the needs of lab safe management, this paper proposes one type of lab hazardous chemicals monitoring system based on 6LoWPAN and WLAN. This paper applies 6LoWPAN network and WLAN technology into the perception and monitoring over lab environment data. Users can obtain real-time environment data like lab indoor temperature, humidity, CO density, CO2 density and harmful gases density, timely discern abnormality, and take effective measures to ensure the safety of teachers and students. DOI: 10.3303/CET1651024 Please cite this article as: Hu G.Q., 2016, Real-time monitoring system of hazardous chemicals based on 6lowpan and wlan, Chemical Engineering Transactions, 51, 139-144 DOI:10.3303/CET1651024 139 2. System Design 2.1 System main functions (1) As for the perception and transmission of information about lab environment and harmful gases, terminal users can monitor through PC or mobile phones, thus realizing real-time observation of environment information about storage and use of hazardous chemicals. Data visit of monitored lab environment can be divided into on-site and remote types, namely on-site monitoring by lab personnel and remote control by lab management centre. (2) As for point-to-point data visit and control, users can not only realize real-time monitoring over lab environment information, but also exercise control over sensor nodes. (3) Timely warning is given against lab environment information abnormality and out-of-limit harmful gases density. (4) Record and query of lab environment information and harmful gases information are conducted. 2.2 System overall framework The system can be divided into three parts according to function modules. (1) 6LoWPAN network: it is consisted of 6LoWPAN sensing nodes and 6LoWPAN edge router for collecting environment data or execute specific operations according to back-stage orders. (2) Transmission network: IPv4/IPv6 network is used for perceiving remote transmission of data. Lab personnel can directly visit 6LoWPAN network through WLAN to timely obtain lab environment data. (3) Database server and lab management centre monitoring personnel. Specific design is as shown in Figure 1. Edge Router Laboratory management center staff Laboratory management center staff IPv4/IPv6 Database server Experimenters WSN node based on 6LoWPAN WLAN Figure 1: Overall system architecture diagram 6LoWPAN wireless sensor network is consisted of sensor nodes with different functions, with each node being able to be equipped with IPv6 addresses and adopt tree-shape networking mode. 6LoWPAN wireless sensor network relies on edge router to transmit monitored data to IPv4/IPv6 network, so users can realize point-to- point communication through IPv4/IPv6 and sensing nodes. Database server is used to record obtained lab environment data, sensor node IP addresses as well as service categories (Wei and Zhou, 2015), while other users can also obtain lab environment information through visiting database server. 3. System Hardware Design 3.1 Hardware Design of sensor nodes Sensor node is consisted of RF transceiver, microcontroller unit (MCU) and sensing unit. Sensing unit connects to sensor node in the perceived environment through pin, detailed design as shown in Figure 2. 140 This research selects wireless MCU (ARM Cortex-M3) that supports Bluetooth Smart, ZigBee and 6LoWPAN as well as the remote control application of ZigBee RF4CE. This MCU, with a clock speed of 48MHZ, can program flash memory within 512 as well as 32KB RAM (SRAM). RF transceiver adopts CC2538 radio frequency chip that supports 2.4G as well as standard IEEE 802.15.4 PHY and MAC. There are two major functions to sensor nodes: (1) Sensing unit sends lab environment information perceived to MCU for processing, after which it is sent to edge router through RF transceiver. (2) Sensor node receives data package from router through RF transceiver, and then MCU sends order to sensing unit after processing. MCU ARM Cortex-M3 UART serial port JTAG interface FLASH SDRA M R eset circu it C lo c k circu it P o w e r su p p ly circu it RF transceiver Sensing unit Figure 2: Sensor node hardware frame 3.2 Hardware design of edge router The primary function of edge router lies in connecting WSN and IPv4/IPv6 network so as to realize the streamlining of protocol stack and the re-transmission of data package by router. 6LoWPAN network receives internet data package from WIFI mode, and MCU first streamlines the data package and then send it to wireless sensor network through RF transceiver. In the same way, 6LoWPAN edge router receives streamlined data package sent by sensor node from RF transceiver, and MCU restores the streamlined data package into a complete one and then send the data in the package to IPv4/IPv6 network through WIFI module. Edge router is mainly consisted of RF transceiver, MCU and WIFI module as shown in Figure 3. MCU ARM Cortex-M3 UART serial port LAN interface FLASH SDRA M R eset circu it C lo c k circu it P o w e r su p p ly circu it RF transceiver WIFI module Figure 3: Edge Router hardware frame 141 The hardware configuration of RF transceiver, MCU and WIFI module hardware configuration adopted by edge router is as follows: (1) RF transceiver: NRF24L01 adopts single transceiving chip and supports IEEE 802.15.4. It has the in-built 2.4 GHz antenna, with a highest work speed of 2Mbps; the SPI interface speed is 0-8Mbps; there are 125 work channels to be selected; 20 pins of QFN4*4MM sealing is also available. (2) MCU: ARM 32-bit Cortex™-M3 CPU ;72 MHz maximum frequency;256 to 512 Kbytes of Flash memory; up to 64 Kbytes of SRAM; Up to 2 × I2C interfaces (SMBus/PMBus); Up to 5 USARTs (ISO 7816 interface, LIN, IrDA capability, modem control), Up to 3 SPIs (18 Mbit/s);2 with I2S interface multiplexed; CAN interface (2.0B Active); USB 2.0 full speed interface. (3) WIFI module: it supports 802.11 b/g/n; the frequency range is 2.4GHz-2.5GHz (2400-2483.5M), the work voltage is 3.0-3.6V, with data interface UART. 4. System Software Design 4.1 Software framework design of wireless sensor node Both wireless sensor node and 6LoWPAN edge router are transplanted into Contiki operation system [15]. Contiki is a set of internet open source operation system, connecting the micro controller network featured by low cost and low consumption. It is an open source multi-task operation system realized by C language and based on event driven, using the light-weight protothreads process model, and able to provide a linear programming function similar to threads on event driven core (Sheu et al., 2016), thus boasting a high portability. The Contiki system-based 6LoWPAN sensor node software framework can be designed into three layers, namely transmission layer, protocol layer and application layer as shown in Figure 4. Transport layerSend data Receive data Dynamic routing Streamly UDP/IPv6 protocol layer Query or control command Sensory data Execution status Application layer Figure 4: Sensor node software frame The functions of transmission layer in Fig.4 lie in sending and receiving data, i.e., sending the data received from RF transceiver interface to protocol layer for processing and forwarding the data received from protocol layer to RF transceiver. The functions of protocol layer lies in receiving data from transmission layer, judging whether destination addresses of data have joined or leaved network, received or abandoned other nodes, and controlling routing search and data transmission, etc. The application layer receives datagrams from protocol layer, and the transfers them received into specific service categories, such as query into service request or control service request. It will execute relevant processing switches based on requests and submit status information of service results to protocol layer for processing (Wang and Yin, 2010). 4.2 Software framework design of edge router Software framework can be designed into transmission layer and protocol layer as shown in Figure 5. As shown in the Fig.5, the functions of transmission layer include: Transport layerSend data Receive data Dynamic routing UDP/IPv6 protocol layer Simplify packetrestore packet Figure 5: Edge Router software frame 142 (1) Receiving datagrams from RF transceiver and then submitting them to protocol layer for processing. (2) Receiving datagrams from protocol layer and send them out through WLAN interface or connection to IPv4/IPv6 network (Wang XN and Yin XD, 2010). The function of protocol layer is to re-send datagrams to next node through transmission layer according to routing table information after receiving them from transmission layer. 4.3 Design of upper machine software and database server The upper machine software of hazardous chemicals monitoring system is based on the graphical programming language LabView (Liu et al., 2016). In consideration of the single type of data and limited collected data amount, this paper adopts Access database. Upper machine and management database are divided into parameter display, data query and alarming processing according to function modules. This system mainly realizes communication between WSN and upper machine, monitoring over sensor node as well as query and derivation of historical measurement data. The implementation processes are as follows: (1) Install LabVIEW development environment and design man-machine interaction interface. (2) Establish Access database, with data collected by upper machine being stored in Access database in forms. (3) Use LabSQL database to visit tool package and access to Access database. LabSQL uses Microsoft ADO object and database query language to realize the access to database. Out of the considering of saving energy, User Datagram Protocol (UDP) is adopted for transmitting data. The system adopts IP address plus port number to mark different perception services. In initializing the sensor nodes in the system, information including IP address configured by sensor nodes and service categories provided by sensors is registered in IP marked database server. Lab management centre users get the positioning of IP address and service category of front-end sensor nodes through upper machine management software, and obtain environment perception parameters or send control orders for remote control through visiting front-end sensor nodes by IP address. 5. System Test This system was tested in the chemical lab of Northwest Agriculture & Forestry University. In the lab, one sensor node was set up randomly, and temperature and humidity sensor, CO2 gas sensor, CO gas sensor were connected to the pins of the sensor node, with the drivers corresponding to the three sensors being written into Contiki system. Edge router was 5m away from the sensor node, up-linking the WLAN of the university. Upper machine software was installed in the testing PC, which was able to communicate with WSN through WLAN. After power connection, 6LoWPAN sensor node and edge router started to work, and users sent request every 6s through upper machine management software to obtain four kinds of environment data. The upper machine was switched on. Without setting upper or lower limit to parameters, the results were as shown in Figure 6. There was alarming for all four types of environment parameters monitored. Figure 6: System test results without setting parameter ranges After parameter setting, upper machine was re-switched on, but there was no warning, test results as shown in Figure 7. Experiment results have verified that this system can accurately obtain perceived environment parameters and control environment parameters within the range of setup. 143 Figure 7: System test results in the range of normal parameters 6. Discussion This paper utilizes 6LoWPAN wireless sensing network to send the lab environment data and harmful gases data to IPv4/IPv6 network through WIFI module so as to make users in the local or foreign areas access to them readily. This paper for the first time applies 6LoWPAN sensor network into lab hazardous chemicals monitoring, realizing all the functions of the system designed. Following researches will focus on the energy- saving of 6LoWPAN sensor network. 7. Conclusion To enhance the safe management of lab, this paper proposes one type of lab hazardous chemicals monitoring system based on 6LoWPAN wireless sensor network, which directly connects to IPv4/IPv6 network through WIFI module in edge router, hence realizing mutual communication between 6LoWPAN network and IPv4/IPv6 network as well as remote obtainment of lab environment data and control over sensors by users. Test results show that this system can obtain real-time lab environment information and harmful gases information; hence its practicability is verified. Reference Amaro J.P., Rui C., Ferreira F.J.T.E., & Landeck J., 2015, Device and operation mechanism for non-beacon ieee802.15.4/zigbee nodes running on harvested energy, Ad Hoc Networks, 26, 50-68, DOI: 10.1016/j.adhoc.2014.10.016 Dohare Y.S., Maity T., Das P.S., & Paul P.S., 2015, Wireless communication and environment monitoring in underground coal mines – review, Iete Technical Review, 32(2), 140-150, DOI:10.1080/02564602.2014. 995142 Jie S.L., Gao F., 2010, Safety Application and Management of dangerous chemicals in the university laboratory, Chemical Journal, 11:64-67, DOI: 10.3969/j.issn.1002-154X.20l0.11.018 Li H., Wang H., Yin W., Li Y., Qian Y., & Hu F., 2015, Development of a remote monitoring system for henhouse environment based on iot technology, Future Internet, 7(3), 329-341, DOI:10.3390/fi7030329 Liu G., Hu L.Q., Zhong G.Q., Pu N., 2016, LabVIEW-Based Radiation Monitoring System of EAST, Journal of Fusion Energy, 35(2): 470-481, DOI: 10.1007/s10894-015-0054-x Pérez-Garrido C., González-Castaño F.J., Chaves-Díeguez D., & Rodríguez-Hernández, P. S., 2014, Wireless remote monitoring of toxic gases in shipbuilding. Sensors, 14(2), 2981-3000, DOI: 10.3390/s140202981 Sheu J.P., Hsu C.X., Ma C., 2016, A Game Theory Based Congestion Control Protocol for Wireless Personal Area Networks, Journal of Sensors, 2016: 1-13, DOI: 10.1109/COMPSAC.2015.21 Wang X.N., Yin X.D., 2010, Agricultural environment real-time monitor and control system based on 6LoWPAN sensor networks, Transactions of the Chinese Society of Agricultural Engineering, 10: 224-228, DOI: 10.3969/j.issn.1002-6819.2010.10.038 Wei Y.D., Zhou W.X., 2015, Design and implementation of smart appliances monitoring and control system based on 6LOWPAN, modern electronic technology, 14: 101-104+108, DOI: 10.3969/j.issn.1004- 373X.2015.14.0 144