esib_iot_challenge
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
esib_iot_challenge [2017/05/17 09:11] – created samer | esib_iot_challenge [2021/08/28 09:53] (current) – samer | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== ESIB IoT Challenge ====== | ====== ESIB IoT Challenge ====== | ||
- | Starting from September 2016, Saint-Joseph University of Beirut (USJ) will be deploying | + | Welcome to the ESIB IoT Challenge. In this challenge, you will be designing and prototyping |
+ | |||
+ | ===== - Platform ===== | ||
+ | |||
+ | During this challenge, | ||
* Devices that communicate to one or more gateways via a wireless interface using single hop LoRa and implementing the LoRaWAN protocol. These devices are physically connected to sensors that generate data. | * Devices that communicate to one or more gateways via a wireless interface using single hop LoRa and implementing the LoRaWAN protocol. These devices are physically connected to sensors that generate data. | ||
Line 9: | Line 13: | ||
[{{ : | [{{ : | ||
- | ===== -. Devices ===== | ||
- | ==== -. Autonomo with LoRaBee ==== | ||
- | Starting | + | <WRAP center round help 100%> |
+ | * Where is the LoRa modulation implemented on the platform? | ||
+ | * What are the advantages of the LoRa modulation? | ||
+ | * How LoRa is compatible | ||
+ | * What is LoRaWAN? What is the difference between LoRaWAN and LoRa? | ||
+ | * Illustrate the protocol stacks on the LoRaWAN platform. | ||
+ | * What elements are IP enabled in the platform? What do you think about IP support in IoT? | ||
+ | </WRAP> | ||
+ | ===== - Backend ===== | ||
+ | In a LoRaWAN network, the devices communicate | ||
- | In order to configure the Autonomo with LoRaBee device, you should follow these steps: | + | [{{ :app-loraserver.png? |
- | | + | Start by choosing the application named '' |
- | - Install the board files as noted in [[http:// | + | * A unique node name: '' |
- | - Add the following library {{ : | + | * The node description |
+ | * A unique device EUI on 64 bits: Random identifiers can be generated on [[https:// | ||
+ | * The application EUI on 64 bits: '' | ||
+ | * A unique application key on 128 bits also obtained by random generation. | ||
+ | |||
+ | Make sure that the '' | ||
- | Now you are ready to write a sketch for the device. Here is one example sketch {{ : | + | <WRAP left round help 100%> |
+ | * What does the application EUI mean? How is it used in LoRaWAN? | ||
+ | * What does the application key mean? How is it used in LoRaWAN security? | ||
+ | * Compare the two device activation methods used in LoRaWAN by giving the advantages | ||
+ | * What is the difference between the two receive windows in LoRaWAN? What are they used for? | ||
+ | </ | ||
+ | ===== - Devices ===== | ||
- | In this part, you should put the keys for Over-The-Air Activation (OTAA) | + | Devices in the LoRaWAN platform are implemented on Arduino boards with Dragino shields. |
- | <code c++> | + | |
- | // USE YOUR OWN KEYS! | + | |
- | const uint8_t devEUI[8] = | + | |
- | { }; | + | |
- | // USE YOUR OWN KEYS! | + | Start by verifying the installation on your PC of the latest Arduino IDE. Drop the Arduino LMIC library in the corresponding folder. These tools are provided at the beginning of the challenge. Open the example sketch '' |
- | const uint8_t appEUI[8] = | + | |
- | { }; | + | |
- | const uint8_t appKey[16] = | + | <WRAP left round help 100%> |
- | { }; | + | * Give the characteristics of the Arduino you are using: model, number of pins, type of pins, memory sizes, etc. |
- | </code> | + | * Give the main characteristics of the LoRa shield from Dragino (www.dragino.com). |
- | + | * What type of Antenna are you using? Explain the corresponding characteristics. | |
- | The pins for connecting | + | </WRAP> |
- | <code c++> | + | |
- | int light_pin = A0; | + | |
- | int moisture_pin = A2; | + | |
- | int temperature_pin = 0; | + | |
- | int temperature_vcc_pin = 1; | + | |
- | int moisture_vcc_pin = 8; | + | |
- | int moisture_gnd_pin = 7; | + | |
- | </code> | + | |
- | The OTAA method is used for joining | + | Now you should configure your device with the same identifiers '' |
- | <code c++> | + | |
- | LoRaBee.initOTA(loraSerial, | + | |
- | </ | + | |
- | Eight different sub channels are activated with data rate ranges from 0 to 5: | ||
<code c++> | <code c++> | ||
- | LoRaBee.configChFreq(0, | + | static const u1_t PROGMEM APPEUI[8]= { }; |
- | LoRaBee.configChFreq(1, 868300000L, | + | void os_getArtEui |
- | LoRaBee.configChFreq(2, 868500000L,0,5,1); | + | |
- | LoRaBee.configChFreq(3, | + | |
- | LoRaBee.configChFreq(4, | + | |
- | LoRaBee.configChFreq(5, | + | |
- | LoRaBee.configChFreq(6, | + | |
- | LoRaBee.configChFreq(7, | + | |
- | </ | + | |
- | Finally, the message containing the sensor values is sent in an unconfirmed uplink message: | + | // This should also be in little endian format, see above. |
- | <code c++> | + | static const u1_t PROGMEM DEVEUI[8]= { }; |
- | LoRaBee.send(1, (uint8_t*)message.c_str(), message.length()) | + | void os_getDevEui |
+ | |||
+ | static const u1_t PROGMEM APPKEY[16] = { }; | ||
+ | void os_getDevKey | ||
</ | </ | ||
- | ==== -. Arduino with Dragino Shield ==== | ||
- | === -. Periodic Message Sending === | ||
- | Devices in the LoRaWAN platform can also be implemented on Arduino boards with Dragino shields. The combined module as well as the basic configuration steps are presented | + | <WRAP left round tip 100%> |
+ | Note that the device and application identifiers should | ||
+ | </ | ||
- | The pin mapping corresponds | + | Let us analyze |
- | <code c++> | + | |
- | const lmic_pinmap lmic_pins = { | + | |
- | .nss = 10, | + | |
- | .rxtx = LMIC_UNUSED_PIN, | + | |
- | .rst = 9, | + | |
- | | + | |
- | }; | + | |
- | </ | + | |
- | The send function is rescheduled TX_INTERVAL seconds after each transmission complete event: | + | <WRAP left round help 100%> |
- | <code c++> | + | * In the setup function, which channels are activated on the device? |
- | case EV_TXCOMPLETE: | + | * What are the different spreading factors on each channel? |
- | | + | * What is the regulation on the radio channels |
- | | + | </WRAP> |
- | // data received | + | |
- | Serial.print(F(" | + | |
- | Serial.write(LMIC.frame+LMIC.dataBeg, | + | |
- | Serial.println(); | + | |
- | } | + | |
- | // Schedule next transmission | + | |
- | os_setTimedCallback(& | + | |
- | break; | + | |
- | </code> | + | |
- | The send function is initially scheduled here: | + | The LMIC library defines a set of events corresponding to the protocol machine state. These events appear in the '' |
- | <code c++> | + | |
- | do_send(& | + | |
- | </ | + | |
- | The message containing the sensor values | + | <WRAP left round help 100%> |
- | <code c++> | + | * What is the difference between |
- | LMIC_setTxData2(1, | + | * When is the EV_TXCOMPLETE event called? |
- | </code> | + | </WRAP> |
- | The adaptive data rate is not supported, and the spreading factor is configured as follows: | + | Finally let us look at the message sending on the device. |
- | <code c++> | + | |
- | LMIC_setDrTxpow(DR_SF7, | + | |
- | </ | + | |
- | === -. Triggered Message Sending === | + | <WRAP left round help 100%> |
+ | * What is the function for sending messages on the device? How it is called? | ||
+ | * What is the period of message sending? Explain the implementation choice. | ||
+ | * Is this period guaranteed according to the LoRaWAN specification? | ||
+ | </ | ||
- | You can also find another example of sketch | + | Now you are ready to compile |
- | ===== -. Gateways ===== | + | |
- | ==== -. Single Channel Gateway ==== | + | |
- | The single channel gateway includes a LoRa transmission module (Dragino Shield) connected to a Raspberry Pi (2 or 3) as shown in Figure 2. Communication between the two modules is done over an SPI interface. | + | <WRAP left round tip 100%> |
+ | For Arduino Mega 2560, additional drivers can be installed on Windows from http://wch.cn/ | ||
+ | </ | ||
- | [{{ : | + | Open the serial monitor in the Arduino IDE at 115200 baud and analyse the debug messages. |
- | In order to assemble | + | <WRAP left round help 100%> |
- | [{{ : | + | * What is the radio transmit parameters of the captured debug messages? |
- | [{{ : | + | * What is the radio receive parameters of the captured debug messages for the two receive windows? |
+ | </ | ||
- | Connect the Raspberry Pi to the Internet and install the packet forwarding software. The source code of the single channel packet forwarder is available on: [[https:// | + | Getting back to the backend, you can monitor some important information related |
- | * Enable SPI on the Raspberry Pi using raspi-config | + | |
- | * Download and unzip the source code: | + | |
- | <code bash> | + | <WRAP left round help 100%> |
- | wget https:// | + | * What are the different fields that appear in the node session corresponding to you device? |
- | unzip master.zip | + | * Explain how each field is created according to the LoRaWAN specification. |
- | </code> | + | * What are the different counters visible at the backend? Explain how they get incremented and how they are used. |
+ | </ | ||
+ | ===== - Applications ===== | ||
+ | mqtt-spy is an open source utility intended to help you with monitoring activity on MQTT topics. It has been designed to deal with high volumes of messages, as well as occasional publications. mqtt-spy is a JavaFX application, | ||
+ | You can use mqtt-spy to debug the messages received from the LoRaWAN devices. The tool is provided at the beginning of the challenge. After starting the application, | ||
- | | + | <WRAP left round help 100%> |
+ | | ||
+ | * What are the possible strengths and weaknesses in terms of security of MQTT? | ||
+ | * What are the different types of topics used by the backend? Explain. | ||
+ | * Explain the different fields in a captured MQTT message received from you device. | ||
+ | </ | ||
- | <code bash> | + | <WRAP left round tip 100%> |
- | apt-get update | + | The payload received by the MQTT client is decrypted but encoded in Base64. You should decode it to get the original message. |
- | apt-get install wiring | + | </WRAP> |
- | </code> | + | |
- | Compile | + | If you need to send data to your device, you should publish |
- | <code bash> | + | |
- | make all | + | |
- | </code> | + | |
- | For gcc version 4.6.3, a compilation error results in the following warning '' | ||
< | < | ||
- | CFLAGS = -std=c++0x -c -Wall -I include/ | + | { |
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
</ | </ | ||
+ | ===== - Day One Challenges ===== | ||
- | Now, you need to configure | + | ==== - The End-to-End Challenge ==== |
+ | I can send data from the device | ||
- | Finally, you can run the packet forwarder as root! | + | ==== - The Downlink Challenge ==== |
+ | I can send data from the application to the device. | ||
- | < | + | ==== - The Radio Challenge ==== |
- | nohup ./ | + | I can tune the LoRa radio parameters and assess the results. |
+ | |||
+ | These two commands can be helpful when used after the join event: | ||
+ | |||
+ | < | ||
+ | LMIC_disableChannel(N); | ||
+ | LMIC_setDrTxpow(DR_SF12, | ||
</ | </ | ||
- | ==== -. Kerlink IoT Station | + | ==== - The Sensor Challenge |
+ | I can use different sensors to send data from the device: PIR, moisture, temperature, | ||
- | < | + | ===== - Day Two Challenges ===== |
- | # activates eth0 at startup | + | |
- | ETHERNET=yes | + | |
- | # claims dhcp request on eth0 | + | |
- | ETHDHCP=yes | + | |
- | # Selector operator APN | + | ==== - The Wind Rises ==== |
- | GPRSAPN=gprs.touch.com.lb | + | |
- | # Enter pin code if activated | + | |
- | GPRSPIN=0000 | + | |
- | # Update / | + | |
- | GPRSDNS=yes | + | |
- | # PAP authentication | + | |
- | GPRSUSER= | + | |
- | GPRSPASSWORD= | + | |
- | # Bearers priority order | + | This is a mandatory challenge. It consists of using [[https:// |
- | # | + | |
- | BEARERS_PRIORITY=" | + | |
- | </code> | + | |
- | < | + | ^ Provided material ^ |
- | ./gps-pkt-fwd.sh > /dev/null & | + | | VM with Node-RED installed | |
- | </ | + | | Node-RED example flow | |
+ | | [[https:// | ||
- | < | + | ^ Required skills ^ |
- | 3270 root 2548 S /bin/sh ./ | + | | Basic javascript | |
- | 3288 root 34908 S ./ | + | | GUI configuration | |
- | </ | + | | Two drops of IoT design | |
+ | ==== - Nausicaa Challenge ==== | ||
- | < | + | You have to take control on the devices. Use some scripting to send commands or tune some parameters on the devices. |
- | /etc/init.d/gprs start | + | |
- | [root@Wirgrid_0b03008c demo_gps_loramote]# | + | ^ Required skills ^ |
- | pppd (pid 5273) is running... | + | | Basic scripting |
- | Session: Rx=58, Tx=163 | + | | Basic electronics | |
- | Globals: Rx=1130457, Tx=1195592 | + | | Two drops of IoT autocracy | |
- | Sum: | + | |
- | [root@Wirgrid_0b03008c demo_gps_loramote]# | + | |
- | </ | + | |
- | ===== -. Backend ===== | + | ==== - Totoro Challenge |
- | ==== -. Loraserver | + | |
- | The Loraserver has a web interface for configuring the applications and devices on the platform. Full details for installing the software are provided on [[https:// | + | You have to store the sensor data in a database. Use Node-RED to inject data in a (influx) database. |
- | [{{ : | + | ^ Required skills ^ |
+ | | Basic database | | ||
+ | | Two drops of IoT resilience | ||
- | Start by creating and application as in Figure 5. Then create a node in this application and provide the following information: | + | ==== - Kiki Challenge ==== |
- | * A unique node name | + | |
- | * The node description | + | |
- | * A unique device EUI on 64 bits: Random identifiers can be generated on [[https:// | + | |
- | * The application EUI on 64 bits: this can be a common identifier for all nodes using the same application. | + | |
- | * A unique application key on 128 bits | + | |
- | In order to enable OTAA join method, you have to make sure that the '' | + | You have to implement a radio coverage test on the campus. |
+ | ^ Required skills ^ | ||
+ | | Basic scripting | | ||
+ | | Two drops of IoT ubiquity | | ||
+ | ==== - Mononoke Challenge ==== | ||
- | ==== -. The Things Network ==== | + | You have to implement a chat bot designed for working with Google Hangouts. The bot answers requests and reveals sensors data. |
- | ===== -. Applications ===== | ||
- | ==== -. mqtt-spy ==== | ||
- | mqtt-spy is an open source utility intended to help you with monitoring activity on MQTT topics. It has been designed to deal with high volumes of messages, as well as occasional publications. mqtt-spy is a JavaFX application, | + | ^ Required skills ^ |
- | You can use mqtt-spy to debug the messages received from the LoRaWAN devices. For this, you should download the software tool from [[https:// | + | | Basic scripting |
- | ==== -. Emoncms ==== | + | | Two drops of IoT robot attitude | |
esib_iot_challenge.txt · Last modified: 2021/08/28 09:53 by samer