I plan to use The Things Network (TTN) as the cloud interface to my Node-Red Dashboard, so I needed to verify that it was working properly. Back in 2019 I had won a Things Network Kickstarter Gateway in the Project14 IoT: In the Cloud contest. Early last year I spent some time migrating the gateway from TTN V2 to V3 (The Things Stack). I've had the gateway powered down the latter part of the year, so I powered it back up - but it failed to activate.
I tried all the normal troubleshooting steps - reset and re-entered all of the configuration info (Gateway ID, Gateway Key, WiFi info, Account Server), but could not get it to activate. It was connecting to WiFi, but not connecting to The Things Stack. I considered trying to activate over wired ethernet, but decided to try creating a new gateway in the console - and that worked!
You can see the gateway that I created last year and the new one (tslo) below:
And the new configuration below:
Gateway traffic:
Next, I need to create the application. I am going to create a test flow from the sensor all the way through to the Node-Red Dashboard as a "pipe cleaner" so that everything is working before trying to incorporate the final hardware configuration. I decided to use a Nicla Sense mounted as a shield on a MKR 1300 as the sensor. In this configuration the boards communicate via I2C (Nicla Sense is the peripheral). I also intend to try using the Nicla Vision on the same bus, but I haven't seen anyone do that before - so hopefully no surprises when I try that.
I discovered that I had a MKR 1310, so I'll use that instead of the MKR 1300. When the hardware kit arrives, I'll use that MKR 1310 as a backup in case I need to separate the Nicla Sense and Nicla Vision (I'll elaborate on the hardware setup and device programming in a separate blog post).
Here is the configuration setup of the Application on the Things Stack:
Add an end device (MKR 1310):
Connect to device through gateway:
Test case passing Temperature and Humidity readings from Nicla Sense (mounted on MKR 1310):
Add the MQTT integration to the application. The Things Stack provides an MQTT Server that will manage the Uplink and Downlink payload and configuration data.
Create a new flow on Node-Red Server running on an RPi 4 on my LAN.
Connect to TTN MQTT Server. A secure connection would just require switching the Port to 8883.
Create a Javascript object from the payload JSON string. This makes it easier to extract the sensor data from the payload.
The Node-Red Dashboard (haven't figured out how to left justify a single group in the window - there will be addtional groups in the final design).
So, the basic data flow is working. I need to work on getting data for an ML model while I wait for the hardware kit. Getting the model to work with the Nicla Vision is going to be the biggest challenge...