1 Introduction

The air pollution can be defined as the contamination of air that is inhaled with dust particles and harmful gases. With the advancement in modern technological industries, the request of people for a better living has been increased but dealing things in a wrong way results in increased air pollution, which is affecting the human health very badly. Air pollution is causing severe health problems that are asthma, chronic obstructive disease and congestive heart failure. According to National Institute of Environmental Health Science (NIEHS), risk of respiratory illness has been increased due to the exposure to air pollutants. The environment pollution is still increasing gradually despite the efforts of government. A number of solutions are available in the literature to control and monitor environmental pollution. The examination uncovers that there is a necessity of a sensor based embedded system that can screen and control the air contamination with generation of challan from anyplace in the world using IOT. In this paper an embedded system prototype has been designed on the concept of an internet of things that uses sensors and actuators around Raspberry Pi board. In this system a unique feature of automatic challan generation has also been included that shut down the engine automatically and generate a challan with proper notification to the owner of vehicle.

2 Literature Review

Gas sensors are used to detect the concentration of air pollutants in the air. A device called gas sensor, which detects gases and generates voltage or current. When the concentration of gas increases, the output voltage from the gas sensor also increases. Various technology uses various type of sensors. A solid state gas sensor is one of them [1]. There are various solid state sensors: solid-electrolyte type, capacitor type and semiconductor type sensor. Under different conditions, these sensors are capable of sensing gas and maintaining stability. Semiconductor gas sensors are used to detect the inflammable and toxic gases in air. A semiconductor gas sensor depends on a gas that comes in contact with surface made of metal oxide and then performs either oxidation or reduction. Either conductivity or resistivity of gases changes from a known baseline value on absorption or desorption of the gases on the metal oxide surface. This change in conductivity or resistivity of the electronic circuitry can be measured. To detect and minimize air pollution various technologies and systems have been developed in literature. WSN i.e. Wireless sensor networks based on IOT is one of them. LIDAR is a very different technology that is identified in [2]. A system is developed using LIDAR technology to detect fog. For detecting the size of an object similar as wavelength or larger, a concept is used that is LIDAR instrument. A short wavelength light like UV or near IR has been used in this instrument. For detecting pollution in the air and fog recognition, this technology has been used that consists of a front camera and a laser scanner. The laser light pulses are sent using LIDAR at the surface and calculate the return time of each pulse. Ground, rain, snow, dirt, fog and spray are then detected. IOT based different systems are explained in [3,4,5]. With the help of IOT, different physical devices share their data on server that results in availability of more data and analysis can be done in a better way. Shah et al. make use of a WSN for sensing and monitoring information using hopping methods. Subsequent data monitoring and recording is done in PC through GUI which is developed in LabVIEW. Similarly, Fuertes et al. [4] make use of arduino platform and various sensors to monitor the data. This system has been developed to work efficiently in real time environment. Rushikesh et al. developed a system in which RFID reader and tags are used. It detects the pollutant value of every motor vehicle and the database is used to store this information. For further analysis, the observations are sent to the internet server [5]. For the air pollution monitoring, wireless sensor networks are used very frequently in literature [6, 7]. Khedo et al. [6] used Air Quality Index and RCQ algorithm for data Aggregation based on an innovative concept of WAPMS. Al-Haija et al. developed a WSN based system in which sensors and arduino platform have been used to monitor the air pollution. This system makes available real time data of the contamination of various gas contaminants exist in air [7]. Raju et al. developed a system in which an array of sensors are used to detect the percentage of pollution and then the observed concentrations are converted to corresponding electrical signal for further processing. This system has been used effectively to perform analysis in Vishakhapatnam [8]. To transmit the observed data by the sensors over a long distance, the Wi-Fi technology has been gaining popularity. The usage of Wi-Fi has been increased but at the same time the node life time has been affected with increase in power consumption [9]. In surgery rooms, the LED based technology is used for sensing various gases. The same concept can be incorporated in the industries [10]. Verma et al. has made use of Raspberry pi and wifi technology to connect to the home network through which the home appliances can be accessed from any place the world. A phpscript has been used for creation of web portal in which the inputs are provided by the user for controlling the appliances. Python language has been used to configure the Raspberry pi [11]. After performing this literature survey, it has been concluded that the basic concept of all the systems is same i.e. detecting different pollutants, then sending them onto the server for further analysis and then major steps can be taken. The difference lies in the platform and technology used. A comparative analysis of different systems has been done with the proposed system as represented in Table 1.

Table 1 Comparison with existing systems

3 Proposed System

The block diagram of sensor based pollution monitoring system is represented in Fig. 1. The system is divided into two parts viz. embedded section and cloud section. The embedded section consists of Raspberry pi, sensors and actuators whereas the cloud section demonstrates the application of Thingspeak cloud platform and our own designed web server. The Thingspeak cloud platform is only used to monitor the level of the harmful gases whereas our own designed web server shows the ppm level of gases as well as the driver can also submit the challan in case of excess threshold levels. The Raspberry pi is not having on board ADC that leads us to use externally ADS1115 chip, which is a 16 bit ADC. This is required because MQ2 is an analog sensor. The complete system requires the internet connectivity that is given by a WIFI adapter. A DC motor with its driver (L293D) is employed to show the analogy of a moving vehicle. The LCD is used to show the ppm levels and is mounted on the dashboard of the vehicle with a buzzer to create repeated warnings for the driver.

