Smart Containers POC | RIOT + LORA + FIT/IoT-LAB + TTN + TAGO.IO + HYPERLEDGER FABRIC — Part 1

Indranil Majumder
4 min readJan 23, 2021

--

For some time now Smart Containers (physical containers used to ship goods across oceans) is in my range of interest.

Smart Container = Dumb container + IoT + Network + Cloud (possibly Blockchain)

Smart Container

So I did some reading ….

And this is what I understood (current trend):-

It looks very exciting on paper but I needed more. I needed to satisfy my developer itch by figuring out what all needs to be put together to make this work!

I have little to no experience in IoT and do not own a single piece of IoT hardware/sensors and am currently trying out my hands on blockchain.

After reading few articles on IoT integration projects, I set out to explore..

Enter FIT/IoT-Lab, TTN & Tago.io

FIT/IoT-Lab

A very large scale IoT test bed. With ample docs and get started tutorials, it didn’t take much time to get my hands dirty on a few well-known boards(arch), OS and sensor data collection.

The Things Network

In DCSA’s IoT specs, LoRaWAN has been identified as an important RF interface for both at Sea and on Land. The free tier of TTN and its easy integration with FIT/IoT-Lab, makes it very lucrative for beginners to try and build POCs on it.

Tago.io

The ultimate IoT data aggregator. Has out of the box device integration with TTN. A range of useful functionalities (data retention/custom data parsing/custom alerts/mobile app etc.) around the collected IoT data and further integration capabilities, along with its free tier, makes its useful for beginners.

https://docs.tago.io/en/articles/1-getting-started

Integration

POC Block View
  1. Create a free FIT/IoT-Lab account
  2. Create a free TTN account
  3. Create a free tago.io account
  4. Get SSH access to FIT/IoT-Lab — https://www.iot-lab.info/docs/getting-started/ssh-access/
  5. SSH to saclay site — ssh <login>@saclay.iot-lab.info
  6. Clone RIOT OS — git clone git://github.com/RIOT-OS/RIOT.git -n 2020.04-branch
FIT/IoT-Lab Testbed UI

7. Open TTN console and create a New Application

8. Register a device

9. Go to Payload formats and add this script for parsing raw sensor data from FIT/IoT-Lab to JSON —

function Decoder(bytes, port) {
// Decode an uplink message from a buffer (array) of bytes to an //object of fields.
var message = "";
for (var i=0; i<bytes.length; i++){
message += String.fromCharCode(bytes[i]);
}
var decoded = {};
var mex = JSON.parse(message);
mex.timestamp = new Date().getTime().toString(); // Add message //timestamp
decoded.message = mex;
return decoded;
}
TTN console

10. Go back to FIT/IoT-Lab SSH console and update Makefile and main.c under /senslab/users/<login>/RIOT/examples/lorawan/ to

and

11. Run make all under /senslab/users/<login>/RIOT/examples/lorawan/

12. This should generate lorawan.elf at — /senslab/users/<login>/RIOT/examples/lorawan/bin/b-l072z-lrwan1/lorawan.elf

13. Download the lorawan.elf to your local and head over to FIT/IoT-Lab testbed to run a new test with this as the firmware.

My Resources > Firmwares > New Firmware > Upload lorawan.elf (OS-RIOT/Arch — st-lrwan1) > Save

New Experiment > Nodes > Arch : st-lrwan1 (sx1276) > Site: Saclay > Qty:1 > Add to Experiment > Add firmware > Select lorawan.elf > Submit experiment

14. Go tago.io console — Devices > Add New Device > Select Network: LoRaWAN TTN > Custom The Things Network > Add Device EUI from TTN console > Create Device

Tago.io console

To validate the data flow -

On FIT/IoT-Lab ssh console — nc st-lrwan1–<nodeid> 20000

majumder@saclay:~$ nc st-lrwan1–10 20000
main(): This is RIOT! (Version: 2020.04)
Starting join procedure
Join procedure succeeded
Sending data: {“temperature”: “23.7”, “humidity”: “31.7”}
Sending data: {“temperature”: “23.7”, “humidity”: “31.7”}…

On TTN — Web console > Data > same data as above

On tago.io — Web console > Devices > your_device > Live Inspector > Play > same data as above

Play around tago.io to figure out its other interesting features!!

Mobile app Notifications

WIP — Simulate/real GPS changes(ETA/Geofencing), accelerometer/magnetometer changes(drop/damage), lumosity changes(door opening)/temperature/humidity changes(reefer)

Next part — Blockchain integration

References —

--

--

No responses yet