# Rural Healthcare IoT Architecture Based on Low-Energy LoRa
## 4 System Architecture
### Utilizing ULP Timer  
ULP timers consume electric current measured in nano-Ampere. Unlike timers that use quartz crystals, these chips have an error rate of around 1%. We proposed the use of ULP timers for IoT devices. We have measured the possibility of up to 45 times battery extension when using TPL5111 [49] chip, compared to microcontroller's built-in ULP, for IoT nodes that are active up to 1 min per day [50]. Such nodes are primarily used to monitor environmental conditions that need infrequent measurements. The TPL5111 chip was used in combination with a DC-DC (buck) converter as a voltage regulator. The ULP timers control the power supply tough the chip enable pin on the DC-DC converter. Thus  
Figure 6: Energy savings by combining data in a single data frame. Figure 7: Energy savings by combining data and writing to persistent storage. the microcontroller is completely shut off during the sleep cycle, and a separate wake-up circuit is needed to start the node before the timer expired. The TPL5111 has a DONE pin that the microcontroller can use to send a shutdown signal when it wants to start the next sleep cycle. Ultra-low-energy timers do not use quartz crystals for measuring time due to the energy conservation goals. In the case of TPL5111 [49], the time is proportional to an external resistance. Knowing that resistance components are usually sensitive to environmental conditions, such as temperature, we can assume that such timers cannot have a precision comparable to the quartz crystal-based circuits. In many cases, we do not need such precision. For example, activating sleep monitoring sensors should be done some time in the evening and does not require second or minute precision. Due to the imprecision of the timer, when the sensor measures a physical parameter, timestamping should be relative to the start of the microcontroller's internal clock. When transmitting the data to the healthcare gateway, device up-time should also be sent to allow the gateway to correct the timestamp to the absolute time of the network. While the ESP32 microprocessor has multiple low-energy states offering a balance between available resources and power efficiency, the expected energy efficiency is often not fully utilized by the microcontroller manufacturer. Not all peripherals take advantage of all the available power management. In reality, microcontrollers come with peripherals that either do not have low-power states or do not fully take advantage of those states when the microprocessor cannot use them. The most obvious example of energy waste is voltage regulators that rely on heat dissipation to provide the required voltage. Even when the microprocessor uses ultra-low power, the voltage regulator could waste energy orders of magnitude greater. This is evident from our experimental measurements shown in Table 1, conducted on Helteh's Wireless Stick microcontroller. When the wireless stick has entered low-power mode, when the power is provided using switching converter on 3.3 V, the native voltage of the electronic components, with the input voltage to the converter of 5.00 V, the current is 2.27 mA, and the power consumption is 11.35 mW. However, when the device is powered using 5 V via the 5 V pin or the USB power, the power consumption is much higher, 81.04 mW and 65.13 mW respectively. The lowest current we were able to measure on the Wireless Stick was 2.27 mA; however, the expected current, if we take only the microprocessor ESP32, on which this microcontroller is based, in the hibernation mode, is 2.5 mA [36]. Let \(C\) is the battery capacity, \(I_{ON}\) is the average current used during the active state of the microcontroller, and \(I_{ULP}\) is the current consumed in sleep state, and \(x\) is the number of minutes in a day that the device is active. The battery lifetime in days \(T\) is expressed in Equation (3). We add the 24 h in the denominator to obtain a result in days. As the