Design of an IoT based Real Time Environment Monitoring System using Legacy Sensors

. This paper describes the design of an operative prototype based on Internet of Things (IoT) concepts for real time monitoring of various environmental conditions using certain commonly available and low cost sensors. The various environmental conditions such as temperature, humidity, air pollution, sun light intensity and rain are continuously monitored, processed and controlled by an Arduino Uno microcontroller board with the help of several sensors. Captured data are broadcasted through internet with an ESP8266 Wi-Fi module. The projected system delivers sensors data to an API called ThingSpeak over an HTTP protocol and allows storing of data. The proposed system works well and it shows reliability. The prototype has been used to monitor and analyse real time data using graphical information of the environment.


Introduction
Earth's environment determines wellness and sustainability of all the living beings. The factors of physical environment, like temperature, humidity, air quality, light and rain have significantinfluence on people's health, living habits and surroundings. These are also linked with the different facets of environment. Environmental health and the soundness of a human habitat for safe living is crucial from many aspects. Its monitoring is critical. Only about 3% of world's geography is the cities are occupied by 50% of world's populations and this amount of populations generate about 80% of carbon dioxide emission [1]. Apart from this, the said factors have significance influence on the agriculture field and related domains [2,3]. Over the years, the proliferation of wireless devices have given rise to internet of things (IoT) which enables connection of systems and interchange of data between them. The recent developments and the popularity of IoT are linked to the possibility of it application for real time monitoring . This aspect is the basis of the design of the proposed system based on IoT for monitoring of certain environmental parameters such as temperature, humidity, air pollution, sun light intensity and rain which is found to be reliable and efficient. Traditional methods to study parameters such as temperature, humidity, air pollution, sun light intensity and rain take longer time, higher cost and often prove to be unreliable. Further, such monitoring may always not be done in a unified platform. With the penetration of mobile communication network to the remote areas, IoT based real time monitoring of environmental parameters such as temperature, humidity, air pollution, sun light intensity and rain has turned out to be an efficient and cost effective solution. If the above mentioned environmental parameters are properly monitored using an integrated system, it will have many applications like agriculture for observing the healthy growth of crops, in industries to ensure the safe working environment in industries as well as healthy life in cities. IoT has been widely evolving for the creation of smart environment, smart cyber world and smart application [4]. Various IoT based application has been reported such as pollution monitoring, waste management, water quality, security etc [5][6][7][8][9][10][11]. This work emphasize on simplicity, low cost and data control.

Proposed System
The proposed prototype is summarized using a block diagram as shown in Fig.1. The system consists of sensor networks, control and processing unit and a web server which can store data and provide necessary tools for analysis. The base of the system is built up using an Arduino UNO board which provide control and processing with the help of ATmega 328 microcontroller. The sensor networks consist of various sensors to sense key environmental parameters such as temperature, humidity, air pollution, sun light intensity and rain. The Arduino directly communicate with the individual sensor and collects necessary data. Once data are available, it performs a series of processes and transfers the data to the server via a Wi-Fi module (ESP8266). The sensors that are configured and are used for monitoring real time data of the environment are DHT11 (Temperature & Humidity Sensor),MQ135 (gas sensor), KG004 (rain drop sensor) module and RES-0276 light dependent resistor (LDR). On the server side, we have chosen an API platform which provides support for various graphical analysis tools such as MATLAB, Google Gauge etc. These tools enhance the analysis and visualization capabilities and provide a better graphical user interface.

System Design and Implementation
The primary focus of this work is to design an IoT based monitoring system which keeps track of environmental parameters such as temperature, humidity, air pollution, sun light intensity and rain. The design works in real time and captures the data for analysis. The description covers the creation of sensor networks, electronic device, the functional software requirements, programming and development process, the implementation and testing as well as the end-product of the prototype. The details of the different constituent blocks are included in the subsequent paragraphs.

