# An Efficient Adaptive Data-Link-Layer Architecture for LoRa Networks
## 5 Results and Discussion  
For evaluation of the proposed solution in a real-world scenario, the end node functionalities were implemented in a printed circuit board (PCB) based on the STM32L0 microcontroller, with an RFM95W LoRa module and a soil moisture sensor connected to it, while the packet forwarder used the same LoRa module but was connected to a Raspberry Pi Zero W and resorted to Wi-Fi to send the received packets to the web server using the CoAP (constrained application protocol) application layer protocol. Figure 9 shows the hardware implemented for these two LoRa devices. The Raspberry Pi Zero W module is compatible with the IEEE 802.11 b/g/n wireless LAN standards. The maximum bit rate supported by the IEEE 802.11g standard is 54 Mbps, and the IEEE 802.11n allows even higher bit rates. According to Equation (3), the maximum LoRa bit rate is less than 22 kbps. That means that the Wi-Fi bit rate is several orders of magnitude higher than the necessary to forward the packets to the Web server. This is expected, since Wi-Fi is a wireless network optimized for performance, whereas LoRa is optimized for low resource requirements (such as energy consumption, since the LoRa-based end nodes are normally designed to operate with batteries). On the other hand, the packet forwarders are designed to be connected to the power grid, so they do not have the same restrictions. Regarding the implementation of the MAC protocol, it supports up to 65,535 packet forwarders, where each network was configured to support up to 254 end nodes. Notice that this limitation is due to the use of a 8-bit short end node address and the reservation of two addresses. In terms of network scalability, the number of supported end nodes may be higher, as explained in the next paragraph. The data consists of a fixed 4-byte payload (implicit header mode) that contains soil moisture information, and the superframe period and data packet interval were set to the same value (1 h). Table 1 shows an example of the values of relevant fields of the packets presented in Figure 7 for this application scenario. The maximum number of end nodes supported by a network in the proposed solution is application-dependent. It will depend on several parameters configured by the network administrators with the help of the LoRa parameter calculator. Each end node reserves a superframe slot in the proposed MAC protocol. According to Equation (7), the number of slots generated by the MAC protocol increases in powers of two (2, 4, 8, and so on). Therefore, as an example, with a maximum ToA of 4000 ms (4 s) and the MAC superframe period (and data packet interval) of 1 h (3600 s), which is the value adopted in the implemented prototype, the maximum number of end nodes supported by the network would be 512 (the highest power of two below 900). Figure 9: Hardware of the end node (on the left) and the packet forwarder (on the right). The network parameters were obtained by feeding the LoRa parameter calculator the maximum ToA of 1000 and 4000 ms, packet size of 8 bytes, coding rate of 4/5, and processing time needed to perform an iteration of the ASFS algorithm by the gateway of 10 \(\upmu\)s. During each iteration, the algorithm finds the available options and selects those that fit the criteria, providing them to the user in a CSV file. The user may then decide if they want a lower link budget that provides a faster and more energy efficient option, allowing also more messages to be sent per superframe, or the opposite option, which maximizes the range at the cost of lower data rate and energy efficiency. These two options can be observed in Table 2.  
By observing Table 2, we can also note how the proposed ADL mechanism is able to provide a more efficient use of the medium and a smaller end node's energy expense, in comparison to approaches that do not adjust the SF dynamically and, especially those that used the same fixed SF value for all the end nodes.