Technical Whitepaper
HerbAir Pro: A Convection-Based Thermal Diffusion System for Botanical Volatilization
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:
| Subsystem | Component | Interface |
|---|---|---|
| MCU | ESP32-S3-WROOM-1 (dual-core, PSRAM) | — |
| Temperature | MAX6675 K-type thermocouple | Software SPI |
| Heater | PTC ceramic element via N-channel MOSFET | LEDC PWM (1 kHz) |
| Fan | 12V axial blower via N-channel MOSFET | LEDC PWM (25 kHz) |
| Diffuser | Mechanical iris aperture via micro servo | PWM (500–2500 µs) |
| Display | GC9A01 240×240 round TFT | Hardware SPI (40 MHz) |
| Input | Rotary encoder with push-button | GPIO + ISR |
| LED Ring | 12× WS2812B NeoPixel ring | Single-wire |
| Safety | Tilt 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/dtDefault 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:
| Mode | Aperture | Effect |
|---|---|---|
| CLOSED | Fully closed | No airflow — heat soak mode |
| NARROW | ~20% | Concentrated, high-velocity stream |
| MEDIUM | ~50% | Balanced diffusion |
| WIDE | ~80% | Broad, gentle diffusion |
| FULL_OPEN | 100% | 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
| Task | Interval | Priority |
|---|---|---|
| Safety check + watchdog | Every iteration | Critical |
| Encoder input | Every iteration | High |
| MQTT client loop | Every iteration | High |
| PID compute | 100 ms | High |
| Display render | 100 ms (10 FPS) | Medium |
| Serial telemetry | 100 ms (10 Hz) | Medium |
| Sensor read | 250 ms | Medium |
| LED animation | 30 ms | Low |
| Diffuser servo | 50 ms | Low |
| MQTT telemetry | 2 s | Low |
| Cloud telemetry POST | 5 s | Low |
| Cloud config poll | 60 s | Low |
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
| Parameter | Value |
|---|---|
| Operating temperature range | 150–230°C |
| Temperature accuracy | ±2°C (PID steady-state) |
| Temperature resolution | 0.25°C (MAX6675) |
| Heat-up time (to 190°C) | < 30 seconds |
| Safety cutoff | 235°C (software) / 240°C (hardware fuse) |
| Fan speed range | 0–100% (25 kHz PWM, inaudible) |
| Diffuser modes | 5 (closed to full open) |
| Cooldown threshold | 50°C |
| Telemetry rate (local) | 2 seconds (MQTT) |
| Telemetry rate (cloud) | 5 seconds (HTTPS) |
| Config poll rate (cloud) | 60 seconds |
| Display refresh | 10 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.