# Design and Implementation of a Mixed IoT LPWAN Network Architecture
## 2 Related Technologies
### LoRa  
LoRa (Long Range modulation technique) [27] is a solution for LPWAN networks based on spread spectrum transmission techniques and CSS modulation (Chirp Spread Spectrum). It was designed in 2010 by the French startup Cycleo, which was acquired by the semiconductor manufacturer Semtech Corporation in 2012, who is currently the owner of the technology, has registered the LoRa brand and maintains all rights. The business model consists of obtaining benefits for the LoRa radio chipset, leaving the final user or an intermediary with the deployment and management of the network for connected objects. The LoRa specification only describes the physical layer (PHY). As link layer (MAC) is available LoRaWAN (LoRa for Wide Area Networks). It is the open source proposal of the LoRa Alliance that can be used freely in own developments for both devices and gateways. Figure 4 shows the layered organization of LoRa and LoRaWAN. The LoRaWAN protocol includes encryption, authentication, adaptive speed and error correction [28]. The radio chip covers the frequencies between 150 and 960 MHz allowing operation in most ISM bands around the world. The LoRa modulation uses a signal called chirp that changes frequency continuously sweeping the entire width of the radio channel which is typically 125 KHz. By adjusting the Spreading Factor (SF), Bandwidth (BW) and Coding Rate (CR) parameters, a compromise solution can be reached between data rate, link budget, interference immunity and spectrum occupancy. Each bit of information is represented by multiple sweeps or symbols, and the relationship between the speed of symbol transmission and the duration of the sweep is the Spreading Factor, with typical values of 7 to 12 corresponding to bit rates of 11000 bps to 250 bps also called Data Rate (DR0-DR6). At higher SF values the effective transfer rate is reduced but the robustness of the link is increased. Also in order to increase it, cyclic error coding is used with possible values from 4/5 to 4/8 for detection and correction of errors assuming an overload ratio between 1.25 and 2. The use of a greater bandwidth allows increase speed, but also reduces sensitivity and is conditioned by the regulations of each region [29]. LoRa technology is able to demodulate signals 19.5 dB below the noise level, unlike most systems using FSK (Frequency Shift Keying) modulation that need a signal 8-10 dB above the noise level, being able to achieve distances of 6 km in urban environments and 18 km in rural scenarios with total link loss of up to 154 dB and receiver sensitivity of \(-142\) dBm [30]. An added feature of LoRa is the ability to demodulate several signals simultaneously on the same frequency if they have different SF, thus creating different virtual channels and increasing the capacity of the gateway. In Europe, 3 mandatory channels are established for all the gateways in 868.100 MHz, 868.300 MHz and 868.500 MHz. In addition, others can be defined according to the operation policy of each network. Three categories of devices are defined [31]:  
* Class A: They are kept in energy savings most of the time. After sending information they maintain two reception windows and return to standby. They cannot receive data at any time. Figure 4: Layer model for LoRa and LoRaWAN. * Class B: Communication at regular intervals by synchronization with a beacon. Although they do not need to send data, they wake up periodically to receive from the network. * Class C: Continuous link to the network. They can receive and send data at any time. Figure 5 shows the fields that make up a LoRaWAN uplink frame both physically and at the MAC layer level. It can be seen in Figure 6 that the downlink frame does not include integrity checking at the physical level to keep messages as short as possible and reduce their impact on the limitations of the operation cycle in the ISM bands. The payload can be a maximum of between 51 and 222 bytes, depending on the SF and both in the uplink and downlink [32]. Each device has a unique and permanent 32-bit identifier called DevEui.