ESP32-C3 Embedded Air Quality Monitoring System
by Chanchaldada in Circuits > Arduino
33 Views, 0 Favorites, 0 Comments
ESP32-C3 Embedded Air Quality Monitoring System
Air quality sensors used to be expensive lab equipment. Now you can put a decent one on your desk for under ₹3,000. We build environmental monitoring systems for clients regularly — from warehouse CO2 tracking to indoor particulate monitors — and the ESP32-C3 is our default starting point for anything that needs Wi-Fi, low power, and a small bill of materials.
This guide walks through a complete build: ESP32-C3, a PMS7003 particulate sensor, an SCD40 for CO2, and a small OLED. It publishes over MQTT and runs on USB power. Everything here is what we'd hand a junior engineer as a reference design.
Supplies
Suppliers and components:
- ESP32-C3-DevKitM-1 or a bare ESP32-C3-MINI-1 module (Mouser, Digi-Key, or LCSC for volume)
- PMS5003 particulate sensor (laser scattering, PM1.0/PM2.5/PM10) — sourced from Plantower distributors
- SCD41 CO2 sensor from Sensirion (photoacoustic, ±50 ppm accuracy) — available at Digi-Key and Mouser
- SHT41 temperature and humidity sensor (I2C, ±0.2°C)
- 3.7V 2000mAh LiPo cell with a JST-PH connector
- TP4056 charging module with protection
- MCP1700-3302E LDO regulator (low quiescent current, good for battery builds)
- 0.96" SSD1306 OLED, I2C
- Assorted passives, a 2-pin JST for the fan header, and a custom PCB if you want it compact
- Enclosure — we usually design these in Fusion 360 and print in PETG
Parts and Wiring
- ESP32-C3 dev board (any of the common ones — they're all similar)
- PMS7003 particulate sensor (PM1.0, PM2.5, PM10)
- SCD40 CO2 sensor over I2C
- SSD1306 128x64 OLED, also I2C
- A 5V/2A USB supply — the PMS7003 fan needs current
Wiring is straightforward. The PMS7003 uses UART at 9600 baud: its TX goes to GPIO4 on the C3, RX to GPIO5. Both sensors share the I2C bus on GPIO8 (SDA) and GPIO9 (SCL). The SCD40 sits at address 0x62, the OLED at 0x3C, so no conflict.
One thing people get wrong: the PMS7003 runs at 5V logic, the C3 at 3.3V. Put a level shifter on the sensor's TX line, or at minimum a resistor divider. The RX line into the sensor usually tolerates 3.3V fine, but don't gamble on it.
Firmware
The firmware has three jobs: read sensors, push data, stay out of the way.
For the PMS7003, you're parsing 32-byte frames. The header is 0x42 0x4D, and PM2.5 sits at bytes 12–13 as a big-endian uint16. Don't trust the checksum blindly — validate it, because the fan occasionally spits out partial frames on startup.
The SCD40 is easier. It speaks I2C and you can trigger a measurement with a single command. Give it 5 seconds after power-on before the first read; the sensor does its own self-calibration and the early numbers are garbage.
Power and Enclosure
USB power is fine for a desk unit. If you want battery, the PMS7003 is the problem — its fan draws around 100 mA continuously. You'd want to duty-cycle it: run for 30 seconds every 5 minutes. That gets you roughly 3–4 days on a 2000 mAh cell with the C3 in light sleep between reads.
For the enclosure, we design these in Fusion 360 and print in PLA. Two things matter: airflow and sensor placement. The PMS7003 needs a clear path for air to move through, so cut vents on both sides. The SCD40 should sit away from the ESP32 — the chip runs warm and CO2 readings drift with temperature. A small internal divider helps.
We've shipped enclosures like this for clients in batches of a few hundred. If you're going past that, injection molding is cheaper per unit, but 3D printing is fine up to around 500 pieces.
Calibration
The SCD40 does automatic baseline calibration by default, which assumes the sensor sees fresh air (around 420 ppm) at some point in a 7-day window. In a sealed office, that assumption breaks. Either expose it to outside air periodically or disable ABC and calibrate manually with a reference gas.
The PMS7003 is factory-calibrated for standard dust. It reads fine for PM2.5 trends but won't match a reference instrument to the microgram. If you need regulatory-grade numbers, you need a different sensor class entirely.
What This Looks Like in Production
A prototype on a breadboard and a shipped product are different animals. For production, we'd move to a custom PCB — the C3 module, level shifters, a proper LDO, and the sensor connectors on one board. KiCad handles this well, and JLCPCB or PCBWay can turn boards in a week.
We've done this exact cycle for clients: breadboard, PCB, enclosure, firmware, and a small test rig that checks each unit before it ships. An embedded software development company's real value isn't writing the first version of the firmware — it's the version that survives 10,000 units in the field without a support ticket.
If you're building something like this and want a second opinion on the hardware or firmware, we're happy to talk through it. The C3 is a solid platform, and most of the work is in the details — power, calibration, and making sure the thing keeps running when nobody's watching.