## 3 Materials and Methods
### Electronic Design  
The hardware design in this research is illustrated in Figure 2. Figure 2a represents the design process, while Figure 2b displays the wiring schematic. The hardware design utilizes several DHT11 sensors [25] and a one-channel relay device as actuators. All of these components are connected to the microcontroller through digital I/O pins. An ACS712 sensor is also employed to measure the electrical current linked to the microcontroller via an analog I/O pin (A0) [26]. To control the speed of the DC motor, a BTS7960 device is used, capable of controlling motors up to 48 V. The DC motor circulates the heated air produced by the heater into the incubator. This heater device is connected to a relay module, facilitating easy on/off control. A comprehensive list of the electronic components used can be found in Table 2.  
Furthermore, the placement procedure of these sensors is designed to optimize monitoring and measurements inside the incubator, as depicted in Figure 3. Four temperature and humidity sensors are positioned on each side of the incubator. The distribution of these sensors across the incubator's sides aims to assist in monitoring even temperature and humidity changes throughout the entire space. Meanwhile, the current sensor placed on the AC power cable of the primary power source enables precise monitoring of the electrical current entering the incubator.  
\begin{table}
\begin{tabular}{l l c c c} \hline \hline
**Component** & **Description** & **Qty.** & **Unit Price (S)** & **Total (S)** \\ \hline Board Arduino Mega2560 & Microcontroller & 1 & 8.65 & 8.65 \\ ESP8266 & WiFi & 1 & 0.86 & 0.86 \\ DHT11 & Temperature measurement range: 0 \({}^{\circ}\)C to 50 \({}^{\circ}\)C, and & 4 & 0.60 & 2.4 \\ HCV5712 10 A & Ampere sensor & 1 & 0.73 & 0.73 \\ Relay 1 channel & Relay & 1 & 0.30 & 0.3 \\ Motor DC 12 V & Motor & 1 & 15.38 & 15.38 \\ BTS7960 & Driver motor & 1 & 3.89 & 3.89 \\ Heater Incubator 1200 Watt & Heater & 1 & 115.34 & 115.34 \\ Power supply 12 V & Power supply & 1 & 8.78 & 8.78 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Electronic component.  
Figure 3: Sensor placement in the incubator.  
Figure 2: Architecture of hardware: (**a**) Electronic design; (**b**) Electronic schematic.  
The next step after connecting the sensor and actuator devices to the microcontroller involves developing the program code. The program development process employs the Arduino IDE as the code editor [28]. The program is divided into several functions, which include (a) connecting to the internet network, (b) communicating with the IoT broker, (c) reading sensor values, and (d) the control system. The program begins with the device connecting to the Internet using the SSID and password. Subsequently, the device establishes a connection with the IoT broker by configuring several parameters such as the host, port, username, and password. Once connected, the device starts reading sensor data and repeatedly sends them to the IoT broker. The following complete details regarding the program on the hardware can be seen in Algorithm 1.  
```
1. INPUT: Hardware sensor
2. OUTPUT: Temperature sensor value, humidity, and electric current
3. DESCRIPT:
4. IF network not conected:
5. network = reconnect and set parameter (ssid, password)
6. END
7. IF network connected:
8. client = connect to an IoT broker with parameters (host, port, id, username, password)
9. END
10. WHILE client connected:
11. temperature, humidity = read sensor temperature and humidity
12. IF(AVERAGE(temperature < 33):
13. setHeater = ON
14. END
15. FOR i in range 150:
16. current += read sensor current
17. set delay = 3 milliseconds
18. END
19. current = current/150
20. current = (2.5 - (current \(\times\) (4.9/1024.0)))/0.066;
21. response = send data (temperature, humidity, current)
22. IF response:
23. PRINT response
24. END
25. END
```  
**Algorithm 1**Hardware system