Skip to content
Ferdinando Bonsegna

Personal project · lab notes

QualitaAria: a homemade air quality meter.

A board with a touchscreen, a gas sensor, temperature and humidity, a battery and a 3D-printed case. Below is the real model: rotate it, open it up, tap the parts.

Drag to rotate · scroll wheel or two fingers to zoom · tap a part to see what it is
Period
Nov–Dec 2026
Type
personal experiment
Areas
electronics, firmware, CAD
Status
working, being calibrated

In short

I wanted to find out how hard it is to build, from scratch, an instrument that measures something real, and to trust the numbers it shows. The firmware reads the sensors every second, colours the values according to thresholds taken from standards and guidelines, keeps 48 hours of history in memory and warns you when it's time to air the room. It isn't a product and it isn't for sale: it's a project made to learn.

What I wanted to learn

Reading sensors straight from the datasheets, without ready-made libraries. Designing a readable interface for a tiny screen. Designing a case that actually prints and goes together.

What I didn't expect

That the hard part wasn't getting a number on screen, but knowing whether that number is right: the meter heats itself up, it reacts with a delay, and one of the values it shows isn't a measurement at all.

How I worked

One step at a time, measuring: every correction comes from a test on the real device, with the numbers written down. Where I couldn't measure, I say so.

Dig deeper

Each section opens with a click: pick whatever you're curious about.

The timeline

From loose wires on the desk to the closed case, including what went wrong.

In order, including what went wrong: that's where I learned the most.

  1. Start

    Sensor and board on the desk

    Four jumper wires and a sketch that prints the values. First discovery: the CO₂ the sensor shows is an estimate. Breathe on it and it rises to about 1200 ppm, while exhaled breath contains 40,000: it isn't measuring CO₂.

  2. November

    Interface, history, battery

    Seven swipeable pages, charts, 48 hours of data stored in the board's memory, battery reading. I measured the components with a ruler and started designing the case from those numbers.

  3. 1 December

    First case print: snapped clips failed

    The first case closed with snap-fit clips. With the 0.2 mm nozzle they came out brittle and broke the first time I used them. I redesigned everything without clips: a single body and a lid held by friction.

  4. 3 December

    The sensor disappears fault

    After soldering, the gas sensor stopped responding. It wasn't one of the four wires: a configuration pin (ADD) was touching ground and changing the chip's address. Since then the firmware looks for the sensor at both addresses and finds it again on its own if it stops responding.

  5. 3 December

    Second case, assembled success

    Three parts in white PETG, about 6 hours of printing and 56 grams. Everything goes in from the back, in order, and the lid opens with one finger.

  6. 3 December

    With the case closed, the numbers change to fix

    Inside the box the temperature reading was more than 3 °C too high and took half an hour to follow a change in the room. That kicked off the calibration tests described further down.

  7. Now

    Finishing touches

    Anti-aliased fonts instead of blocky pixel ones, readable level bars, battery percentage calibrated to the end-of-charge point. Real battery life is still to be measured.

What it measures

Five numbers: three are real measurements, two are estimates. With the thresholds and where they come from.

Five numbers, but not all of the same kind. Three are direct measurements, two are estimates calculated by the sensor. Understanding that was one of the points of the project, so here the difference is stated openly. The colour thresholds come from standards and guidelines, cited under each value.

Calculated index

AQI · air quality index

1 to 5

The overall rating: 1 Excellent, 2 Good, 3 Moderate, 4 Poor, 5 Unhealthy. It follows the German Environment Agency (UBA) scale and is derived from the organic compounds.

12345
Direct measurement

TVOC · volatile organic compounds

ppb

What comes off paint, cleaning products, cooking, new furniture, breath. It is the only quantity the gas sensor actually measures, and the most useful one for telling whether the air is "stale".

2206602200

Thresholds: AQI-UBA table from the ENS160 datasheet.

Direct measurement

Temperature

°C

