Silecs 2018 Hackthon hints
1. Produce data
Run an experiment on the IoT-LAB testbed in order to produce data from sensors nodes, as examples you can follow these tutorials:
- CoAP server with public IPv6/RPL/6LoWPAN network
- Note: update 06-rpl-tsch-coap firmware in order to be able to observer more iotlab-m3 sensors like light/temperature/accelerometer. See 04-er-rest-example
- MQTT-SN with public IPv6 network and A8-M3 nodes
- Custom nodes with LoRaWAN
2. Collect data
Choose a web service which collect and draw your data, as an example we use myDevices:
- Signup on myDevices.com
- Add a new device
- Choose CAYENNE API Bring your own thing
- Write down MQTT USERNAME, MQTT PASSWORD, CLIENT ID
- Use API as described here.
3. Send data
Create Python script running on FIT IoT-LAB frontend which forward data from IoT-LAB devices to myDevices. Please consider the following libraries:
- Create a Virtual Python environment:
- Then, see full example code hackathon_silecs_final.py.
<login>@<site>:~$ mkdir python-env <login>@<site>:~$ cd python-env/ <login>@<site>:~$ virtualenv hackthon-iot <login>@<site>:~$ source ~/python-env/hackthon-iot/bin/activate (hackthon-iot)<login>@<site>:~$ pip install cayenne-mqtt (hackthon-iot)<login>@<site>:~$ pip install CoAPthon
(hackthon-iot)<login>@<site>:~$ mkdir ~/hackathon_demo (hackthon-iot)<login>@<site>:~$ cd ~/hackathon_demo (hackthon-iot)<login>@<site>:~$ wget https://gist.github.com/schrein/9abb828da2b3b12c4b24f99633052746 (hackthon-iot)<login>@<site>:~$ python ./hackathon_silecs_final.py Connecting to mqtt.mydevices.com:1883 Callback Observe 732 Stop observing? [y/N]: N Callback Observe 733 Connected with result code 0 bp,hpa=733 Stop observing? [y/N]: N Callback Observe 734 bp,hpa=734 Stop observing? [y/N]: N Callback Observe 735 bp,hpa=735 Stop observing? [y/N]: N Callback Observe 736 bp,hpa=736 Stop observing? [y/N]: Callback Observe 737
4. Draw data
If everything went well, you should see a new counter for your device on the myDevices dashboard.Use the available widgets in oder to build a nice dashboard for you web browser or your smartphone: