# A Novel Software Architecture Solution with a Focus on Long-Term IoT Device Security Support
## 4 Device Architecture
### Improving the Hardware Layer  
The intelligent beverage cooling system was developed in cooperation between the company Oprema d.d. and Zagreb University of Applied Sciences within the project \"Development of the new generation Eco Smart product of the company Oprema d.d.\", funded by European Union [37]. One of the final versions of the device is shown in Figure 5:  
A new type of microcontroller is introduced for the implementation of telemetry in the device. The motherboard is introduced with the ESP32 microcontroller, as it supports two modes of operation of the wireless module and has two CPU cores, one of which is responsible for the operation of the device and data acquisition and processing, and the other is responsible for the connection with the cloud or mobile application. The idea was to introduce a new microcontroller to an existing motherboard, avoiding additional cost. The test phase is shown in Figure 6.  
During implementation, additional fixes were made to the motherboard as the new microcontroller eliminated the need for other electronics required by the previous microcontroller. For example, the new microcontroller has integrated multiple 12-bit analogue/digital converters and has fast EEPROM memory. In order to provide a smart upgrade for previous version devices and simplify service procedures, the goal of the project was to retain all sensors and wiring from the previous device. The upgraded motherboard is shown in Figure 7. This chapter presents the upgrades that were achieved to meet the proposed goals. The device uses six NTC thermistor sensors. The testing of temperature deviation was carried out at the Zagreb University of Applied Sciences and in the laboratories of the company Oprema d.d. The measurement was performed by reading data from the microcontroller delivered to a database server. Simultaneously, with the operation of the device, calibrated temperature sensors DS18B20 [38] were installed via the I2C bus. The sensors were connected to a microcontroller and delivered data to the same database server over the wireless network. The temperature obtained from the device was compared with the actual temperature measured by the calibrated sensor. Figure 5: Beverage cooling device upgraded with smart option produced by Oprema d.d. Experiments showed that a previous model of the device had slight deviations around the reference temperature of the NTC thermistor (25 degrees Celsius) and significant deviations (several degrees Celsius) around the expected temperature of the bath-cooled substance. The NTC thermistor used by the device is ELIWELL SN8 SDED11502C0 [39]. In the component data sheet, the resistance is given as 10 kOhm at 25 degrees. The resistance changes depending on the temperature according to the specification table given by the manufacturer. The slope of the curve depends on the coefficient of the NTC thermis  
Figure 6: Testing concept: introduce a new microcontroller on previous device version motherboard. Figure 7: New motherboard with relay switching option. tor. To calculate the temperature accurately, the previous device uses the Steinhart-Hart Equation (1):  
\[\frac{1}{T}=A+Bln(R)+C(ln(R))^{3} \tag{1}\]  
The coefficients \(A\), \(B\), \(C\) are the Steinhart-Hart coefficients determined by the factory settings of the sensor. \(R\) is the resistance value that will be calculated by the microcontroller. \(T\) is the determined temperature. The voltage on the pin of the microcontroller generated on a resistor of the parallel divider is proportional to the value \(R\). In the divider, one of the resistors is fixed and accurate while the other resistor is an NTC thermistor. In the device schematic, the NTC thermistor is connected in a divider with a fixed and accurate resistance of 10,000 ohms. The read value is multiplied by 500 (the referenced voltage on previous version microcontroller increased by the required accuracy of two decimal places) and divided by the maximum number value of the analogue/digital converter.