---
title: "air-quality-wing-zephyr-demo"
url: "https://maker.wiznet.io/mason/projects/air-quality-wing-zephyr-demo/"
markdown_url: "https://maker.wiznet.io/mason/projects/air-quality-wing-zephyr-demo/md"
type: "UCC: User Created Content"
author: "Jaredwolff"
author_url: "https://github.com/circuitdojo/air-quality-wing-zephyr-demo"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Jaredwolff"
original_url: "https://github.com/circuitdojo/air-quality-wing-zephyr-demo"
license: "Apache License 2.0 (Apache-2.0)"
published: "2023-07-03"
language: "en"
hardware: ["WIZnet W5500"]
likes: 1
views: 195
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# air-quality-wing-zephyr-demo

> air-quality-wing-zephyr-demo

Original author: Jaredwolff (source: https://github.com/circuitdojo/air-quality-wing-zephyr-demo)

## Components

- **WIZnet W5500** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W5500))

WIZnet parts: W5500 ([Datasheet](https://docs.wiznet.io/Product/Chip/Ethernet/W5500/datasheet?utm_source=maker&utm_medium=project&utm_campaign=w5500), [product hub](https://maker.wiznet.io/products/w5500/))

## Documents and links

- [air-quality-wing-zephyr-demo](https://github.com/circuitdojo/air-quality-wing-zephyr-demo/tree/main) (code)

## Article

This source code is part of an application that works with the Zephyr RTOS, a program that collects and processes data from air quality sensors. The main parts and functions of the source code are as follows.

**Include header**: Contains various libraries and modules related to Zephyr, especially using sensor data coding and network related libraries.

**Sensor data definition**: Declare a struct array named `sensor_data` to store multiple sensor data items.

**Handling date and time events**: The `date_time_evt` function starts the Golioth system client when the system receives the current time.

**Publish Data**: The `publish` function encodes the sensor data and sends the data to Golioth LightDB in CBOR format.

**Main function**:

- **Reset**: Initializes the network and Bluetooth Center.

- **Event Loop**: The application continuously checks for events, adding sensor data to the array whenever it receives Bluetooth data.

- **Publish data**: When enough sensor data is accumulated, call `publish` function to publish data.

- **handle ethernet ready event**: Do a time update when ethernet is ready.

This code is responsible for centrally processing and remotely transmitting the data collected by air quality sensors, so it could be used in IoT devices or air quality monitoring systems.

---

Source: https://maker.wiznet.io/mason/projects/air-quality-wing-zephyr-demo/
