Portable Air Quality Monitor

For those who wonder how safe the air around them is and what can be changed to avoid the negative health effects of polluted air.

Similar projects worth following
Portable air quality measurement unit to record and display the following aspects of air quality:
- Carbon monoxide
- Carbon dioxide
- Particulate matter
- Temperature
- Humidity

You can find 3D models here:

You can find source code here:


Full PDF report:

Adobe Portable Document Format - 6.87 MB - 05/14/2017 at 17:17


Adobe Portable Document Format - 2.31 MB - 05/10/2017 at 20:13



Drawing of machining toolpath

JPEG Image - 96.36 kB - 05/10/2017 at 20:03



Drawing of particulate sensor

Portable Network Graphics (PNG) - 223.38 kB - 05/10/2017 at 20:03



Drawing of CO2 sensor

Portable Network Graphics (PNG) - 33.58 kB - 05/10/2017 at 20:03


View all 10 files

  • 1 × STM32L476RG Microcontroller
  • 1 × MH-Z19 CO2 sensor Non-dispersive infrared CO2 sensor, 0 - 2,000 ppm
  • 1 × 110-102 CO sensor (SPEC) Ultra low power low cost pre-calibrated CO sensor
  • 1 × SI7021 Compact temperature and humidity sensor
  • 1 × ESP01 ESP8266 through hole wifi module