A. Sensor Network Design-
The only way to get the real sense of the various environmental parameters is through the use of the sensors. The design of the sensor network is crucial part of the system as the end user would rely on data provided by these sensors only. Correctly designed and accurately calibrated sensor network will serve the purpose. The sensors used to measure various environmental parameters have been listed in the Table1. The DHT11 Sensor provides a temperature and humidity readouts with a calibrated digital signal reading. It uses the digital signal acquisition method for temperature MQ135 gas sensor is sensitive to benzene,alcohol,smoke etc. This sensor is composed of a micro AL 2 O 3 ceramic tube, tin dioxide (SnO 2 ) sensitive layer, measuring electrode and heater are fixed into a crust made by plastic and stainless steel net. The heater confers necessary work conditions for work of sensitive components. The enveloped MQ135 has 6 pins, 4 of them are used to fetch signals and other 2 are used for providing heating current [12]. Resistance value of MQ135 is different for various kinds and concentration gases. So, when using this component, sensitivity adjustment is very necessary. For this, calibration of the detector is needed.
The rain sensor module KG004 is a cost effective sensor and it works through a series of exposed parallel traces on board which produces electrical variations when drops or water volume changes.
For sensing the light intensity of the sun, the LDR has been used. An LDR is a resistive sensor whose resistance changes with the light intensity that falls upon it. This allows them to be used in light sensing circuits. The resistance of this decreases with increasing incident light intensity. The four mentioned sensors are connected to the digital inputs 7 and analog inputs A2, A0 and A1 of the Arduino UNO R3 board respectively. Fig. 2 shows the connection terminals that exist in the system.

B. Programming Environment & Development Process
The microcontroller in the Adruino board is programmed with the Adruino IDE for connecting to the sensor network, reading their data and finally for sending these data over Wi-Fi network after pre-processing. For storing the data on the server side ThingSpeak platform has been used. ThingSpeak is an open source IoT application and API to store and retrieve data from things using the HTTP protocol over the Internet or via a Local Area Network (LAN). The complete steps that has been followed for successful transmission of sensor values described by the flowchart as in fig. 3. The services or information in the servers are provided through the Internet that are connected through LAN and made available for users via smart phones, web browser or other web browser devices to make the system more intelligent, adaptable and efficient. The ThingSpeak platform has been integrated with MATLAB and can be performed MATLAB based data analysis. ThingSpeak has got its own toolbox in MATLAB. The ThingSpeak public channel has been used to analyse and visualize collected data with the built-in "Analysis" and"Visualizations" MATLAB apps.

Results and Discussions
In this section, we discuss about the experiments performed and the results derived.

Experimental Results
With an aim to check the reliability of the design, the IoT based monitoring system, certain experiments are performed and results derived. The results derived are presented here and the performance of the system is also analysed. The connections are made as explained above and the setup is exposed to the environmental parameters under test to determine the levels of temperature, humidity, rain, light intensity and pollutant gases. The captured data are all passed to the server using wi-fi links which has already been explained. The device runs a measurement after every 15 seconds and sends the data to the server. Fig. 4 shows the embedded system with the sensors connected for reading environmental parameters and the ESP8266 Wi-Fi module to send parameter values and store in the storage cloud which is available for sharing. After successful completion of sensing, the data is processed and stored in database for future reference. After completing the analysis on data the threshold values will be set for controlling purpose. Fig. 5 shows a desktop view of the sensors data accessed through a browser. The parameters that are seen in the browser are the state of the humidity, temperature, amount of rain, light intensity and level of CO 2 gas value at the time while the experiments are performed. At present, the gas sensor has been calibrated particularly for CO 2 gas. The list of the data appeared as the data has been recorded at the interval of 15 second. Now these data have been storing in cloud and can be used for the analysis of the parameter and continuous monitoring purpose.

Analysis and Visualization
The ThingSpeak support communication with MATLAB environment that enable use of desktop tools to analyse and visualize data stored on ThingSpeak.com. ThingSpeak is integrated with MATLAB, so code can be run right from the server side. Fig. 6 shows the histogram of temperature variation for a 10 hour period. The variation can be checked for any period of time. Here variation was checked over last10 hours of data, from the time of running the code. The X-axis plots the temperature in degree-Celsius and Y-axis plots the number of measurements for each temperature. Similarly, histogram data is also studied for the humidity variation as shown in the fig.7. The results are reliable and show very little variation despite making continuous reading for 24 hours and with repeated resets. Fig. 8 shows the variation of CO 2 in two different environments. The experiment was performed in open fresh air and indoor room air having considerable number of people. Fresh air CO 2 level are usually in the range 350-400ppm while maximum safe indoor level is up to 1000 ppm [13]. From the figure it can be clearly seen the result.

Conclusions
In this paper, we have presented the design, implementation and testing of a low cost IoT based environment monitoring system. The description covers the details of monitoring of various parameters of the environment using an IoT based system and remotely accessing the data through the internet. The data  received during the experiments and the analysis proves that such IoT based platform is reliable for environment parameter monitoring. Apart from its low cost and low power, it provides operational efficiency and flexibility than traditional wired methods. The system occupies very less space and hence can be installed anywhere. In the future work, the sensors would be calibrated for more harmful gases such as ammonia, oxides of nitrogen, carbon mono oxide etc. Further system would be modified to react via notifications, phone calls or SMS when certain parameters reach beyond certain permissible level.