# Analog CO₂ Gauge Using Stepper Motor and Tasmota
We've developed a device for monitoring CO₂ levels, displayed on a needle gauge mimicking automotive or aviation instruments. It uses the SenseAir S8 sensor, X27-168 stepper motor with VID6608 driver, and Tasmota firmware. The device integrates with smart home systems and supports a web interface for configuration and OTA updates. All components are globally available, and assembly requires no rare parts.
Device requirements: precise CO₂, temperature, humidity, and pressure measurements; analog indicator with backlight; style options (aviation/retro) and backlighting (filament/RGB); end-user operation without a programmer.
Component Selection and Mechanics
The X27-168 stepper motor is standard for automotive instrument panels (OPEL, VAZ-2110). The motor family includes zero-sensor variants and dual-needle models. The VID6608 driver implements microstepping (1/12 division, ~0.028° per step), reducing noise and improving accuracy per the datasheet.
Alternatives like servos were rejected due to noise, low accuracy, and limited rotation angle. Analog voltmeters don't work: small angle (90°), fragility, exotic parts. Off-the-shelf gauges from AliExpress target street racing and are inconvenient for integration.
CO₂ sensor: SenseAir S8 (industry standard). Additional climate sensors (temperature, humidity, pressure). Without sensors, the device operates on smart home commands.
Driver Prototyping:
- Initially tested via H-Bridge: low accuracy, high noise.
- With VID6608: smooth movement, natural needle dynamics.
Tasmota Integration
The SwitecX25 library for ESP32 has bugs: char overflow (unsigned in ESP32), missing timeouts per VID6608 datasheet. A new library based on SwitecX25 was developed:
- Support only for VID6608-like drivers (direct control is inefficient).
- Configurable acceleration curves.
- Proper timeouts and microstepping.
- Direct integration into Tasmota (no submodules).
Tasmota was chosen for its built-in smart home support (MQTT, HTTP), web interface, and OTA. Added support for instrument stepper motors.
Example basic Tasmota configuration (via web interface):
SwitecX25:
enable: true
driver: VID6608
steps: 28800 # Full rotation
acceleration: 500
Enclosure and 3D Printing
Enclosure based on donor alarm clock cases. Printed parts on Ender-3: scales (aviation/retro), needle, holders. ~300° rotation angle ensures readability.
Configuration options:
- Style: aviation (metallic look) / retro (vintage).
- Backlighting: none / filament (incandescent imitation) / RGB (addressable strip).
- Sensors: CO₂ + climate / climate only / CO₂ only / no sensors.
Assembly: PCB with ESP32, driver, connectors. Global availability: motors ~2€, drivers ~1.5€, SenseAir S8 ~25€.
Functionality and Calibration
The display shows current CO₂ (400-2000 ppm, scale with zones: normal/ventilate/critical). Updates every 5-10 sec with smoothing for fluid motion.
Needle movement algorithm:
- Step calculation:
target_pos = map(co2_ppm, 400, 2000, 0, max_steps). - Acceleration/deceleration via S-curve for realistic inertia.
- Microstepping minimizes vibration.
Integration: MQTT topics for CO₂, temp, humidity. Web interface: graphs, zero calibration, test mode.
Key Points
- Accuracy: SenseAir S8 ±50 ppm ±3% at 30°C, response <20 sec.
- Compatibility: Tasmota + Home Assistant/MQTT without extra firmware.
- Reproducibility: all parts on DigiKey/AliExpress, Gerbers in repo.
- License: GNU GPLv3, code/3D/STL open source.
- Extensibility: needle displays any metric via MQTT.
— Editorial Team
No comments yet.