Design Prototype of Temperature and Humidity Control and Monitoring on Weaver Ant Cage based on Internet of Things

Increasing market demand cannot meet the needs of the community, especially in the rainy season, because Kroto produced by weaver ants is of low quality and hard to find. Modern Kroto cultivation has many advantages compared to traditional searching in nature. The quality and quantity of Kroto lie in maintaining the temperature and humidity for weaver ants. The challenge is how to maintain the temperature and humidity inside the artificial nest of weaver ants. To help overcome the problems of modern weaver ant cultivation, we design and develop automated devices based on the Internet of Things (IoT) to control and monitor temperature and humidity for weaver ant culture. We chose the limitation of temperature is in between 25 o C – 31 o C, and the humidity range is on the level 65% - 85%. We used NodeMCU as the mainboard, DHT22 as temperature and humidity sensor, Cayenne webserver as IoT platform, and fan, humidifier, and heater for the tools to control the environment. We had conducted four tests scenario, which are sensor calibration, relay testing, actuator time testing, and delay testing. The result in temperature reading shows good accuracy while the humidity performs a huge gap of error. The humidity needs to be adjusted with the linear regression formula. Based on the relay testing, the device works perfectly fine to control the heater, the humidifier, and the fan. According to the actuator timing testing, the humidifier has the quickest time to make more humid and soothing conditions, around 5 – 15 minutes. In contrast, the heater actuator needs a longer time to heat up the room. Depends on the temperature, it needs around 5 – 31 minutes. The longest time was during the fan actuator to cool down the room, around 30 – 90 minutes. The average delay of the IoT system is 200,01 ms and is categorized as good performance based on standard TIPHON.


INTRODUCTION
Weaver Ant, or Rangrang ant in the Indonesian language, is a type of ant that exceeds ants in general and has a striking red color. These ants, which have the scientific name Oecophylla smaragdina, live in colonies, and they make nests in large tree branches and have queens, worker ants, male ants, and soldier ants [1]. The nests that are made in weaver ants are usually inhabited by many ants and their eggs called Kroto. In India, weaver ant is considered a nutritious, medicinal food resource consumed by the local people [2]. Its egg contains high nutrition with high protein and vitamin, fiber, fat, and micronutrient content [3]. In Indonesia, Kroto is often used by chirping birds to give their birds vitamins that are often contested in championships.  (Dzata Farahiyah) and Gibb, who monitor and manipulate weaver ants colonies in nature. They discovered during the dry season, the temperature inside the nest and its surrounding has a mean of 23.3 o C -30.9 o C, and relative humidity has an average of 56.9% -99.7%. The humidity is affected by the number of ants inside the nest [18]. Another piece of literature by Romer et al. discusses the relative humidity and temperature of leaf-cutting ants. They discover that one of the preferred temperatures for ants colonies is in between 25 o C -30 o C [19]. According to that, we chose the temperature range is 25 o C -31 o C, and the humidity range is on the level 65% -85%. The second step is the preparation of components and other equipment to build the hardware device. The third step is designing the device and the cover container. The cover container is made of acrylic as compact and simple so that the hardware circuit and other equipment can seize in the container. Acrylic was chosen because it can be cut according to needs. The fourth step is assembling the hardware equipment. We assembled the temperature and humidity sensor on a NodeMCU board. Then we placed all components into the acrylic container by placing the device to be installed according to the design. Installation of components was important considering the container used is designed to have the most compact form. Additionally, we set up the connection to an IoT platform to monitor the status. The fifth step is testing the device. The tests aim to detect the error on the sensor, actuator response, the success rate of the system, and the delay between transmission. Then in the final step, we analyzed the result and concluded the summary.

System Design
The system was designed to maintain the temperature and humidity levels within a predetermined range. Fig. 1 shows how the system works and reacts to the changing temperature and humidity. The system automatically adapts to the environment controlling by a programmable NodeMCU. When the humidity level is below 65%, then the humidifier inside the box spreading water. When the cage is too hot, which means the temperature rises above 31 o C, the fan will be turned on automatically. Vice versa, when the temperature drops below 25 o C, then the heater will turn on. The current temperature and humidity levels obtained from the device are displayed in the LCD as well as stored in the database on the Cayenne website.

