Golioth
This section covers connecting your Conexio Stratus device to the Golioth platform. Specifically, this post will demonstrate how to:
Set up the toolchains and the Golioth SDK.
Connect the Stratus kit to the Golioth cloud, periodically send environmental data, and monitor the device.
Perform Stratus Device Firmware Upgrade (DFU) procedure over the cellular network.
We have a lot to cover, so let’s dive in.
Setting Up the Toolchains
Golioth SDK is built around ZephyrRTOS and comes as a separate module. Since the Stratus device requires nRF Connect SDK for cellular connectivity, we first need to initialize the nRF Connect SDK as per the Golioth docs. To do so, we need to add the following entry to west.yml
file in manifest/projects
subtree of existing nRF SDK west based project located in:
/opt/nordic/ncs/v2.1.1/nrf
After updating the west.yml file, it should now look similar to this:
Now clone all the required repositories, by issuing the following command:
Depending on your network speed, this will take several minutes so sit back tight until the process completes. Upon successful completion, you should see the golioth
directory under
ncs/v2.1.1/modules/lib/golioth
Bravo. For now, our SDK is all set. Let’s head over to the Golioth cloud to create an account.
Registration and Device Setup on the Golioth Cloud
Join the Golioth and create a user account here. And yes, for now joining Golioth is Free.
Once your account is created, head over to the “Projects” menu on the left-hand pane and Create a Project as shown:
Give your device a name and click Save.
One can also achieve the steps shown here using the Golioth command-line tools (CLI) as outlined in the documentation. For this tutorial, we will use the Golioth console for setting up our devices and for faster provisioning.
Next, we need to provision our devices and acquire the credentials to connect it to the Golioth platform. Expand the “Management” menu and click Devices. Then, on the right-hand top view, click Create and select Provision with Credentials.
This will pop up a Device fast path Provision window as shown:
Next, choose a name for your device, give your device a tag label (read more about Golioth tags here), choose an identity (ID), or keep the default one generated automatically. Finally, add your pre-shared key (PSK) as per your liking and click Save. Later, we will need this ID and the PSK to authenticate our Stratus device with the Golioth platform.
At this point, we have all the required details to connect and publish data from our Conexio Stratus device to the Golioth. Let’s head over to the device firmware side.
Stratus Sample Application
We have extended the Light DB stream
the sample application provided in the Golioth SDK to connect the Stratus kit to the Golioth and stream sensory data. The extended application periodically samples the environmental data from the onboard SHT4x sensor and publishes it to the /temp
and /humidity
Light DB stream path. For the first part of this post, the full application can be found in the conexio-stratus-firmware/samples/golioth/stratus_lightdb_stream repo on GitHub. Copy the project folder and place it in your Golioth SDK samples directory.
golioth-sdk/modules/lib/golioth/samples
Below is the snapshot of the code’s main loop:
Add Golioth credentials to the Application Code
First, we will have to add the Golioth credentials (ID and PSK) that we configured above using the Golioth console into the application code. You will need to edit samples/stratus_lightdb_stream/prj.conf
with your credentials and update the following parameters.
Next, compile and flash the application to the Stratus board.
Open up a serial console with a baud rate of 115200 and reset the Stratus device. The following serial UART output will be displayed in the terminal.
Once the device is connected to the Golioth cloud, it will start sending the environmental data. To confirm that the Stratus device is actually connected and communicating to the Golioth backend, head over to the Golioth console, and your device Status should now indicate “online”.
To observe the incoming data from the Stratus device, on the left-hand under the Monitor menu, click Light DB Stream and the Query Response window will appear. One should now see the incoming data from the device as shown below.
If you do “Houston, we have lift-off”… 🚀. Your device is now connected and communicating with the Golioth cloud.
Explore the console to see other features currently offered by the Golioth platform.
Last updated