Sensor Node Mode

In the demo firmware, the sensor node mode delivers sensor node functionality. The timer module provides time reference in the application. The timer is configured to generate overflow interrupt for every 1 msec. In sensor node mode, the sensor node goes through the following three different phases for successful operation in the LoRa network.

Sensor Node Start-Up:

The sensor node start-up is the first phase to start with, as soon as the sensor node enters in sensor node mode of operation. In start-up stage, the LCD screen of the XMEGA-A3BU Xplained displays the various methods of linking a sensor node to a LoRa network. Then after, the application waits for the user response on suitable method.

Sensor Node Joining:

In sensor node joining phase, the sensor node joins in a LoRa network through a personalization and activation process. The application firmware allows the users to manually choose between ABP and OTAA methods for sensor node activation, using push buttons SW0 and SW1 respectively.

Sensor Node Running:

Once the sensor node is successfully joined in a LoRa network, it continues to operate in this phase. In the sensor node running phase, the LCD screen displays the menu of various user configurable sensor node parameters. These parameters are listed in Table 1. The application monitors for a button press event on SW0/SW1. To an arbitrary button press event on either SW0 or SW1, the application enters into the sensor node parameters configuration mode. After the sensor node parameters configuration, the application monitors for any button press event until the inactivity counter gets elapsed.

If no button press event is reported during the inactivity period, the application checks for any periodic data transmission trigger event. After the data transmission event is triggered, the application enables the ADC module. The ADC module performs parallel data acquisition of the temperature and light sensors for sixteen successive iterations. The DMA controller stores the averaged sensors data in data buffers without any CPU intervention. Then MCU disables ADC, Event System, DMA controller and transmits the data to the RN2483 module through the UART interface.

The RN2483 module transmits data to the TTN server through the LoRa gateway. Upon reception of acknowledgment from the TTN server, the MCU enables the RTC module, disable all other peripherals and goes into power down mode.

The MCU wakes up from sleep either to an SW2 button press event or to an RTC interrupt after the sleep period is elapsed. Then after, the application re-enables the USB and UART modules and continues with the sensor node running phase.

Figure 1 shows the application flow of the sensor node firmware.