## 3 SAgic-IoT Platform Description
### Electronical Board  
The main challenge of the design of the SAgric-IoT was to build low-cost and energy-efficient hardware capable of monitoring, gathering, and controlling physical parameters. The hardware board comprises four modules: microcontroller, sensors and actuators, energy, and a wireless communication module, as shown in Figure 4.  
The microcontroller module gathers information from the attached sensors and relays such data to the gateway node. Depending on the application, the microcontroller can be battery-powered, solar-powered, or backup battery-powered. We used the Microchip PIC18 LF46K22 microcontroller that executes up to 16 MIPS (millions of instructions per second); an input voltage of 3.3 V is required, and its CPU max current is 9.0 mA due to  
Figure 4: Sensor node block diagram.  
its specifications and low cost. The microcontroller has 64 K bytes for program memory, 3896 bytes for RAM, and 1024 bytes for EEPROM memory. An onboard 10-bit analog-to-digital converter (ADC) with 28 analog input channels and 35 I/O pins.  
Sensors and actuators are used in precision agriculture to measure different environmental parameters. We use the sensor shown in Table 3.  
AM2315 is an I2C-interface temperature and humidity sensor (Figure 5a). This sensor contains a DS18B20 temperature sensor and a capacitive humidity sensor. It has 3.5 to 5.5 V power and I/O and uses 10 mA max current during conversion. On the other hand, the AM2302 is a basic, low-cost digital temperature and humidity sensor (Figure 5b). It uses a capacitive humidity sensor and a thermistor to measure the surrounding air and outpost a digital signal on the data pin. The SHT-10 sensor includes a temperature/humidity sensor module (Figure 5c). The casing is weatherproof and will keep water from seeing into the sensor's body and damaging it, but it allows air to pass through so it can measure the soil's humidity (moisture). Humidity and temperature have 4.5% and 0.5% precision readings, respectively.  
We use XBee S2C radios connected to a microcontroller through a UART (universal asynchronous receiver-transmitter). This module operates on the 2.4 GHz ISM band, which significantly reduces the power consumption of our design. In addition, the module has a coverage area of up to 60 m in indoor spaces and 1200 m in outdoor locations with a line-of-sight range. It has a transmit power output of 3.1 mW. XBee modules provide wireless connectivity to end-point devices in ZigBee mesh networks.  
The gateway nodes use Raspberry Pi 3 Model B, which has a 1.2 GHz 64-bit quad-core ARMv8 CPU, an integrated 802.11n wireless LAN and Bluetooth 4.1, Bluetooth Low Energy (BLE), 4 USB ports, a display interface (DSI), and a micro-SD card slot.  
The camera nodes consist of an ESP32-CAM board with Wi-Fi and Bluetooth and an OV2640 camera (Figure 6). This module contains a microSD card slot that serves as a support for the storage of images captured with the camera.  
Figure 5: Sensors for SAgric-IoT (**a**) AM2315, (**b**) AM2302, and (**c**) SHT-10.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Sensor** & **Model** \\ \hline Air temperature & AM2315 \\ Air humidity & AM2315 \\ Soil moisture sensor & SHT-10 \\ Soil temperature sensor & SHT-10 \\ Wind speed/direction & SEN-08942 \\ Case temperature & AM2302 \\ Case humidity & AM2302 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Used sensors in SAgric-IoT.