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.
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
# Golioth repository.
- name: golioth
path: modules/lib/golioth
revision: main
url: https://github.com/golioth/golioth-zephyr-sdk.git
import: west-external.yml
After updating the west.yml file, it should now look similar to this:
...
- name: openthread
repo-path: sdk-openthread
path: modules/lib/openthread
revision: 0d19f9112101e87722ec80b3a247bc7a1c54b232
# Golioth repository.
- name: golioth
path: modules/lib/golioth
revision: main
url: https://github.com/golioth/golioth-zephyr-sdk.git
import: west-external.yml
# West-related configuration for the nrf repository.
self:
# This repository should be cloned to ncs/nrf.
path: nrf
# This line configures west extensions.
west-commands: scripts/west-commands.yml
Now clone all the required repositories, by issuing the following command:
west update
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 underncs/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.

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.
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:
void main(void)
{
LOG_INF("Stratus < > Golioth Light DB sensor stream sample started");
const struct device *sht = DEVICE_DT_GET_ANY(sensirion_sht4x);
if (!device_is_ready(sht)) {
LOG_ERR("Device %s is not ready.\n", sht->name);
return;
}
if (IS_ENABLED(CONFIG_GOLIOTH_SAMPLES_COMMON)) {
net_connect();
}
client->on_connect = golioth_on_connect;
golioth_system_client_start();
k_sem_take(&connected, K_FOREVER);
while (true) {
/* Fetch latest environmental data from SHT4X sensor */
fetch_sensor_data(sht);
/* Send data using Synchronous mode */
LOG_DBG("Sending temp: %d.%06d; humidity: %d.%06d",
temp.val1, abs(temp.val2), hum.val1, abs(hum.val2));
env_data_push_sync(temp.val1, temp.val2, hum.val1, hum.val2);
k_sleep(K_SECONDS(5));
/* Send data using Callback-based */
LOG_DBG("Sending temp: %d.%06d; humidity: %d.%06d",
temp.val1, abs(temp.val2), hum.val1, abs(hum.val2));
env_data_push_async(temp.val1, temp.val2, hum.val1, hum.val2);
k_sleep(K_SECONDS(5));
}
}
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.# Golioth credentials
CONFIG_GOLIOTH_SYSTEM_CLIENT_PSK_ID="my-psk-id@my-project"
CONFIG_GOLIOTH_SYSTEM_CLIENT_PSK="my-psk"
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.
<inf> regulator_fixed: sensor-pwr-ctrl sync: 0
uart:~$ *** Booting Zephyr OS build v3.1.99-ncs1 ***
<inf> lis2dh: fs=2, odr=0x4 lp_en=0x0 scale=9576
<inf> golioth_system: Initializing
<inf> golioth_lightdb_stream: Stratus < > Golioth Light DB sensor stream sample started
<inf> golioth_samples: Waiting for interface to be up
<inf> golioth_system: Starting connect
<inf> golioth_system: Client connected!
<dbg> golioth_lightdb_stream: main: Sending temp: 23.184176; humidity: 13.123367
<inf> golioth_lightdb_stream: Environmental data successfully pushed
<dbg> golioth_lightdb_stream: main: Sending temp: 23.184176; humidity: 13.123367
<dbg> golioth_lightdb_stream: env_data_push_handler: Data successfully pushed to the Golioth Cloud
<dbg> golioth_lightdb_stream: main: Sending temp: 23.352407; humidity: 12.842971
<inf> golioth_lightdb_stream: Environmental data successfully pushed
<dbg> golioth_lightdb_stream: main: Sending temp: 23.352407; humidity: 12.842971
<dbg> golioth_lightdb_stream: env_data_push_handler: Data successfully pushed to the Golioth Cloud
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 modified 7mo ago