Corrected for the heat the meter itself produces, and predicted ahead when the surroundings change quickly (see Tests and measurements).

18202628

Comfort per EN 16798-1 category II: 20–26 °C.

Direct measurement

Relative humidity

%

Recalculated at the corrected temperature: same water vapour in the air, right temperature (Magnus formula). Below 30 % the air is dry; above 70 % the risk of mould goes up.

30406070

EN 16798-1 / ASHRAE 55: 40–60 % comfortable, 30–70 % acceptable.

Estimate, not a measurement

~CO₂ · equivalent carbon dioxide

ppm

The sensor cannot see CO₂: it infers it from the organic compounds, assuming they come from the people in the room. That is why on the screen it has a tilde in front and sits at the bottom. The proof: breathe on it and it rises to about 1200 ppm, while exhaled breath contains 40,000. Read it as a trend, not as an absolute value.

100014002000

UBA thresholds 1000 / 2000 ppm; EN 16798-1 category III ≈ 1350 ppm above outdoor levels.

goodcautionair the roomout of range

The screen

Seven pages on a 1.47-inch screen: the real photos.

A 1.47-inch touchscreen (172 × 320 pixels). You swipe with your finger across seven pages; tapping a value opens its chart. These are real images of the screen, downloaded from the board.

Main page
Main. The index at the top, then the values in order of importance. Each bar shows which band the value falls in.
Temperature chart
History. Time runs from top to bottom; the dashed lines are the thresholds, with their numbers.
Humidity chart
Zoom. The − and + buttons narrow or widen the value scale.
System page
System. Battery, sensor status, history, brightness and screen off.

All the text uses an anti-aliased font (16 levels of transparency) that I generated specially and draw pixel by pixel into the screen's memory: on such a small display the difference from the standard blocky fonts is obvious at a glance.

Tests and measurements

Five experiments to work out how far to trust the numbers, with the results.

A sensor inside a closed box gets things wrong in two ways: it heats itself up and it reacts with a delay. These are the tests I ran to quantify that, with the real numbers.

  1. How much the meter heats up: 3.33 °C

    Test. Meter switched off for an hour, then switched on and left alone for 40 minutes. The first reading is the true room temperature, the last is the steady-state one.

    Result. A difference of 3.33 °C, subtracted from every reading; humidity is recalculated at the corrected temperature (Magnus formula). This holds on battery: while charging it runs a bit warmer, and I haven't measured that yet.

  2. How slow it is: from half an hour to one minute

    Test. Meter taken from 21 °C to about −2 °C outdoors and then back inside, logging one value per minute.

    Result. A time constant of about 400 seconds. The firmware now predicts the final value from how fast the reading is changing. The first attempt (700 s, from a wrong calculation on the cooling curve) showed 28 °C in a 21 °C room: I fixed it by looking at the warm-up instead. In a still room the number moves by 0.1 °C at most.

  3. The breath test: 1818 ppb in one second

    Test. Blow on the sensor. Organic compounds go from about 180 to 1818 ppb and return to normal in 20–30 seconds.

    Result. The peak is real but local. That's why the "air the room" warning looks at the 10-minute average and not at the instantaneous value.

  4. A full battery isn't at 4.20 V

    Test. Let the charge finish and read the voltage with USB still connected.

    Result. On this board the charger stops and the battery sits at 4.115 V. With the "textbook" curve I would have read 87 % on a full battery; I calibrated 100 % to that point. The lower part of the curve is still the typical one: it needs a full discharge, which is planned.

  5. Switch off, without an extra wire

    Test. 2000 voltage readings in 2 seconds, with the switch ON and OFF.

    Result. With the battery disconnected, the charger produces a short dip (about 120 mV for 12 ms) every few seconds, to check whether a battery is there. By counting those dips the firmware works out on its own that the switch is OFF.

Hardware

The components and the six wires that connect them.

Common, off-the-shelf components that come pre-assembled: no custom boards.

