Analysis of Lora and Bluetooth Low Energy to Create Networks for Iot
Total Page:16
File Type:pdf, Size:1020Kb
MASTER OF TELECOMMUNICATION SYSTEM ENGINEERING UNIVERSIDAD POLITÉCNICA DE CARTAGENA End-of-Master’s Project Analysis of LoRa and Bluetooth Low Energy to create networks for IoT. AUTHOR: RAFAEL PÉREZ CAMPOS DIRECTOR: DAVID A. SÁNCHEZ HERNÁNDEZ CO-DIRECTOR: MIGUEL ÁNGEL GARCÍA FERNÁNDEZ Cartagena, September 2019 2 Acknowledgements This work has been developed thanks to the help provided by my directors, that is, David Sánchez and Miguel A. García. They have been my guides in this unknown way, at least, in the beginning. Furthermore, they have been always willing to solve all my doubts, whatever it is. I also want to give thanks to the University of Cartagena, as WPAN and IoT interested me after being accepted as an intern. I will be always grateful for having enjoyed it, as I would have never thought that my first work experience would be offered by the University. I would say this experience has been one of the best experience as an engineer that I have ever had. And I am going to give thanks to EMITE, the whole team, for being part in this project. Some of the work I have developed depended on resources and knowledge, which I had not. However, I could count on their help whenever I needed it. What is more, this investigation has given me the opportunity to carry out an investigation in practice, and so I have learnt how companies really work. Finally, I must not forget to give thanks to the person who has been on my side in every singular fight that I have had, and whose name is Óscar Ortega. Both he and me wanted to add a victory every day. 3 4 Index 1. INTRODUCTION ........................................................................................................... 14 1.1. INTERNET OF THINGS ...................................................................................................... 14 1.1.1. Personal Area Networks (WPAN) .......................................................................... 15 1.1.2. Different technologies for IoT ................................................................................ 16 1.2. UTILIZED HARDWARE ...................................................................................................... 20 1.2.1. To create a LoRa network ...................................................................................... 20 1.2.2. To create a BLE WPAN ........................................................................................... 23 1.3. UTILIZED SOFTWARE ....................................................................................................... 26 1.4. DESCRIPTION OF THIS PROJECT .......................................................................................... 28 1.4.1. Purpose .................................................................................................................. 28 1.4.2. Status of the issue .................................................................................................. 28 1.4.3. Objectives .............................................................................................................. 29 1.4.4. Structure of this document .................................................................................... 29 2. LORA ........................................................................................................................... 31 2.1. LORA PARAMETERS ......................................................................................................... 31 2.1.1. Spreading Factor.................................................................................................... 31 2.1.2. Data Rate ............................................................................................................... 31 2.1.3. Time on Air ............................................................................................................. 32 2.1.4. Adaptive Data Rate (ADR) ..................................................................................... 32 2.2. THE THINGS NETWORK .................................................................................................... 33 2.2.1. Registering a gateway ........................................................................................... 33 2.2.2. Creating an Application ......................................................................................... 34 2.2.3. Registering a Device .............................................................................................. 35 2.2.4. Payload format ...................................................................................................... 36 2.3. LORAWAN ................................................................................................................... 37 2.3.1. OTAA Method ........................................................................................................ 39 2.3.2. ABP Method ........................................................................................................... 40 2.4. KERLINK LORA IOT STATION AS A PART OF A LORA NETWORK ................................................ 40 2.4.1. Updating Firmware ................................................................................................ 41 2.4.2. Packet Forwarder .................................................................................................. 42 2.5. RN2483 MOTE AS A PART OF A LORA NETWORK ................................................................. 43 2.6. TESTING WITH E500 REVERBERATION CHAMBER ................................................................. 45 2.6.1. DUT inside of the chamber .................................................................................... 45 2.6.2. LoRa gateway inside of the chamber .................................................................... 47 3. BLE .............................................................................................................................. 49 3.1. DEFINITION ................................................................................................................... 49 5 3.1.1. BLE vs classic bluetooth ......................................................................................... 49 3.1.2. Main features ........................................................................................................ 49 3.2. 6LOWPAN .................................................................................................................... 50 3.3. ASUS RT-N16 AS A PART OF A BLE NETWORK .................................................................... 52 3.3.1. Installing OpenWRT ............................................................................................... 52 3.3.2. Installing all required packages for both USB Bluetooth support and 6LoWPAN devices support on OpenWRT ............................................................................................. 53 3.3.3. Connecting RT-N16 router with a BLE device (with 6LoWPAN) ............................. 53 3.4. RASPBERRY PI AS A PART OF A BLE NETWORK ..................................................................... 55 3.4.1. Spice up Raspbian for the IoT ................................................................................ 55 3.4.2. Raspberry Pi as an end-device ............................................................................... 58 3.4.3. Setup a native 6LoWPAN router ............................................................................ 60 3.4.4. Raspberry as a router ............................................................................................ 62 4. RESULTS ...................................................................................................................... 65 4.1. LORA ........................................................................................................................... 65 4.1.1. First test to clarify .................................................................................................. 65 4.1.2. Testing in a RC ....................................................................................................... 66 4.2. IPV6 OVER BLE .............................................................................................................. 72 4.2.1. Raspberry as an end-device ................................................................................... 72 4.2.2. Raspberry as a router ............................................................................................ 75 5. CONCLUSIONS ............................................................................................................. 79 5.1. LORA TECHNOLOGY ........................................................................................................ 79 5.2. IPV6 OVER BLE .............................................................................................................. 79 6. FUTURE LINES OF INVESTIGATION ............................................................................... 81 6.1. LORA ........................................................................................................................... 81 6.2. BLE WITH IP .................................................................................................................. 81 7. BIBLIOGRAPHY ............................................................................................................ 83 ANNEX A: DIFFERENT ENVIRONMENTS TO TEST A DEVICE ................................................... 85 A.1 Anechoic Chamber (AC) ........................................................................................