air-gradient-pro-rs logo

air-gradient-pro-rs

Free

Bootloader, firmware, and CLI tools for the AirGradient PRO

FreeFree tier
Type
Open Source

About air-gradient-pro-rs

air-gradient-pro-rs is an open-source Rust firmware and toolchain for the AirGradient PRO air quality monitoring kit. It replaces the stock Wemos D1 Mini v4 with an STM32F411 'black pill' board and adds an ENC28J60 Ethernet module, providing wired connectivity. Built with the RTIC framework, it includes a custom bootloader with failover rollback mechanisms, a TCP/IP stack (smoltcp) supporting broadcast and device protocols for InfluxDB integration and FOTA updates, a CLI for device control and data relaying, OLED display support, and Renode emulation. Configuration is handled via environment variables for network and device settings.

Key Features

Custom bootloader with firmware update and failover rollback mechanisms
TCP/IP stack (smoltcp) with broadcast protocol for InfluxDB integration and device protocol for FOTA updates, device info, and control
CLI with command-line tools and InfluxDB relaying
Configuration for network and device settings via environment variables
OLED display support
Emulation support via Renode
FOTA (Firmware Over-The-Air) updating using custom agp_images.cpio files
Initial flashing via SWD and ST-Link

Pros & Cons

Pros
  • Written in Rust for memory safety and performance
  • Includes a robust bootloader with failover rollback for safe updates
  • Replaces Wi-Fi with wired Ethernet for more reliable connectivity
  • Supports FOTA updates for easy remote maintenance
  • Open-source under dual Apache 2.0/MIT licenses
  • Comes with CLI tools for data relaying and device management
  • Emulation support via Renode enables testing without hardware
Cons
  • Requires hardware modifications (replacing the Wemos D1 Mini and adding Ethernet board)
  • Initial flashing requires an ST-Link programmer and SWD connection
  • Limited to AirGradient PRO kit (PCB version 3.7)
  • Documentation is primarily in the repository README and may assume familiarity with Rust embedded development

Best For

Customizing the AirGradient PRO air quality monitor for wired Ethernet connectivityDeveloping and testing Rust-based firmware for embedded air quality monitoringIntegrating air quality sensor data with InfluxDB or other time-series databasesPerforming over-the-air firmware updates for remote sensor deploymentsEmulating the AirGradient PRO hardware for development without physical devices

FAQ

What hardware modifications are needed?
The stock Wemos D1 Mini v4 is replaced with an STM32F411 'black pill' board, and an ENC28J60 Ethernet board is added.
What firmware framework is used?
The firmware is written in Rust and uses the RTIC (Real-Time Interrupt-driven Concurrency) framework.
How are firmware updates performed?
FOTA updates are performed using the CLI command 'air-gradient device update' with an agp_images.cpio file, which is generated by a custom linker during build.
What networking protocols are supported?
The firmware uses smoltcp and includes a lightweight broadcast protocol for InfluxDB integration and a device protocol for FOTA updates, device info, and control.
Is the project open source?
Yes, it is dual-licensed under Apache 2.0 and MIT licenses.