Hardware Setup
The components and types of equipment needed to complete the device are listed as follows: Node MCU, 4 channel and 2 channel Relay, DHT22 sensor, 5V-3A stepdown and 5V-5A stepdown, 12V-5A PSU, 4×4cm 12VDC fan, 12×12cm 220 VAC fan, 200W heater, LCD 16×2 cm, 12 VDC voltmeter, 5VDC humidifier, terminals 2, 6, 10 channel, cables, multimeter, solder, acrylic glue, 2 mm thick acrylic, aluminum foil, and switch. The mainboard of the device is NodeMCU. It is a microcontroller device commonly used in the development of the Internet of Things (IoT) due to its ability to connect to the wireless network [20]. NodeMCU has a micro-USB port that serves as a path for programming and, in addition, also serves as a power supply. NodeMCU is also equipped with push buttons, namely reset and flash, along with 22 pin-outs available that can be used as needed. This programmable device runs on Arduino IDE to program the algorithm within the board. NodeMCU has the lowest cost of wifi based-device than the other boards. Additionally, the NodeMCU wifi module is installed together for easiness and compactness [20]. The small size and the compact design shape the ultimate reason why this prototype design is kept to a minimum.
DHT22 sensor enables to read changes in temperature and humidity simultaneously. The working principle of this sensor utilizes a capacitive humidity sensor and thermistor to measure the surrounding air to produce a digital signal at the data pin [21]. The sensor has a fast response, precise readings, and has an antiinterference ability. The small size and transmission rate of up to 20 meters makes this sensor widely used in the making IoT like smart farming and weather prediction. Above all, DHT22 is the most suitable and easiest to be applied in Node MCU.
We utilized two fans and a humidifier for the cooling process and lowered the temperature. Fan ventilator is also used in [15], [22] to automatically cool down the temperature inside the chamber. To display the realtime temperature and humidity, we used LCD placed in the outside container. We chose the 16×2 I2C LCD type because Inter-Integrated Circuit (I2C) consists of a serial clock (SCL) and serial data (SDA), which carry data information between LCD and its engineering [23].

Hardware Design
The design of the device has 20 cm × 20 cm in wide at the base and 45 cm in height. It has three outputs for an electronic component inside the container, such as fan, humidifier, and heater. Due to compactness and portable ability to cool down the temperature, we used a fan that can release hot air inside the cage. If it is needed, a portable air conditioner may be attached to the container via a cable that can be turned on automatically. Fig. 2 shows the circuit and wiring design of the device. The mainboard is where all the connection begins. It connects between the data acquisition sensor and displays the real-time result on LCD. It also connects the relays with fans and humidifiers. Fig. 3 shows the design of the container from two different sides, the front and the back. The hardware design is done by an application for 3D design. It is shown that the container has been made of transparent acrylic. In the prototype, there is an incoming power of 220V, and then it is lowered using a 12V-5A PSU which is then lowered again using a 5V-3A stepdown to turn on NodeMCU and humidifier on the left. The other 5V-5A stepdown is to turn on the 16x2 LCD, humidifier on the right, and the DHT22 sensor. The programmed NodeMCU will instruct the DHT22 to read temperature and humidity simultaneously and then upload it to the Cayenne server. The temperature and humidity read by the sensor can be seen using a 16x2 LCD on a device whose voltage for each stepdown is monitored via a 12VDC voltmeter. The humidifier, cooling fan, and 200W heater will work on and off according to the temperature and humidity conditions of the room, which are read by the DHT22 sensor.

Calibration
The accuracy of the sensor is important to obtain an accurate temperature and humidity level inside the cage. The calibration is necessary. The comparison of the output of sensors and standardized test equipment, named UNI-T, is done. Hereafter, the absolute error and relative error can be calculated by using (1) and (2), respectively. The absolute error, or we called it simply an error, is calculated by comparing the difference between the test value and standard value [24]. The test value is the acquisition data from the sensors, and standard value is the data read from UNI-T.

Monitoring
The device connects to the wireless connection and accesses the IoT platform. The IoT platform used in this research is a free web server named Cayenne. The recent works using Cayenne as a monitoring platform are found in [25]- [28]. Cayenne is connected to a server that can be accessed via a mobile application. Cayenne has the feature to control the device if it is needed and is compatible with low-cost microcontrollers, including NodeMCU and Arduino. The comparison with other platforms such as Thinkspeak and Blynk, Cayenne is easier to connect NodeMCU to their server. Moreover, based on our experience, the user interface of Cayenne is more convenient and user-friendly than the other platforms.

Delay
Delay, in millisecond (ms), is the time takes from the transmitter to the receiver. Delay was tested from the time the device uploads the data to the Cayenne. Delay is caused by distance, physical layer, congestion, or processing time. Table 1 shows the standard delay categories of Telecommunications and Internet Protocol Harmonization Over Network (TIPHON) company which is divided into four categories.

RESULTS AND DISCUSSION
The IoT hardware device described in the previous section is shown in Fig. 3. Experimental tests were conducted, such as sensor calibration, relay testing, actuator testing. The result of each test is explained below.

Sensor Calibration
We have tested the sensors 4 times during the day and night. First, we collected data from the sensors and standard test equipment in real time. Then, the data were compared between the standard and the result from sensors. With the help of (1) and (2), the error was obtained. Table 2 shows the result of the calibration test of temperature. According to the table, it implies that the lowest error happened during the night, and the higher error happened during the late afternoon. If we compare with another result, the overall accuracy obtained for temperature is still below the research in the paper [29], which has ± 2°C of temperature.
Due to the close relationship between temperature and humidity, the temperature changes affect the humidity level. The precipitation process potentially influences the changing of air humidity. The DHT22 sensor works using one of the thermistor sensors to measure the air surrounding the environment. It has a drawback in humidity readings [21]. The thermistor material is very sensitive to temperature but not to humidity. This causes poor results on humidity readings, resulting in high error values. The so-called environmental error, due to different conditions of the environment where DHT22 is applied and made, could also be the reason for the error [30]. It can be concluded that this DHT22 sensor has a high sensitivity to temperature but not to humidity.
While the temperature error is still tolerable, the humidity error has a huge gap. Thus it needs to be adjusted. We determined the corrected humidity equation by linear regression in (3), derived from the real reading of the sensor and the reading of the standardized device. Where Hc is the corrected humidity and H0 is the real reading of the sensor. Table 3 shows the result of the calibration test of humidity which contains the errors of the real acquisition data and the corrected version. The regression formula was inserted in the Arduino program to correct the real data readings for humidity. The error is decreasing and the accuracy obtained for humidity after correction is still below the research in the paper [29], which has ± 4% of humidity.
According to Table 3, the lowest temperature error is obtained at night, while the highest error is obtained at noon. While the lowest humidity error is obtained at noon, and the higher humidity error is obtained at midafternoon. The paper in [18] suggests the best time of the day to monitor weaver ant is from 4-9 PM (late afternoon to dusk).

Relay Testing
Several experiments had been conducted to test the device, especially the performance of the relay. The condition had been set up to generate heat in the designated room. We consider three relays for the experiments, that is heater relay, fan relay, and humidifier relay. The relays should be switched on or off in the range of certain temperatures and humidity that we set up beforehand. For temperature, the range should lay between 25°C ≤ T ≤ 31°C, while for humidity level, the range should lay between 65% ≤ H ≤ 85%. These ranges are related to the nature-like temperature and humidity for Weaver Ants.
When the room is too hot, or the temperature is over 31°C, then the fan will switch on. When it is both conditions, too hot and too dry and needs more humid, then additionally the humidifier is also switched on. When the room is too cold, or the temperature is below 25°C, then the heater will switch on. Additionally, if the heater causes dryness and needs more humidity, then the humidifier is also switched on.
Based on the device's principle, the results obtained from five experiments have shown in Tables 4-8. The blue color of the temperature indicates to trigger the relay heater. The green color for humidity indicates to trigger relay humidifier. The red color of temperature indicates to trigger the relay fan. When the temperature and humidity exceed the predetermined limit, the relay turns on or off immediately.
From Table 4 of the first experiment, we can see that at first, both heater and humidifier were switched on. After that, when the humidity was increasing, the humidifier was off. With the sudden heat, the temperature was rising, and the fan was replacing the heater to be switched on. Table 5 of the second experiment began with the humidifier was on due to the dryness, then the temperature was decreasing below 25°C. Thus the heater was constantly on. When the temperature was slowly rising and exceeded the upper limit, then the heater was off, and the fan was on. Table 6 of the third experiment shows that the condition was hot and dry. As a result, both the fan and humidifier were on. When it gradually cooled down, the fan was off. Table 7 of the fourth experiment shows that the condition was extremely hot and dry. Thus the fan and humidifier were on continuously. Table 8 of the fifth experiment began with cool conditions, the heater was on, and the room was heated. The spike of heat due to manipulation of the temperature inside the room made the relay was off, and both fan and humidifier were on.
Other supporting components such as LCD, voltmeter, cooling fan were also functioning properly. This is indicated by the condition of all components when the main switch is turned on, as is shown in Fig. 4. The LCD shows the temperature and humidity in real-time, and the left green voltmeter shows ≥ 5 VDC from stepdown 5V-5A, and the red in the right one shows the same. That indicates the voltage from 12VDC PSU works perfectly and has no shortage.

