Skip to main content
Planet Zephyr

Get Started With Zephyr—The Easy Way

By June 19, 2023No Comments

The Zephyr project is a popular RTOS for developing embedded applications. Zephyr is a powerful tool, but it requires a dizzying set of system requirements you must install and configure to get your first project running on a device.

Screenshots of the Zephyr getting started steps

Here at Blues we pride ourselves on making embedded development easy, and we wanted to help our users start using Zephyr as fast as possible. To do that, we built a Docker container that abstracts away all of Zephyr’s system dependencies, and which you can use to develop Zephyr firmware in Visual Studio Code.

The tasks you can run within a docker container configured for zephyr

Let’s look at why we built this, how it works, and how you can use our approach to start your own Zephyr apps.

At Blues, our Zephyr work started in a response to user demand. We make the Notecard , a system-on-module that makes it super simple to add cellular connectivity to any embedded application.

Blues Cellular Notecard

To show how to use the Notecard in real-world projects we maintain a series of project accelerators, which are fully documented reference applications.

Blues accelerators

Our users started requesting Zephyr samples, and we wanted to make sure our Zephyr samples were as easy to use as the rest of our accelerators.

For our implementation we leaned heavily on Docker , a platform that allows you create pre-configured virtual OS packages called containers.

The high-level idea is: instead of requiring our users to set up their own systems, we instead provide a Docker container that’s preconfigured with everything they need to run a Zephyr app.

Additionally, because Visual Studio Code provides excellent Docker integration , we also include the necessary configuration so our users can code, build, and run everything in one place.

Let’s look at how it works through an example.

Temperature and Humidity Monitor

One of our Blues accelerators is a Temperature and Humidity Monitor . The project allows you to monitor temperature and humidity, and send alerts if the sensor readings go above or below configurable thresholds.

To run the project you first need to acquire and assemble the project’s required hardware , which is primarily a Blues Starter Kit and a BME280 sensor . Here’s what the hardware looks like with everything assembled.

Temperature and Humidity Monitor hardware

Once you have the hardware assembled, you next need to flash firmware to the project’s MCU to make everything work. In the case of the Temperature and Humidity Monitor, that firmware is Zephyr based, and is open source and available on GitHub .

Running Zephyr Firmware

To build, flash, and debug the Temperature and Humidity Monitor project’s firmware you must have the following installed:

With these requirements in place, when you open the project’s zephyr folder you’ll be prompted to reopen the project in the app’s included Docker container.

Reopening a project in a dev container

If you take this option, VS Code will reopen your project, except this time it’ll be running in the context of an OS environment that has all the necessary Zephyr system requirements in place. (Note: There will likely be a lengthy download step the first time you start the container, because all those system requirements still need to be downloaded.)

The first time you try running Docker with VS Code it feels like magic. You’re running code in a normal editor, but the files themselves all live within the virtual environment. The integration extends to VS Code’s terminal, which is no longer a terminal on your machine, but instead is a terminal on the virtual OS.

A terminal running in a dev container

And the coolest thing is—you’re basically good to start working with Zephyr immediately. There are a few trivial steps you need to take to configure your project, and then you can run one of the project’s included tasks to build, flash, or debug your Zephyr firmware.

The tasks you can run within a docker container configured for zephyr

It’s that easy! After you build and flash the project’s firmware, you’ll start seeing sensor readings appearing in the Notecard’s cloud backend, Notehub . Cool!

A list of sensor readings in Notehub

Here at Blues our work with Zephyr is just getting started. In addition to our accelerators that provide Zephyr firmware, we also provide an SDK for working with our Notecard in any Zephyr app—even if you’re not starting from one of our samples.

But, more than anything we’d like to know what you want. Are you a Zephyr user that’s dying for more samples on what you can do? Are you stuck building something with Zephyr and could use some tooling to help you out? Let us know in our community forum .

And if you want to keep up with all the cool things we’re doing at Blues, sign up for our developer newsletter .

Benjamin Cabé