Odor Classification in Cattle Ranch based on Electronic Nose

Unpleasant smell and pollution are the side effects during the cattle ranch activities. That is the reason why the cattle ranch is placed far from the housing residents. The cattle ranch areas are usually not covered by the internet network, but it is also important to monitoring the pollutant in the cattle ranch. The pollutant gases are also produced during the cattle ranch activities such as hydrogen, oxygen, methane, and carbon dioxide. To classify the odor or unpleasant smell in the air, the electronic Nose (e-Nose) become an effective system to monitor and classify the odor in real time. This research, we proposed an e-Nose system that able to classify the odor in cattle ranch. The Backpropagation method is selected to create the e-Nose model. This e-Nose system is able to transmit data to server without the internet network. The Lora Network has been applied by using point to point method. The web application is also made to display the real time data monitoring and prediction of the odor. Based on our test, the e-Nose accuracy is 99% in real time prediction.


Introduction
During cattle ranch activities, it produces many gasses such as hydrogen, oxygen, methane, and carbon dioxide. All those gases are the member on Volatile Organic Compounds (VOCs) [1]. The VOCs are compounds which is a high vapor pressure and low water solubility. IF this gases range above the standard regulation, VOC's contributes polluting the air. The gasses are not only polluting the air, but also creating unpleasant smell. That is the reason why the cattle ranch is placed far from housing resident. The air pollutant usually disturbs people especially in the afternoon. People usually closed their windows and doors to reduce the smell. The new technology that is able to identify the odor namely electronic nose (e-Nose).
Electronic nose (e-Nose) is a system which has ability to mimic human old factory to detect and classify odours [2]. The common E-Nose consists of sensors array, artificial neural network, and controller. The e-Nose has been applied in many fields such as medical [3], food [4], and environments [5]. Nowadays, the e-Nose has been combined with the internet of things (IOT). The ability of e-nose to identify gases is not only local area, but also can work in wide area [6]. The IoT e-Nose, namely end-device, is able placed in many areas and transmit all data to server.
Machine Learning methods has been used in many areas such as in smart building [7], biomedical [8], and industries [9]. The machine learning method, Principal Component Analysis (PCA), is also implemented in e-Nose such as fruit classification through fruit odors. The Linear Discriminant analysis combined K-Nearest Neighbor are developed to classify the fish species based on its odor [10]. Unpleasant smell and pollution are the side effects during the cattle ranch activities. That is the reason why the cattle ranch is placed far from the housing residents. The cattle ranch areas are usually not covered by the internet network, but it is also important to monitoring the pollutant in the cattle ranch. The pollutant gases are also produced during the cattle ranch activities such as hydrogen, oxygen, methane, and carbon dioxide. To classify the odor or unpleasant smell in the air, the electronic Nose (e-Nose) become an effective system to monitor and classify the odor in real time. This research, we proposed an e-Nose system that able to classify the odor in cattle ranch. The Backpropagation method is selected to create the e-Nose model. This e-Nose system is able to transmit data to server without the internet network. The Lora Network has been applied by using point to point method. The web application is also made to display the real time data monitoring and prediction of the odor. Based on our test, the e-Nose accuracy is 99% in real time prediction.
Lora (Long Range) wireless communication is one of method which can transmit data without internet network. In Indonesia, the LoRa works from 919 MHz until 925 MHz. The LoRa is able to transmit data in range 10 Km. The LoRa has applied in many applications such as in smart building [11] and smart industries.
In this research, we proposed an e-Nose to classify the air pollution around the cattle ranch. The data is transmitted to server through the LoRa network. The e-Nose system is applied in cattle ranch which has distance 1 Km from server. The server locates in Politeknik Negeri Padang, department of Information Technology. We proposed end-device which consist of sensor array, microcontroller, and LoRa module. We proposed multi end-device to simulate the LoRa Network. The e-Nose system consists of end-device, Jetson Nano as a server, and web display. The system classifies the air into normal air, low-polluted air, and high polluted air. We proposed to use backpropagation method to create the air models which is formed by 6 input nodes, 1 hidden layer, and 3 output nodes.

Methods and Procedures
The e-Nose system is divided into hardware configuration, software configuration, and machine learning methods.

Hardware Configuration
The proposed e-Nose system in this research consists of end-device and server. The end-device is formed with microcontroller, sensor array and LoRa module. The end-device is also called an e-Nose. An end-device is installed in cattle ranch that internet network is not available. By using the LoRa module, the sensor array data is able to transmit into the server where located on Politeknik Negeri Padang, department of information technology. The e-nose system monitored the cattle ranch pollution in 24 hours. The end device shows in Fig 1.a. Every end device has 6 gas sensors to measure chemical substances during cattle daily activities.
The second hardware is the server which consist of Jetson Nano and LoRa module. This device controlled all data flow from end device into the server. The Jetson Nano, command Centre, requested end device to transmit data and save the data into the database. Fig 1.b depicts the server device in this research.
The other proposed of this research is to apply the e-Nose in area without internet network. Fig 2 shows the e-Nose System installation. The red circle is the cattle ranch location which is no internet network. The black circle is the server location where located on Politeknik Negeri Padang. The sensor array is formed by combining MQ-02, MQ-04, MQ-06, MQ-08, MQ-09, and MQ135. These sensors are also to extract feature for normal air and polluted air. Table 1 displays the sensors characteristics for each chemical substance.

Software Configuration
The end device and server are needed to configure based on their function. The LoRa module in configured to point to point connection which means one end device connected to server only. The main activities in end node which are (1) waiting command to read sensors, (2) reading sensor, and (3) transmitting data through LoRa Network. Fig 3 shows the server activities. The server is able to read and store data into the database. To apply Jetson Nano as a server for e-Nose System, XAMPP engine is installed into the Jetson Nano. The XAMPP engine provided the web service and the database based on e-Nose need. The server provided a schedule for reading data hourly in 24 hours. The sensor reading saved in database. All saved data is used to create dataset for modelling.

Machine Learning
The architecture of backpropagation shows on Figure 4. The architecture is formed by 6 input nodes, 1 hidden layer, and 2 outputs. The Tensorflow framework is applied for creating the backpropagation model. The train proses is configured with 179 epochs and 0,01 learning rate.

Results and Discussion
The dataset is formed by 3528 data in 3,5 months. This data is a raw data without preprocessing. After preprocessing process, the real data became 2903 data. The elbow method is used to classify the class based on raw dataset. Fig 5 shows the elbow method which conclude that the best class is 2 groups. To make sure the number of classes, the Davies-Bouldin Index (DBI) is applied to raw data. Figure 5 shows the DBI result which means that the optimum classes are 2 class. 2 classes are chosen because the best value of DBI is 0.475.   Figure 8 shows the model performance based on precision, recall dan f1+score. The next stage is deployed model on web application. Figure 8 shows the web of electronic nose. The model has been applied in web which automatically run the model in real time. The web is also reported the last login to check the odour classification. Figure 9 shows the prediction on web for the level 1 namely polluted air. The web also gave suggestion to wear a mask. Figure 10 depicts the predicted odor for level 2, namely normal air. This is the normal condition that there is no unpleasant smell. The high polluted air classification is shown on Figure 11.    The models work successfully classifying the odor around the cattle ranch. The real time monitoring is also done in 24 hours. To know the model performance, the new data have been recorded and grouped as test data. The Confusion Metrix is applied to calculate the model performance. Figure 13 depicts the confusion matrix result. The Level 0, High Polluted air, prediction shows that the True positive value is 105 and 0 for false positive. The level 1, The model accuracy is 99 % during the real time measurement. This model works perfectly identifying the odor in real time in 24 hours.
Since the e-Nose system is installed in cattle ranch, some problems are also found. For example, the electricity problem made in some times no data in database. The other problem is the UART communication problem that happened because some data in buffering stages. This problem is solved by restarting the end device in cattle ranch.

Conclusion
Based on our experiment, the e-Nose system is successfully identified the odor around the cattle ranch into low polluted air, high polluted air, and normal air. The LoRa network which are point to point configuration work perfectly transmitting data to Jetson Nano Server. The web server is display smoothly the prediction of odor until this paper have been created, After some tests, the accuracy of e-Nose model is 99% .