Actuator Timing Test
In testing the actuator response time, the experiments were carried out in a 2 × 2 × 1.5 room. The data is taken based on the response time of the actuator to restore the state to be ideal measured by the stopwatch. The three actuators tested were connected to a fan, heater, and humidifier.
On the actuator connected to the fan, data is taken based on the length of time it takes to lower the temperature to below 31°C. In the heating actuator, data is taken based on the length of time it takes to raise the temperature to 25°C. While on the actuator connected to the humidifier, data is taken based on the length of time it takes to reach a humidity level of 65%.
Based on the results of actuator testing in Table 9, the fan actuator took a longer time to reach the ideal temperature. Several attempts were successful in reducing the temperature by 0.3 ° C. This is because the fan cannot lower the temperature, yet it is used to circulate the air inside the room. It is necessary to replace the fan with an air cooler or air conditioner to be more efficient. Thus, we installed the cable line to connect to such an additional component.   Table 10, the result of the heater actuator installed on the device could successfully raise the temperature to 25°C with an average rate time of 395 (°C/s). Lastly, Table 11 shows the result of the heater actuator in managing the humidity level to reach 65% with an average rate time of 44.55 (Percentage/s). These prove that both actuators are working as intended and functioning properly.

Delay Testing
In the investigation of the delay or time difference between the uploaded data of temperature and humidity by the device in the monitoring system, Cayenne server, we turned on the tool for ten minutes. We configured that the data will be uploaded to the server every 16 seconds. We found that the lowest time between two uploaded data was 15 seconds, and the highest time was 20 seconds. The average time between two uploaded temperature and humidity data has the same value of 16.47 seconds.
The performance of the network was analyzed by Wireshark during ten minutes of investigation. There were 2480 data recorded on Wireshark. The average delay generated from the data is 0.20001 seconds or 200.01 milliseconds. Our result has a better performance compared with the result of the similar project in [17], which has an average delay between 0.1 -0.9 seconds.
We also made a comparison with other papers on delay in IoT systems for Aquaponics in [31]. It has an average delay of 0.10512 seconds. Based on the standard delay owned by the TIPHON in table 1, both our result and the result in [31] have the performance index 3 and are categorized as good performance.

CONCLUSION
The device of Arduino based on the IoT to monitor and control the temperature and humidity of the weaver ant cage was successfully built and developed. It works based on the performance of several tests. The calibration tests show that the DHT22 works well reading the temperature while it needs an adjusting formula to read humidity accurately. The relay tests show that it works perfectly fine to control the heater, the humidifier, and the fan. The actuator timing tests show that the humidifier has a great impact on cooling down and make more humid, while the heater actuator needs a longer time to heat up the room. The longest time was during the fan actuator to cool down the room. This device is recommended to be developed in the future to replace the actuator, such as replace the fan with an air conditioner to cool it fast. The larger room for the artificial nest, the bigger the capacity device is needed. In addition, the notification message directly to our gadget can be applied to gives a significant improvement in connecting to the farmers to support information. The additional machine learning algorithm on built-in apps may contain information about the prediction of Harvested Kroto as well as its price in the market. We hope that the development of technology and information gives significant improvements to the traditional way of farming weaver ant. Thus, it can save time, energy, and costs.