Now we're getting to the good stuff - working with hardware! The sample project provided will demonstrate a device securely communicating with Golioth and will also introduce the first device service for logging.
The sample we'll be using is called
hello, which logs a "hello" message using the Logging Device Service. Here's snippet of the
If you're familiar with Zephyr you may recognized the
LOG_* functions. That's because Golioth tries to use Zephyr APIs whenever it can. In this instance, the Logging Device Service is a cloud-enabled backend for Zephyr's logging library. In this way, Golioth can reuse well-tested libraries, reduce the size through shared code and feel idiomatic to developers who are comfortable with Zephyr.
Samples can be found in the Zephyr SDK in the folder
modules/lib/golioth/samples. We recommend running the commands below from the
Zephyr uses Kconfig to manage build settings at scale. Kconfig values can be set a number of ways but for this example we'll take a simple route by modifying
samples/hello/prj.conf in your editor of choice and add these fields:
Set the PSK & PSK ID to match what was used during the provisioning step and the Wi-Fi network credentials to match your network.
After saving, build the sample with the new settings applied.
Flashing is a simple
west command away.
Your ESP32 will likely be at a different location, so adjust the
flash command accordingly.
You can verify that everything is working by connecting to the device over a serial console using a tool like
This is an snippet from the serial console:
These are just the logs the device has created but they're also being sent to Golioth for later use. The next step will show you how to view logs from the cloud.