Software apps and online services
Using RIOT MQTT-SN emulated sensors and Paho MQTT-SN Gateway we can easily connect to an MQTT cloud based broker. Let's see how to do it.
The main architecture can be summarized as following, with the introduction of the new entities.
First of all you will need an MQTT broker running on a cloud service online. For more informations you can look at the article related to the first part of this project. Once the broker is ready you can startGateway
RIOT applications use the MQTT-SN protocol, so you'll need a gateway in order to bridge MQTT-SN and the classic MQTT of the broker. You can do this using Paho Transparent Gateway and configuring it.
- Clone the repo and build it using udp6
$ git clone -b experiment https://github.com/eclipse/paho.mqtt-sn.embedded-c
$ cd paho.mqtt-sn.embedded-c/MQTTSNGateway
$ make SENSORNET=udp6
$ make install
$ make clean
- Go into gateway.conf file in../ path and edit it with your specific addresses and ports
This two blocks represent the most important part of the configuration, used to set up the broker IPv4 for the message forwarding part, and the IPv6 address which will be used by the RIOT sensor to transmit data.
- Once the configuration is done we can launch the gateway
The bridge is built, now we have to deal with the sensors part.
RIOT sources will be needed in order to compile the sensor app, so you can choose a reliable path and clone the project repo. We will have to configure the Makefile after.RIOT sensors
Download the all the files contained in this repository. You will obtain all the scripts and files needed to build up the service. Once you've done this open Iot-Project directory and follow the steps:
- Enter the riot_station directory
- Edit the Makefile file setting the correct path for the RIOT source
RIOTBASE ?= <PATH>
- Compile the application using a unique ID
$ make all term EMCUTE_ID="sensor1"
- Configure an IPv6 pubblic address, connect to the gateway and start the station
> ifconfig 5 add fec0:affe::99
> con <GATEWAY-ADDRESS> <GATEWAY-PORT>
- At this point the station is running and sending data. You can start a second one compiling again and giving the station a different ECUTE_ID
You can see the first part of this project at this link.
Project developed as part my MSc degree in Engineering in Computer Science.