Demo of the project
Register to The Things network and create a new application and register at least 2 devices. I suggest you to follow the official documentation here and then here. Please take note of your application key, devices keys and so on, we will need them.
Register to IoT lab and configure your SSH access. Login to a lab having LoRa nodes, i.e scalay.
ssh <login>@saclay.iot-lab.info
Clone the RIOT github folder:
git clone https://github.com/RIOT-OS/RIOT.git -b 2019.01-branch
Authenticate to the lab
iotlab-auth -u <login>
Submit an experiment
iotlab-experiment submit -n riot_ttn -d 40 -l 2,archi=st-lrwan1:sx1276+site=saclay
Get your assigned nodes id. Please take note of your nodes id.
iotlab-experiment get -i <exp_id> -r
Add the gcc version 7 to the path of the ssh frontent:
export PATH=/opt/gcc-arm-none-eabi-7-2018-q2-update/bin:$PATH
Clone my solution for riot
git clone https://github.com/stefanofoti/iot-assignment.git
Enter in the project just cloned and then in LoRa project directory. Adjust the riotbase path in the makefile to your riot folder cloned in the previous step.
Compile everything setting up your DEVEUI, APPEUI, APPKEY (you can also define them in the makefile).
make -C your_folder/project_folder clean all DEVEUI=YOUR_DEVEUI APPEUI=YOUR_APPEUI APPKEY=YOUR_APPKEY
Push your binary.elf file
iotlab-node --update your_folder/project_folder/bin/b-l072z-lrwan1/file.elf -l saclay,st-lrwan1,REPLACE_WITH_FIRST_NODE_ID
Repeat those 2 steps for each LoRa device you need. In this example we will do it for two nodes.
Connect with netcat to each node to see the logs, i.e.
nc st-lrwan1-YOUR_NODE_ID 20000
Edit the MQTT Bridge
Edit the subs.py file, put the connection strings of yout Azure IoT Devices, and the details of your The Things Network application as suggested.
Devices are sending values via LoRa network. The Things Network will collect those values and expose with a built in MQTT broker. Connect to the things network dashboard, surf to Data: you will see the messages coming from the devices.
Start the bridge.
python subs.py
The bridge subscribes to the TTN MQTT broker and every time receives a message sends it to the Azure IoT hub.
Connect to the dashboard, you should see your values being updated.
Comments
Please log in or sign up to comment.