Fig. 1
figure 1

Block diagram of the proposed system

3.1 Hardware Description

Raspberry Pi 2 It is a pocket size low cost CPU board that is popular for developing IOT applications nowadays. It includes Broadcom BCM2836 Arm7 Quad Core Processor having operating frequency of 900 MHz with 1 GB of RAM. There are 40 extended GPIO pins, four USB ports and a micro SD port for loading operating system and storing data with several others on board features.

MQ-2 Gas Sensor This sensor is used for detecting gases like LPG, hydrogen, propane (Smoke), alcohol etc. The proposed system is utilizing this sensor for detecting smoke, LPG and carbon oxide in a vehicle. These types of sensors are used for fast response time, high sensitivity stability and long life.

LCD Display The proposed system is utilizing a 16 × 2 44,780 LCD developed by Philips. The LCD is connected in 8 bit data transfer mode with raspberry pi. The concentration of gases being emitted by the vehicle is shown on to this LCD connected at the dashboard of the vehicle.

LB Linkwireless USB Adapter The proposed system is using a wireless USB adapter from LB link having model BL-WN151. It is useful for identifying wifi devices and networks at a distance of 100–300 m in indoor and outdoor environments from the device to which it is connected. The Raspberry pi used in the proposed system is not having on board wifi adapter. So, it creates the necessity to use a wireless USB adapter that allows fast and high quality internet connections at a data rate of 150 Mbps.

L293D Motor Driver IC To demonstrate the analogy of a vehicle movement, a DC motor is employed in the proposed system. This motor is operated on 12 V power supply with 1 A current requirement. A L293D motor driver IC is connected in between the Raspberry pi and DC motor that fulfils this current requirement as raspberry pi port pins can output only 22 mA of current.

ADS1115 ADC Due to the fact that raspberry pi board does not have on board ADC creates a requirement of an external analog to digital convertor. The proposed system utilizing the ADS115 ADC interface chip for connecting MQ2 gas sensor and provides digital output to raspberry pi for processing. This chip is I2C compatible and having 16 bit precision with four single ended channels available for connecting four different analog sensors.

3.2 Working of Proposed System

The proposed system can be installed in any moving vehicle that is responsible for air pollution in the environment. However, the authors designed the system by keeping in mind the model of a car. Accordingly, the installation of the system is as follows: the MQ2 gas sensor is mounted at the exhaust pipe through a wire that is routed up to the raspberry pi, which is behind the dashboard. The LCD and buzzer are mounted at the top of dashboard and connected with raspberry pi through wires. The DC motor with motor driver IC is just making an analogy of movement of vehicle in proposed prototype of the system. In actual vehicle, in place of a motor, a relay is connected whose output is used to ON/OFF the engine as per the ppm level of gases.

Figure 2 shows the working flow of the entire system. All the components are powered using the existing battery system of the car. The acceptable ppm levels of CO, LPG and smoke are already fixed in the python code. When vehicle gets turned on, the MQ2 sensor starts calibrating. Once sensor has been calibrated, it senses the ppm level of gases and displays them on to the LCD screen and as well send on to the web page via internet. The driver can easily monitor the ppm level of the gases on LCD. Whenever the ppm level of the gases comes near to the threshold acceptable ppm levels, a warning is issued to driver in the form of buzzer beep. This warning is an indication to the driver to get serviced his vehicle with in a given time frame. Negligence of the warning leads to further increase in ppm level of gases. As the ppm level of gases crosses the predefined acceptable limits (threshold), a challan is generated and sent on the email id of the driver. The violation of threshold values automatically stops the engine of the vehicle. Further to start the engine, the driver has to visit the webpage, login through his unique registration number of the vehicle and submit the challan. Again a specified amount of time is given to the driver to reduce the ppm level of the gases and get smooth riding environment.

Fig. 2
figure 2

Flowchart of the proposed system

3.3 Sensor Calibration

The active devices that are used to detect any gas leakage in a specific area are called Gas sensors. They show a very good response, when it comes to detecting gas leaked anywhere where they are employed. Depending upon the requirement of module whether highly sensitive or low, cheap or expensive, which gas we want it to detect and environmental conditions, there are multiple number of gas sensing modules available it market. However, the proposed system is utilizing the MQ2 gas sensor. They are very responsive in detecting leakage of CH4, H2, smoke, LPG, CO, propane and alcohol around the area where they are employed. Due to their small size and light weight they are often employed in factories and homes. The element which is capable of detecting various gases is SnO2 (tin dioxide), which is hidden inside the wire mesh mounted on this sensor. Its sensitivity can be made adequate by making use of a potentiometer. The sensing element i.e. SnO2 has very low conductivity, when it is placed inside the clean air. When the gases that are to be detected come in contact with this sensing element, its resistance varies and accordingly the output voltage or current varies, signifying which gas has been detected. Figure 3 illustrates the distinctive sensitivity curves. It can be understood in a way that the horizontal axis depicts level of concentration of gases that are sensed and vertical axis signifies resistance ratio of Rs and Ro. Here Rs is sensor resistance and Ro is resistance in clean air. DavideGironi, a software engineer from “Università degli Studi”, Milano analyzed the sensitivity characteristics of the MQ-2 sensor. The output of sensor is converted to associated ppm characteristics by using the graph as shown in Fig. 3. Gironi felt that the resistance ratio of the sensor (Rs/Ro) and the concentration (ppm) of gas are connected as a power function,

