## 3 Design of the Wirelessly Activated Node
### Node Operations  
The selected MCU is a STM32L476 RE with 512 kB of flash memory and 128 kB of RAM (random access memory). Of these, approximately 36 kB of flash are used for the code and 16 kB of RAM for the data. This leaves a large amount of flash memory available for either extending code to implement additional on-board processing and/or data logging, without requiring the use of an external memory. In addition, the MCU has been chosen for its exemplary trade-off between power and performance. Clock frequency up to 80 MHz allows fast execution of code to minimize on-time, without sacrificing power consumption (39 uA/MHz). At the same time, it implements several sleep/shutdown modes allowing for reducing power consumption down to 1.1 uA (stop mode) and 30 nA (shutdown mode).  
Figure 3: **(a)** Block diagram of the overall system, comprising of the transmitting part (illuminator and LoRa communication gateway), and the wireless sensor node; **(b)** operational modes of the sensor node; colors show which components are active in the different phases.  
Digital (I2C, SPI (serial peripheral interface), UART (universal asynchronous receiver-transmitter)) and analog peripherals (three 12-bits ADCs (analog to digital converters), two 12-bit DACs (digital to analog converters), two PGAs (programmable gain amplifiers), and two ultra-low-power comparators also allow for extending the sensing capabilities of the node to interface to a plethora of analog and digital sensors. The node can operate in the following modes (depicted in Figure 3b):  
* START-UP: when power is available at the input, but the storage element is depleted, an undervoltage-lockout (UVLO) circuit keeps the load disconnected from the storage elements until it gets charged up to 2 V. During start-up, only charging operation occurs to minimize losses and charge time and to avoid deadlock conditions, which could happen with an extremely low input power level.
* POWER-ON: when the storage element voltage is above 2 V, the node turns on for the first time and transmits a short package to the gateway of the WSN to signal its presence in the system. The gateway replies with an acknowledgment. The MCU programs the real-time clock (RTC) to wake up the node after the scheduled time. The RTC puts the node in an ultra-low-power sleep mode by cutting off the power supply to the load.
* SLEEP MODE: only the RTC is on, with the node power consumption given by the RTC itself and the PMOS (p-type metal oxide semiconductor) load switch leakage currents. Overall current consumption is below 150 nA. The power management section keeps charging the storage element until it reaches the maximum voltage or 3.3 V.
* ACTIVE MODE: after the programmed sleep time has passed, the RTC awakes the node, and the MCU starts acquisition of accelerometer and temperature data over a 1-s window, processes it (for simplicity, we limit ourselves to minimum, maximum and average on the three-axis in this example), and sends the data to the gateway. The gateway replies with an acknowledgment and, eventually, information on the next wake up time. The node programs the RTC and goes back to sleep mode until the RTC wakes it up again.  
The protocol is based on LoRa, a low-power, long-range, single-hop wireless communication technology that has been developed for low-power wide-area networks (LPWAN). Originally, sub-GHz industrial, scientific and medical (ISM) bands were adopted, while, more recently, a LoRa solution operating in the 2.4 GHz ISM band has been introduced.  
As proof of concept, we implemented a relatively simple ALOHA communication protocol on a star-topology network. However, more complex ones can be implemented by updating the firmware on the nodes. For this application, given the large disparity between the EH and communication link budgets, the parameters that allow maximum efficiency in terms of energy consumption have been adopted. In particular, Spreading Factor was set to 5, Bandwidth to 1625 kHz, Code Rate to 4/5.