# Carbon Oxides Gases for Occupancy Counting and Emergency Control in Fog Environment
## 1 Introduction
Fog Computing spreads communication and computing resources over the wireless access network which is capable of providing the resource augmentation to resource and energy-limited wireless devices [11]. In the view of this merit of Fog, we design the emergency control and occupancy counting application in a Fog Computing environment. Human occupancy information is important for modern Building Management Systems (BMSs). Ideally, heating, ventilation and air conditioning within a building or a room should be adjusted according to the number of people so as to reduce energy consumption and costs. Furthermore, by knowing the human occupancy in a room at a certain time, the building manager is able to monitor and guide people to appropriate rooms instead of letting them search one by one. Moreover, the human occupancy information is crucial during emergency situations such as fire breakouts. It can help firefighters in implementing rescue operations. Despite the requirement in counting the number of people, many buildings are not equipped with adequate devices to estimate human occupancy. Installing cameras allows security officers to monitor people in real time, although this may raise privacy concerns. Thus, large amounts of inexpensive, low-energy sensors with convenient networking capabilities are needed in the design of an intelligent BMS. There are a number of standards and technologies for WSNs, which typically include WiFi (IEEE 802.11), IEEE 802.15.4, and Bluetooth Low Energy (BLE). Wi-Fi can provide higher data throughput and range. It is widely used to access networks but it consumes more energy which is a common disadvantage across WSNs. By contrast, IEEE 802.15.4 was specifically designed to work with low power, low data rate, and it has a low cost. In contrast, a similar protocol, ZigBee, enriches IEEE 802.15.4 by adding network, security layers and an application framework, offering a scalable architecture with end-to-end IPv6 networking [14]. Another important technology is Bluetooth. Traditional Bluetooth can only consist of seven active slaves, which limits the scale of WSNs. The BLE is intended to reduce power consumption and costs while extending the communication range. Although different types of technologies have been designed for WSNs, in this paper we simulate the ZigBee environment as it has been used in many practical applications, such as smart power switches or door locks. Various sensors can be used for estimating the number of people or for detecting a fire breakout. Despite almost all modern buildings being equipped with smoke alarms, these can only issue a warning after the fire has started to expand. We prefer to monitor an environment which may have abnormal changes, and take action before the smoke density exceeds the threshold. The most popular device for counting people is the passive infrared (PIR) motion sensor. However, this type of sensor is only able to detect motion in an area instead of human occupancy, which means that the head count of the people would correspond to one reading [15]. In [16], the authors also compared the accuracy of occupancy in an office when using single (0.201), double (0.978) and triple (0.999) PIR sensors. Thus, in order to estimate the occupancy with reasonable accuracy, the number of PIR sensors may increase. As opposed to PIR sensors, gas sensors detect content changes in real time. As humans exhale carbon dioxide, gas diffusion makes the concentration relatively balanced, especially in an enclosed space. In addition, we choose carbon oxides gas sensors for occupancy detection because of two other reasons: (1) we want to use gas concentration to estimate human occupancy approximately; (2) we intend to monitor gas concentration and trigger an alarm before a fire breakout occurs since carbon oxides gas content changes significantly when there is a fire. Actually, this is not the first attempt at counting people using carbon oxide sensor data. [PERSON] et al. [17] pointed out that there is a correlation between CO\({}_{2}\) and occupancy.