View all 7 components

  • Ozone sensing - design changes

    Thomas08/13/2017 at 23:59 0 comments

    The original design used a carbon monoxide (CO) sensor from SPEC, in a 6 lead through hole package. They also offer a number of sensors in the same package: NO2, alcohol, O3, SO2, H2S.

    I was interested in the ozone (O3) sensor, as electrostatic filters can generate some ozone.

    It is essentially a drop in replacement, however some circuit elements and code needs to be changed. For comparison:

    Carbon Monoxide (110-102)Ozone (110-401)
    Sensitivity4.75 nA/ppm
    -12 nA/ppm
    Range0 to 1,000 ppm
    0 to 4.75 uA
    0 to 5 ppm
    0 to -60 nA

    So while the sensitivity is higher, the range is much smaller and higher TIA gain is needed. Recommended is 500k, however the LMP TIA amplifier used will only go up to 350k. This means a maximum voltage output at -60nA of only 21mV. With a 10-bit ADC and a 3.3V reference, that would give us only ~26 counts to cover the full range of the sensor.

    The reference voltage needs to be reduced, but there is a limit. LMP91002 has a lower level of 1.5V:

    STM32L476 has a lower limit of 1.62 to 2.4V:

    So U8 can be replaced by LM4120AIM5-1.8 for example, to provide 1.8V Vref and 48 counts to cover the full range. Still not great, but better than before. Oversampling will help, although this point is really pushing the gain of the LMP91002.

  • Monitoring air during forest fires

    Thomas08/07/2017 at 03:12 0 comments

    Air quality today is very poor outside due to forest fires (Vancouver). This is PM2.5 of 120 ug/m³ or about 185/500 on the US AQI (

    Electrostatic filter is keeping it clean inside though, huge reduction in PM2.5 levels, up to 10x.

    Air needs cycling, as CO2 slowly increases over a day or two period, and all windows are closed.

  • Public git repo

    Thomas06/18/2017 at 17:36 0 comments

    I just realized the git repository was not public, so I have changed the settings to make it publicly accessible.

    Settings for gitlab, repository needs to be changed to "Everyone" apparently:

    The code is written to work with PMS7003, and the SDS021 support is in there as well, but it won't auto switch. So I change this line with the class definition:

    There must be a better way to do it in C++ but haven't figured it out.

    One way would be to have a master "particulate" class that searches for available sensors, and then calls the appropriate class depending on what was detected on startup. But it seems a bit redundant, as all functions would be copied to that class.

  • Measuring input voltage spike, ceramic capacitors

    Thomas06/13/2017 at 21:39 0 comments

    I read some reports of input voltage spikes when using plugpacks and large ceramic input capacitors, with low ESR. In traditional designs an electrolytic is used with a higher ESR, and this spike is generally not an issue.

    You can find the explanation in this TI paper,

    "Applying a voltage step to the input capacitors through a long cable causes a large current surge that
    stores energy in the power-lead inductances. The transfer of this energy to the capacitor produces a
    voltage spike whose amplitude can be up to twice that of the original voltage step."

    Input Filter Design for Portable Power Management System:

    I measured minimal overvoltage initially:

    Rapidly unplugging and plugging was able to achieve a bit of ringing:

    Worst case I was able to achieve the ~16V peak voltage above, 30% over expected. This is likely limited by the small plugpack (12V, 1A). Of course my input buck regulator is fine with this voltage (26V max), but, something to keep in mind with a sensitive circuit. To add an input TVS is not too expensive, and will protect against short and long term overvoltage (with a fuse).

View all 4 project logs

  • 1
    Step 1

    Board assembly - SMD

    1. Manually apply solder paste
    2. Place surface mount components on top using tweezers
    3. Heat with hot air to reflow solder
    4. Repeat for bottom layer components

  • 2
    Step 2

    Board assembly - through hole

    1. Install and solder connectors (Jx), switches (SWx), and MD4 (CO sensor).
    2. Solder super capacitor (C7), trim leads short.
    3. Ensure MD1 has been programmed (ESP8266).
    4. Solder MD1 and MD2 modules (wifi and uSD).
    5. Solder MD3 module (MH-Z19).

View all instructions

Enjoy this project?



Walter Hynson wrote 05/22/2020 at 05:42 point

Great project and your paper was fantastic,now why not make this as a raspberry pi hat as the market is there.

  Are you sure? yes | no

Oskar Weigl wrote 06/15/2017 at 03:36 point

Hello, I'd like to monitor the air quality in my room, to see how much pollution the nearby highway is causing.

Is this project ready enough that someone who is competent with electronics and STM32 development can get it to work? Can I buy a unit from you?

  Are you sure? yes | no

Thomas wrote 06/18/2017 at 16:53 point

You could buy from me but I would charge $350 or so, probably its too high for what people want to spend. The project is working, can compile the firmware yourself or get me to send a bin file.

You could try something like this, which is particulate matter and reasonably priced:

Or buy sensors on breakout boards and connect the modules to a nucleo dev board as I did originally.

  Are you sure? yes | no

Oskar Weigl wrote 06/18/2017 at 17:01 point

Cool, thanks for the aliexpress link! So that chinese marketing is a bit confusing, it looks to me that they only measuer PM2.5, and then they extrapolate for PM1 and PM10. Is that right? Thanks!

  Are you sure? yes | no

Thomas wrote 06/18/2017 at 17:24 point

Yes even the manufacturer documentation is quite confusing.

So that aliexpress "M5" module they call it, is using the PMS5003 laser sensor from plantower. Its $21 for that module alone. You can find a translated datasheet here:

It is able to differentiate dust particles into three bins, 0.3-1 um, 1-2.5um, and 2.5-10um. Then there is some extrapolation internally to give the "official" PM1, PM2.5 and PM10 readings. It is actually capable of measuring the diameter of these small particles. 

  Are you sure? yes | no

rjh427 wrote 06/08/2017 at 12:55 point

I wonder if this device will detect the scents we humans sometimes adorn ourselves with and if yes, provide some sort of scent strength indication. If no, can it be extended to provide that sort of data.

  Are you sure? yes | no

Thomas wrote 06/08/2017 at 22:06 point

No it won't detect scents in any meaningful way. For sure you can extend it to detect some of these areas. Perfumes are often very high in VOCs (65% or more), which is an important aspect of air quality I did not include. CCS811 is a popular VOC sensor that is available for about $13. 

However, that would only detect the presence of VOC, and not be certain how strong the smell actually is to a human. VOC could come from paint, plastics, etc. as well.

Good idea.

  Are you sure? yes | no

rjh427 wrote 06/09/2017 at 19:59 point

I have some family members who seem to be afflicted with a non-specific chemical sensitivity, I'm wondering if this might be helpful to them in one way or another. Especially when petty coworkers repeatedly show up wearing more than a typical quantity of their scent du jour. I'll keep following along.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates