Internet of things based humidity control and monitoring system

This study proposes smart


Introduction
Indonesia is a country that is geographically located at 6° North Latitude -11° South Latitude and 95° East Longitude -141° East Longitude, making it a tropical country that has high rainfall and humidity. The average annual rainfall in Indonesia is more than 2,000 -3,000 mm. However, some areas still tend to be dry with low rainfall [1].
Rainfall is also influenced by topography; high topography areas tend to have higher rainfall. For instance, areas with topography at an altitude of 600-1.300 m, which is considered high, have an average annual rainfall ranging from 2.300-2.800 mm per year. Conversely, areas with low topography have less rainfall. Also, topography impacts the level of humidity [2]. The highland areas have higher humidity levels than the lowland areas.
Being an agricultural country, most of the Indonesian population depends on agriculture for their livelihood. According to the Ministry of Agriculture of Republic of Indonesia, there was 27.33% or around 35.9 million people in Indonesia. Work in agricultural sector [3]. In Indonesia, there are various plant varieties produced by this sector, for instance, chili, which also consists of many types. The Ministry of Agriculture recorded the production of chili (capsicum annuum L) could reach 1.21 million tons from harvested area of 133.436 hectares (ha) and productivity of 9.10 tons per ha. Likewise, the production of thai chilies (cayenne pepper) in 2019 reached 1.37 million tons from harvested area of 166.943 ha and productivity of 7.8 tons per ha [4]. Moreover, the Central Statistics Agency recorded that Indonesia was able to export 219,274 kg of chili generating income of Rp5.95 billions in 2019. Indonesia also spent Rp70.7 billions to import 2,606,020 kg chili [5]. Hence, the import is significantly higher than the export level indicating very large demand for chili in Indonesia. To overcome this situation, the government is currently encouraging each region to increase the productivity of local chilies. The province of Banten in one of the regions that is in effort to increase its chili productivity.
According to 2019 data of the Ministry of Agriculture of the Republic of Indonesia, chili (capsicum annuum L) production in Banten province reached 7,104 tons with a harvested area of 851 hectares (ha) and productivity of 8.35 tons per ha. Meanwhile, the production of cayenne pepper was 5,019 tons with a harvested area of 544 ha and a productivity of 6.05 tons per ha [4]. The data indicated that the chili production of Banten province was still low leading the government to import the chili for 1.78 billion in order to fulfil the demands for chili locally.
Topographically, Banten Province is located between 0-200 m above sea level, making it a lowland. Rainfall in Banten area ranges from 335 -453 mm in September -May and 615 -833 mm in April -December [6]. This shows that Banten has low rainfall compared to the average rainfall in Indonesia which reaches 2,000 -3,000 mm per year. In the agricultural sector, rainfall is very influential on increasing crop yields [7].
The low rainfall frequently causes failure of chili harvest in Banten. This is exacerbated when the dry season begins which makes many farmers' plants wither or die due to lack of water. There are many elements that must be considered in planting chili such as soil moisture, lack of soil nutrients and lack of supervision. In its maintenance, chili must be continuously monitored. It should be watered 3 times a day to avoid drying out [8]. This process causes farmers to usually sacrifice a lot of time and energy to see the physical development of chili plants. This conventional method is not efficient because there is no accurate data that shows the level of soil moisture needed by chilies to grow completely and avoid drying out.
Recently, there are many sophisticated tools and technologies used to increase crop yields and minimize losses. One of them is the incorporation of Smart IoT technology. In agriculture, the application of IoT technology aims to increase yields and harvest quality in order to reduce costs [9] [10]. This technology can support farmers in obtaining better information so that it can help them in making decisions [11] [12].
Extensive researches have been conducted to improve the IoT in agriculture. Research [13] proposes the importance of wireless sensors in agriculture to increase productivity as well as the significance of precision agriculture nowadays. In addition, this study shows the architecture that is applied to analyze and monitor environmental parameters. On the other hand, study [14] suggests an IoT framework in agriculture. This research also shows the various layers of the agricultural market and how IoT can be applied to each layer. Additionally, it provides a variety of current technologies that can be useful related to IoT in agriculture.
Another research [15] seeks to overcome problems in plants due to uneven rain circulation. In this study, monitoring of environmental parameters regarding pH and soil moisture was carried out using a control unit in the form of Arduino [16]. This activity is carried out simultaneously with the communication process. Research [17] presents an information system for agriculture by utilizing a distributed architecture in tracking all data in the agricultural production process. In addition, the system is made in implementing, searching, and processing data from agricultural production. Research [18] created a web-based decision support system that is connected to the WSN to assist in the control of irrigation canals. Sensors are used to obtain data on humidity, solar radiation, temperature, and rain.
The use of IoT that leads to big data can produce important data. This is what underlies many studies that seek to turn this data into useful information and knowledge. Research [19], used an automatic irrigation system model based on the ATMEGA328 microcontroller which is equipped with a soil moisture sensor in the root zone of plants. The data and information obtained by the sensor are then sent to farmers via the GSM module which is used to find out the status of pumps installed on the plantation without visiting the location directly. The pump will automatically turn off when the water content in the soil reaches the desired threshold value and this message is sent to the farmer.
Research [20] utilizes a wireless network with ZigBee technology in controlling humidity, soil and temperature. This system utilizes several components such as soil moisture sensor, temperature sensor, humidity sensor, ZigBee, PIC 18F458 microcontroller, water pump, fan, relay and buzzer. The system is designed to increase water use in plants. The GPRS module is used to transmit information to web pages and the data is displayed in graphical form. research [21] utilizes the IoT framework in monitoring soil moisture. Temperature sensors, humidity sensors and soil moisture sensors placed on plants are connected to the microcontroller to evaluate further information. Microcontroller is used as a central storage system and SMS as cloud-based storage in delivering messages to users.
All the methods discussed above are similar in the use of wireless sensor nodes. However, they have differences in data storage and delivery to users. In research [19] the information submitted uses the GSM module so that the data obtained is not real-time. Likewise, the information conveyed in research [20] employs the GPRS module where the speed of data transmission is still very low. In [21] the data transmission process is still via SMS and this is not efficient in normal use. The system will continue to send many SMS per minute regarding plant data to the user causing inconveniences. Therefore, this research will focus on the application of the IoT framework in agriculture that can deliver crop data to farmers more quickly via the internet, and can be viewed in real-time. This study utilizes the Soil Moisture Sensor and DHT22 Sensor where the data is sent to a database via the internet for later use as data collection and processing [22]. The novelties of this study are given as follows.
1. Creating a tool that can help in monitoring chili plants.
2. Connecting the tool to the internet in collecting monitoring data. 3. The collected data will be analyzed and displayed on the cloud server in the form of graphs, analogues, and water indicators on soil moisture levels. 4. Plant can be monitored in real time through the website, both public and private channels. This research uses Soil Moisture Sensor and DHT22 Sensor, which are used in monitoring soil moisture, temperature and air humidity of chili plants. The sensor data collected will be processed and then sent to the cloud server via the internet which will then be used as data collection and processing. This study aims to create a system to assist farmers in monitoring their crops in real-time via the internet anywhere and anytime, either through public or private channels. This data will provide information if the plant lacks of water or the temperature of the plantation is too hot so that adequate watering can be done.

Method
The proposed system is a monitoring tool in agriculture to improve the quality and quantity of farmers' crops by measuring soil moisture, temperature, and air humidity without direct human assistance. By using the automatic watering systems, the level of soil moisture is urgent to be estimated. The measurement of soil moisture level can be carried out by taking into account the wet and the dry basis moisture content. = + 100 (1) = 100 (2) The wet basis moisture content (Mw) in equation 1 is described by the percentage equivalent of the ratio of the weight water (Ww) to the total weight of the material (Wt). It can range from 0% to 100%. This is needed to show the level of water content in food products or agricultural materials. Meanwhile, equation 2 shows the formula of dry basis moisture content (Md) which is described by the percentage equivalent of the ratio of the weight water (Ww) to the wight of dry material (Wd). The dry weight moisture content can be expressed as a percentage of 0% to 100%. This content is needed to describe the changes of moisture level in the drying process. When a sample loses or gains moisture, the changes that occur in the dry basis moisture are linearly related to a decrease in the mass value of the medium (soil).
The proposed system consists of several components, namely Soil Moisture Sensor, DHT22 Sensor, Raspberry Pi 3 B, and MCP3008. This system uses a Raspberry Pi 3 B as a microprocessor in executing programs. Soil Moisture Sensor is used to measure the level of soil moisture while the DHT22 Sensor functions to measure air temperature and humidity as can be seen in Figure 1.

Figure 1. Diagram Block System
The data generated by the Soil Moisture Sensor is in analog form and must be converted using the MCP3008 as an ADC which is then forwarded to the microprocessor for processing. The processed data will be forwarded to the cloud server via a WiFi router. This study uses ThingSpeak [23]. The cloud server will display data in the form of graphs and analogues regarding the level of soil moisture, temperature, and air humidity in plants.
This architecture is designed using Raspberry PI 3 B technology, Soil Moisture Sensor, DHT22 Sensor and MCP3008. This soil moisture and temperature monitoring system is implemented to increase efficiency in measuring soil moisture levels so that the quality and quantity of crops can be improved. This architecture is designed using Raspberry PI 3 B technology, Soil Moisture Sensor, DHT22 Sensor and MCP3008. This soil moisture and temperature monitoring system is implemented to increase efficiency in measuring soil moisture levels so that the quality and quantity of crops can be improved. Figure 1 shows the workflow of the monitoring system, where the sensor will send measuring parameters in the form of inputs such as soil moisture and temperature which will be converted from analog to digital. The input value from the sensor that has been changed is then sent to the microprocessor to be read and processed in the process section and the parameter value is sent to the cloud server via WiFi. The results sent in the form of measuring parameters can be seen from the website that has been provided.
To realize the proposed system, it is necessary to use four (4) important components that have their respective functions, namely Raspberry PI 3 B, Soil Moisture Sensor, DHT22 sensor and MCP3008. These four components work with each other and require the function of each other to obtain data on plants.
Raspberry PI 3 B is a single board computer that works like a mini computer. This research uses Raspberry PI 3 B to read data obtained from all modules that are connected to each other, as well as to manage the overall work of the data acquisition system. Soil Moisture Sensor is used as a module to determine the level of soil moisture by monitoring the water content of plants which can be accessed via a microcontroller. In this study, Soil Moisture Sensors were placed on plants to monitor the level of moisture in the soil. DHT22 is a sensor that can calculate the temperature and humidity levels of the surrounding air. The output of this sensor is a digital signal obtained through the 8-bit MCU. This sensor produces an accurate and coefficient-oriented room temperature scale in the OTP memory. MCP3008 is used as a converter that converts analog data into digital data. This tool has 8 analog input channels, each of which has a resolution of 10 bits. As can be seen in Table 1, the Raspberry Pi 3 B is connected to WiFi and is provided with a power source via MicroUSB. After that pin 1 (AO) on the Soil Moisture Sensor enters as input to pin 0 on the MCP3008 channel ADC to be converted from analog to digital. On the MCP3008, there is pin 16 which enters as VCC with a voltage of 5v, pin 15 enters as vref which acts as an ADC reference voltage that can be used to adjust the input voltage [24]. Pin 14 enters as Analog Ground which is connected to Ground from the reference voltage, then pin 13 enters as clock which is used to provide clock signal in SPI communication. Pin 12 enters as Serial Data Out (D-Out) and pin 11 as Serial Data In (D-In) both of which are used in SPI communication. Pin 10 enters as Chip Select (CS) or Shutdown (SHDN) which is connected to the GPIO or MCU pins to turn the IC on or off.  In Table 2, pin 9 enters as Digital Ground which is connected to Ground circuit. In the soil Moisture Sensor, the white wire of pin 3 enters as ground, and the red wire of pin 4 enters as VCC or a voltage of 5 volts. Finally, on the DHT22 sensor, the red wire of pin 1 enters as VCC or 5 volts, the green wire of pin 2 enters as data input, and the white wire of pin 3 enters as ground. Figure 2 portrays the schematic of the circuit.

Results and Discussion
This research produces output in the form of a prototype humidity control system and visualization of the data stored on the cloud server displayed on the website in real time. The prototype humidity control system in Figure 3 uses components such as the Soil Moisture Sensor, DHT22 Sensor, Raspberry Pi 3 B, and MCP3008.

Figure 3. Prototype of Humidity Control System
In this system, the measurement of air temperature and humidity is carried out using a DHT22 sensor consisting of a thermistor (temperature meter) and a capacitive sensor, both of which are used to determine air temperature and humidity [25]. It also includes a simple chip that can perform some analog to digital conversions. The output of this sensor is a digital signal whose conversion and calculations are carried out by the MCP3008. The MCP3008 is used as an Analog to Digital Converter which will add 8 10-bit analog input channels to the microprocessor for processing [26]. The sensor that requires the function of the MCP3008 is the Soil Moisture Sensor. This sensor functions to detect soil moisture by measuring the volumetric content of water in the soil and produces an output in the form of soil moisture levels. The resulting output is in the form of analog and must be converted to digital using the MCP3008. The digital output results are then forwarded to the Raspberry Pi 3 B as a microprocessor that functions to read and process data which will be sent to a cloud server via the internet. Data stored in the cloud server will be visualized in real-time either through public or private channels.

