1. Abstract

HerbAir Pro is a precision-engineered convection-based thermal diffusion system designed for the controlled volatilization of botanical materials. The system employs a closed-loop PID temperature controller driving a PTC ceramic heating element, combined with a variable-speed axial fan and adjustable iris aperture diffuser, to deliver consistent, repeatable thermal profiles across a 150–230°C operating range. Multi-layered safety systems — including tilt detection, thermal fuse protection, over-temperature shutdown, and a hardware watchdog — ensure fail-safe operation. A dual-path telemetry architecture enables both local (MQTT) and cloud (HTTPS) monitoring, with fleet-scale management via Cloudflare's edge infrastructure.

2. Introduction

Thermal volatilization of plant-based compounds has applications across aromatherapy, phytotherapy, and botanical research. Achieving precise, uniform heating without combustion requires careful thermal engineering — the target compounds volatilize within narrow temperature bands, and exceeding these ranges results in thermal decomposition and undesirable byproducts.

Existing devices in this space suffer from poor temperature accuracy (±15–25°C), slow thermal response, and limited airflow control. HerbAir Pro addresses these limitations with a purpose-built convection chamber, sub-degree PID control, and a variable iris aperture that enables fine-grained control over vapor density and delivery rate.

This whitepaper describes the complete system architecture: thermal subsystem, airflow mechanics, safety engineering, embedded firmware, and cloud-based fleet management infrastructure.

3. System Architecture

3.1 Hardware Overview

The system is built around an ESP32-S3 microcontroller with the following subsystems:

SubsystemComponentInterface
MCUESP32-S3-WROOM-1 (dual-core, PSRAM)
TemperatureMAX6675 K-type thermocoupleSoftware SPI
HeaterPTC ceramic element via N-channel MOSFETLEDC PWM (1 kHz)
Fan12V axial blower via N-channel MOSFETLEDC PWM (25 kHz)
DiffuserMechanical iris aperture via micro servoPWM (500–2500 µs)
DisplayGC9A01 240×240 round TFTHardware SPI (40 MHz)
InputRotary encoder with push-buttonGPIO + ISR
LED Ring12× WS2812B NeoPixel ringSingle-wire
SafetyTilt switch + thermal fuse (240°C)GPIO

3.2 Communication Architecture

The device supports dual-path telemetry:

  • Local path: MQTT over WiFi to a local broker, bridged to a Node.js backend with Socket.io for real-time dashboard updates. 2-second telemetry interval.
  • Cloud path: HTTPS POST to a Cloudflare Worker API for fleet-scale monitoring and remote configuration. 5-second telemetry interval with 60-second config polling.

Both paths operate independently — if cloud connectivity is lost, the local MQTT path continues uninterrupted.

4. Thermal Design & PID Control

4.1 Heating Element

A PTC (Positive Temperature Coefficient) ceramic heating element provides self-regulating thermal characteristics. The element is driven via PWM at 1 kHz through a logic-level N-channel MOSFET, allowing 8-bit (0–255) duty cycle granularity.

4.2 Temperature Sensing

A K-type thermocouple with MAX6675 digitizer provides 0.25°C resolution at 250 ms sampling intervals. The thermocouple is positioned at the convection chamber outlet for accurate vapor-path temperature measurement.

4.3 PID Controller

A discrete PID controller computes heater duty at 100 ms intervals (10 Hz):

output = Kp × e(t) + Ki × ∫e(t)dt + Kd × de/dt

Default tuning parameters: Kp = 4.0, Ki = 0.3, Kd = 1.5. These are remotely adjustable via the cloud fleet management system, enabling per-device tuning optimization.

The controller implements integral windup protection and output clamping (0–255). PID state is reset on state transitions to COOLDOWN or IDLE to prevent integral accumulation across sessions.

4.4 Thermal State Machine

Temperature transitions use hysteresis to prevent oscillation:

  • HEATING → READY: when T ≥ target - 2°C
  • READY → HEATING: when T < target - 7°C (5°C hysteresis band)
  • COOLDOWN → IDLE: when T < 50°C

5. Airflow & Convection System

5.1 Fan Design

A 12V axial blower driven at 25 kHz PWM (above human hearing threshold) provides variable airflow from 0–100%. During SESSION state, a sinusoidal breathing pattern modulates fan speed to create dynamic convection currents that improve heat distribution across the botanical chamber.

5.2 Iris Aperture Diffuser

A mechanical iris aperture, actuated by a micro servo (500–2500 µs pulse width), provides five discrete diffusion modes:

ModeApertureEffect
CLOSEDFully closedNo airflow — heat soak mode
NARROW~20%Concentrated, high-velocity stream
MEDIUM~50%Balanced diffusion
WIDE~80%Broad, gentle diffusion
FULL_OPEN100%Maximum airflow, lowest density

The combination of variable fan speed and aperture size gives the operator precise control over vapor delivery characteristics — from dense, concentrated output to light, dispersed diffusion.

6. Safety Engineering

HerbAir Pro implements defense-in-depth safety with four independent protection layers:

6.1 Software Over-Temperature Protection

A hard thermal limit of 235°C triggers an immediate transition to FAULT state. The heater is disabled, fan runs at 100% for active cooling, and the device requires a power cycle to reset. This is checked every main loop iteration (~1 ms).

6.2 Hardware Thermal Fuse

A 240°C one-shot thermal fuse provides hardware-level protection independent of software. If the software protection fails, the thermal fuse physically disconnects the heater circuit. Fuse status is monitored via GPIO — a blown fuse triggers FAULT state and is reported in telemetry.

6.3 Tilt Detection

A tilt switch with 100 ms debounce detects when the device is not level. Tilt triggers SAFETY_ALERT state: heater off, fan at 100%, alert displayed. The operator can dismiss the alert with a button press once the device is righted.

6.4 Watchdog Timer

A 5-second watchdog timer must be fed every main loop iteration. If the firmware hangs or crashes, the watchdog timeout triggers FAULT state with full heater shutdown. This catches edge cases that other protections cannot — including stack overflows, infinite loops, and memory corruption.

6.5 Defense-in-Depth: Main Loop Override

Independent of the state machine, the main loop enforces a hard rule: if safetyHeaterAllowed() returns false, the heater is forced off via a direct GPIO write. This ensures that even a corrupted state machine cannot leave the heater enabled.

7. IoT & Fleet Management

7.1 Architecture

The cloud fleet management system runs entirely on Cloudflare's edge network:

  • Cloudflare Workers: Serverless request handling at api.herbairpro.com
  • Workers KV: Device metadata and configuration storage (globally replicated)
  • D1 (SQLite): Time-series telemetry logs with indexed queries
  • Cloudflare Pages: Static frontend hosting at herbairpro.com

7.2 Telemetry Pipeline

Each device POSTs a JSON telemetry payload every 5 seconds over HTTPS with bearer token authentication. The Worker validates the payload, updates device metadata in KV (last seen, state, temperature), and inserts a row into the D1 telemetry table. Telemetry data is retained for 90 days.

7.3 Remote Configuration

Devices poll for configuration changes every 60 seconds. The config object includes a monotonically incrementing version number — the device only applies changes when the version increases. Configurable parameters include target temperature, fan speed, and PID tuning values, enabling per-device optimization without physical access.

7.4 Fleet Dashboard

The web dashboard provides real-time fleet visibility: online/offline status, aggregate statistics (device count, average temperature, error count), per-device telemetry history charts, and a configuration editor for remote parameter updates. Auto-refresh at 5-second intervals.

8. Firmware Architecture

8.1 Main Loop Timing

TaskIntervalPriority
Safety check + watchdogEvery iterationCritical
Encoder inputEvery iterationHigh
MQTT client loopEvery iterationHigh
PID compute100 msHigh
Display render100 ms (10 FPS)Medium
Serial telemetry100 ms (10 Hz)Medium
Sensor read250 msMedium
LED animation30 msLow
Diffuser servo50 msLow
MQTT telemetry2 sLow
Cloud telemetry POST5 sLow
Cloud config poll60 sLow

8.2 Memory Profile

Firmware compiled with ESP-IDF + Arduino framework:

  • Flash: ~1.06 MB of 3.34 MB (31.7%)
  • RAM: ~49 KB of 327 KB (15.0%)

Significant headroom remains for future features including OTA firmware updates, extended logging, and advanced botanical profiles.

9. Performance Characteristics

ParameterValue
Operating temperature range150–230°C
Temperature accuracy±2°C (PID steady-state)
Temperature resolution0.25°C (MAX6675)
Heat-up time (to 190°C)< 30 seconds
Safety cutoff235°C (software) / 240°C (hardware fuse)
Fan speed range0–100% (25 kHz PWM, inaudible)
Diffuser modes5 (closed to full open)
Cooldown threshold50°C
Telemetry rate (local)2 seconds (MQTT)
Telemetry rate (cloud)5 seconds (HTTPS)
Config poll rate (cloud)60 seconds
Display refresh10 FPS

10. Conclusion

HerbAir Pro represents a significant advancement in precision botanical volatilization. The combination of PID-controlled convection heating, variable iris aperture diffusion, multi-layered safety systems, and cloud-based fleet management delivers a system that is precise, safe, and scalable. The dual-path telemetry architecture ensures reliable local operation while enabling fleet-scale monitoring and configuration — a capability previously unavailable in this product category.

Patent pending: ZA 2026/02286. All rights reserved.