ComponentWhat it does
Waveshare ESP32-C6 Touch LCD 1.47Processor, touchscreen, battery charging via USB-C. Wi-Fi off: the meter sends data to no one.
ScioSense ENS160Metal-oxide gas sensor: TVOC, from which AQI and equivalent CO₂ are derived.
Aosong AHT21Temperature and humidity, on the same module as the gas sensor.
LiPo battery 3.7 V · 1100 mAhWith a protection circuit; charges from the board's USB-C.
Slide switchDisconnects the battery. The firmware detects on its own when it's OFF, even with USB connected, from the short pulses the charger makes when it can't find a battery.

Wiring

Four wires soldered between board and sensor (I²C bus), two for the battery.

WireFrom the boardTo
Red3V3sensor, 3V3
BlackGNDsensor, GND
BrownSCLsensor, SCL
YellowSDAsensor, SDA
Battery redVBATswitch, then battery +
Battery blackGNDbattery −

The case, in 3D

Three printed parts that press-fit together, step-by-step assembly and the files to download.

Three printed parts that press-fit together, with no screws or glue: a body with all the mounts, a tray that holds the cables in place and supports the battery, and a back lid. The sensor sits in a separate chamber, with its own vents and a wall that shields it from the board's heat. Below is the guided 3D assembly: 18 steps, from soldering to first power-on.

Interactive 3D view · rotate, pan and zoom

Loads about 1 MB of models. Best on a wide screen.

Drag to rotate · right-click to pan · scroll wheel to zoom · double-click a part to orbit around itOpen full screen ↗

Data as the source of truth

All the dimensions live in a single file. Both the 3D view and the printable parts are generated from it with parametric CAD (build123d): changing the battery redesigns the case.

Designed for printing

PETG, 0.2 mm nozzle, no supports: every mount rises straight up from the face that sits on the bed. The longest bridge is 4.8 mm.

Second version

The first had snap-fit clips, which broke the first time I used them. This one holds by friction along the whole rim and opens with one finger.

Firmware

About 2,300 lines of C++, sensors read straight from the datasheets.

About 2,300 lines of C++ (Arduino on ESP32-C6). As an exercise I didn't use sensor libraries: both chips are read directly over the bus, following the datasheets.

Robust

If the bus hangs or a sensor stops responding, the firmware unsticks it and finds it again on its own. If the program freezes, an automatic check (watchdog) restarts the board.

History that doesn't get lost

The data goes into a file in the board's memory, written so that a power cut can't corrupt it.

Calibration without instruments

Commands from the computer to calibrate the temperature with the case closed, the battery voltage and the response speed; a discharge log measures the battery's real curve.

Power use under control

The screen turns off on its own or with a tap (it's a third of the power draw) and turns back on when there's something to warn about. Measuring continues with the screen off.

What I learned

Four lessons, the limits stated openly and what I'd do next.

Showing a number is easy, earning it isn't

Half the work was figuring out how far to trust each value. The most useful thing I did was to separate, on the screen too, what is measured from what is estimated.

The enclosure is part of the instrument

Closing everything in a case changed the readings more than any line of code. A separate chamber and vents help, but the correction has to be measured on the finished device.

Print early, even badly

The snapped clips taught me more than a week of design work. Now I print the critical 30 mm of a part first, to test the fit, and only then the rest.

The limits, stated clearly

The gas sensor is cheap and the CO₂ is only inferred. The calibrations apply to this particular unit. It isn't a certified instrument: it's useful for seeing trends, not for formal assessments.

What I'd do next

  • Measure battery life with a full discharge and derive the battery's real curve from it.
  • Add a real CO₂ sensor (NDIR) and compare it with the estimate.
  • Compare the temperature against a reference thermometer, including while charging.
  • Try a second unit, to see how much the calibrations vary from one device to another.

A personal project by Ferdinando Bonsegna, made to learn. The thresholds are comfort guidelines for homes: this is not a certified instrument.