Figure 4. Script SOILMOISTURE.py
In connecting these sensors, several commands in the form of the python programming language with the format (.py) are needed to get the results of data acquisition from the sensor [27]. In Figure 4 there is a soilmoisture.py script that is used to connect the Soil Moisture Sensor. In the first line of this script, several sensor modules are called, some of which are used in communication with SPI devices, to determine value scales, add delays, and update channels on the cloud server. Next is the connection to the Serial Peripheral Interface (SPI) device which functions as a communication protocol between the Raspberry Pi 3 B as a microprocessor and the MCP3008 converter as a peripheral device whose communication is aimed at sending data [28]. When the connection is started, SPI will create an object which will be read by the MCP3008 converter. Once connected, the MCP3008 will read the data in analog value then convert it to digital form. Finally, the digital value is then sent to the cloud server via the POST or update method [29].  Figure 5, there is a humidity temp.py script used in connecting the DHT22 Sensor. At the beginning of this script, several sensor modules are called, followed by entering the API key obtained from the cloud website and the URL that will be used as a data repository. Next is the reading from the DHT22 sensor which includes readings on the air humidity sensor and readings on the temperature sensor. The DHT22 sensor takes 2 seconds for readings. If the reading is correct, then the stored data will be converted to decimal format and will be sent to the cloud server.
After the sensors are connected and the program is run, the data from several sensors that have been collected will be sent via the MQTT (Message Queuing Telemetry Transport) protocol and will be processed and stored on the cloud server. The cloud server will visualize the data in the agricultural sector in the form of graphs including the level of soil moisture, ambient temperature and humidity of the surrounding air. Farmers can access the cloud server to view their crop data to assist in monitoring [30][31] [32]. This study conducted tests on chili plants for 10 days. The results produced is in .csv format file which can be seen in Figure 6. The results of this test resulted in 13098 data which were forwarded to the cloud server for visualization.  Based on the tests carried out on chili plants for 10 days, the average of soil moisture, temperature, and air humidity as well as the maximum and minimum values of the three parts can be known, shown in Table 3. The data produces value information with an accuracy of 90% based on sensor calibration results. The collected data sheets will be forwarded to the cloud server to be visualized in the form of graphs and analogues. This visualization will be used as a reference regarding the condition of the plant so that adequate watering can be done to avoid crop failure.    . This graph also displays the time of temperature changes, if the temperature drops then the line will go down, if the temperature is stable then the line will run flat, and if the temperature increases then the line will also go up [35]. Hence, the data will present the rise and fall of the temperature complete with the time of fluctuations [36]. The air humidity chart shown in Figure 9 contains data in the form of air humidity levels expressed in percentages (%). This graph displays all the data collected from the sensors while the system is running. Therefore, the rise and fall of the data along with the time the data was obtained will also be visualized in this chart [37] [38].

Figure 10. Indicator of Water Adequacy
The results of the data obtained will also display an indicator if the soil moisture level of the plant is sufficient, lacking or no water based on a predetermined value, namely 60-100 for sufficient water indicator which is stated in green, 20-60 for insufficient water indicator stated in yellow, and 0-13 for the red water indicator which is expressed in red. Figure 10 shows the level of soil moisture which reaches 99% which means that the soil moisture is sufficient, therefore the indicator displayed is green. Low water level condition will occur if the soil moisture is at a percentage of 20-60. Figure 11 shows the condition with soil moisture reaching 23% and hence the indicator displayed is yellow. Figure 12 shows the indicator in red because the percentage of soil moisture is between 0-13. Also, soil moisture is at 0% percentage which means there is no water in the soil. These three-color indicators are displayed on the website complete with the percentage of soil moisture to inform farmers about the state of soil moisture in their plants so that countermeasures can be taken.

Conclusion
Based on the monitoring system on the testing of on chili plants for 10 days, the results show the average, maximum and minimum value of the level of soil moisture, temperature and air humidity of plants. The collected data is visualized on the website in the form of chart and analogues. This data visualization will help farmers to monitor crop so that accurate data can be obtained. Farmers can monitor their crops in real-time via the internet anywhere and anytime, through public or private channels. This monitoring system will alert the farmers if the plant lacks of water or if the temperature is too hot, so that adequate watering can be carried out. Future research can be done by using a cloud server that provides comparisons between data from several sensors in one chart so that the data displayed looks neater and makes it easier for users to monitor. In addition, the installed devices can be monitored in real time through widgets and dashboards that can be customized on the mobile app. Users will also get notifications if something happens to the installed device regarding the condition of their plants. With the addition of an automatic plant watering feature that can be monitored through this mobile app, farmers do not have to worry about their crops and this will certainly reduce physical human intervention in agriculture.