$$y = m* x^{n}$$
(1)
Fig. 3
figure 3

MQ2 sensitivity characteristics

He acquired the scaling factor (m), and the exponential factor (n), for the gas using power regression. He also suggested that the calibration of Rs can be done in clean air, once stable readings are being received from the sensor [12].

$$R_{s} = R_{o} * \sqrt[2]{{\left( {\frac{m}{ppm} , n} \right)}}$$
(2)

The concentration scope of a particular gas has been identified using datasheet leading to the computation of the limit for Rs/Ro,

$$\frac{{R_{s} }}{{R_{o\_limit} }} = \sqrt[n]{{\left( {\frac{ppm}{m}} \right)}}$$
(3)

Finally, he used a matlab script for power regression and polynomial curve fitting. He converted raw values to calculate the resistance and an arbitrary value of Ro has been used in the mathematical formulation.

3.3.1 PPM value calculation

The output of MQ-2 gas sensor is not very useful parameter for gas concentration reading. So, it must be converted into PPM (parts per million values)

$$V_{out} = \frac{{Sensor\, output*V_{cc} }}{65535}$$
(4)

Resistance of sensor (RS) is defined as,

$$R_{s} = \left( {\frac{{V_{cc} }}{{V_{out} }} - 1} \right)* R_{L}$$
(5)
$$R_{o} = \frac{{\left( {Average \,of\, R_{s }\, in \,calibration \,phase} \right)}}{CAF}$$
(6)
$$PPM = m* \left( {\frac{{R_{s} }}{{R_{o} }}} \right)^{n}$$
(7)

where Rs: is sensor resistance at 100 ppm of NH3 at different temperatures and humidity. RL: is load resistance. Ro: is sensor resistance in clean air. CAF: is clean air factor. m, n: are obtained from graph shown in Fig. 3.

3.4 Algorithm

The complete script of the proposed system is written in python. The following functions snippet and data are used for calculations and detection of gases for readers’ reference:

figure e

4 Results and Discussion

The hardware connection of the air pollution monitoring and challan system is shown in Fig. 4.

Fig. 4
figure 4

Hardware of the proposed system

The sensors are calibrated as shown in Fig. 5, the values of the sensed gases are shown in Fig. 6 and sent on Thingspeak as shown in Fig. 7. If the level of the gases crosses the threshold value, a buzzer beeps and a warning message is displayed on LCD as shown in Fig. 8.

Fig. 5
figure 5

Sensor calibration

Fig. 6
figure 6

LCD displaying ppm value of LPG, CO and Smoke

Fig. 7
figure 7

PPM values of LPG, CO and Smoke on thingspeak cloud

Fig. 8
figure 8

Warning and challan generation

If the driver failed to service the vehicle in a given time frame then the engine of the vehicle is shut down and a challan is generated against user and sent by e-mail on drivers ID. This is shown in Figs. 9 and 10.

Fig. 9
figure 9

A web page showing the ppm values of the gasses and challan generation and submission

Fig. 10
figure 10

Mail sent on driver’s id

5 Comparison

It has been concluded from Table 1 that mostly existing system are based on WSN, GSM and GPRS network using ARM7, Arduino or ATmega328 processing platforms. The range of the systems is very limited. With the evolution in IOT, several companies have developed high performance and a flexible platform specifically for IOT applications includes Raspberry Pi, Intel Galileo etc. These platforms are well suited for IOT applications and fast prototyping of applications. The proposed system is based on Raspberry pi and including a unique feature of challan generation to control the air pollution in the environment.

6 Conclusion

The proposed system can help in maintaining the level of gases within the predefined limits. The results shows that the system fulfils the requirement of a sensor based embedded system that can screen and control the air contamination with generation of challan from anyplace in the world using IOT. The system prototype designed around sensors and actuators is working perfectly. The system can be easily deployed in any vehicle that is contributing in air pollution. The designed web page is used to monitor the level of gases remotely at any place in the world. The results confirm that the complete system is successfully tested and implemented.

7 Future Scope

The concept of pollution monitoring using IOT in air can further be extended for IoUT i.e. Internet of Underwater Things. The IoUT is the evolution of IOT and it is a promising area due to the growing trend of smart cities. Obviously, the communication in underwater cannot use the traditional territorial wireless sensor network. There should be an underwater wireless sensor network with challenges to use a suitable communication protocol and channel model. The things in IoUT can be ships, buoys, autonomous underwater vehicles and different sensors.