# Monitoring Perishable Commodities Using Cellular IoT:
## 2 Materials and Methods
### Hardware Architecture  
#### 2.2.1 Components and Sensors  
The designed instrumentation system consisted of a datalogger that incorporated the ESP32 microcontroller to manage the whole system, as mentioned above. This microcontroller presents a dual-core Xtensa LX6 architecture, which is very versatile and has low cost and high performance, as well as low power consumption, being highly efficient in terms of power consumption. Moreover, it could operate in different low-power modes, allowing for extended battery life for the designed portable system. Added to this, for the ESP32, a lot of documentation and developed code is available, as well as libraries for many commercial sensors, such as those used in this project. Moreover, the system included an 8 MB flash memory for storing the program and the data measured by the different sensors over long periods of time. Together with the microcontroller, the SIM7000G communication module was included, which, in addition to allowing the use of the LPWAN NB-IoT network for the transmission of measured sensor data wirelessly, supported other technologies such as LTE-M, GSM or EGPRS in case there was no NB-IoT coverage. The module has low power consumption, a small size, high performance, is economical and gives a lot of flexibility because it allows for different communication protocols, such as MQTT, TCP or UDP. Furthermore, it has a power-saving mode to further extend battery life. To achieve precise control of the environmental conditions of refrigerated perishable products and ensure their quality and durability throughout the supply chain, it was essential that the instrumentation system designed was robust and used the appropriate sensors to obtain accurate and reliable measurements of the parameters to be measured. In this case, the monitoring of temperature, relative humidity, luminosity, vibrations and CO\({}_{2}\) concentration was desired. For the sensors, the main characteristics looked for were low cost and low power  
Figure 1: Block diagram of the architecture of the designed solution. consumption while performing the measurements, as well as having good measurement accuracy and facilitating the final design of the system to be small in size. To measure temperature and relative humidity, the SHTC3 from a Sensirion (Laubisruetstrasse, 50, Stafa, Switzerland) sensor [58] was chosen since it has a low cost with an accuracy of 0.2 \({}^{\circ}\)C in terms of temperature and 2% in terms of relative humidity, as well as a resolution of 0.01 \({}^{\circ}\)C and 0.01% RH and a range of \(-\)40 to 125 \({}^{\circ}\)C and 0 to 100% RH, apart from having a low power consumption of 2.7 \(\mu\)A. This sensor communicated with the microcontroller via I\({}^{2}\)C. To measure luminosity, the BH1750 from ROHM Semiconductor (Sain Mizosaki-cho, 21, Kyoto, Japan) luxmeter [59] was chosen, a sensor with good accuracy (0.11 lx) based on a photodiode with a 16-bit digital output that allows for the measurement of illuminance between 1 and 65,535 lx. It is also highly efficient in terms of power consumption, allowing low power consumption during operation (60 \(\mu\)A), making it ideal for battery operation. It allows I\({}^{2}\)C communication and has a high resolution of up to 1 lx and fast measurement capability. For vibration measurement, the ADXL345 from Analog Devices (Analog Way, 1, Wilmington, MA, USA) accelerometer [60] was used, which features high measurement accuracy and a low power consumption of about 15 \(\mu\)A. It allows for the measuring of acceleration in three axes with ranges of \(\pm\)2 g/\(\pm\)4 g/\(\pm\)8 g/\(\pm\)16 g, has a very low current consumption, allows shock and inactivity detection by interruptions and offers I\({}^{2}\)C and SPI communication for data exchange with the microcontroller. In addition, it is compact and features 10-bit resolution with a sensitivity deviation of 15.6 mg/LSB.