The AirGradient DIY Air Quality Sensor (Pro Version)

Introduction

The AirGradient Pro DIY monitor measures PM2.5, CO2, temperature and humidity. These measures can be shown on the display and sent to a server (e.g. the AirGradient platform or any other cloud backend) for data logging.

The AirGradient Pro version has the following advantages compared to the DIY Basic Kit:

  • Highly extendable e.g. with a TVOC or barometric pressure sensor, a battery charger, RGB LEDs, etc.
  • More accurate measurement for temperature as the enclosure has been designed for enhanced airflow and the temperature sensor is separated from the other components.
  • Larger OLED display allowing more information to be displayed.

You can completely build the monitor on your own with the instructions below and open-source code or, optionally you can go to our store and purchase it as a kit that includes a professional enclosure. We also offer the kit as a pre-soldered version for a very easy assembly.

IMPORTANT: For the pre-soldered version, follow these instructions.

Fully assembled AirGradient DIY PRO kit.

Skills And Equipment Required

For this project you should be familiar with the following:

SkillDescription
Soldering skillsMost of the components we use need soldering. The USB and PMS connectors are small and therefore difficult to solder but these connectors are optional and the monitor can also be built without them.
Soldering Iron & SolderTo solder the component pins and cables.
BreadboardA breadboard is helpful to fix the components in place during soldering.
ComputerA Linux, Mac, or Windows computer with the Arduino IDE installed to flash the software onto the D1 Mini. You can also flash the software directly from the browser.
USB-C Data CableA USB-C cable for flashing the microcontroller and later powering it. If you use the enclosure, you need a 90 degree USB-C cable plug.

In case you are unfamiliar with soldering or want to get the monitoring working as quickly as possible, we also have pre-soldered kits available, which can be assembled in just a few minutes with no soldering needed.

Components

Below is the list of components that you need to source, with a link to AliExpress and typical price ranges. Please note we have no association with the linked sellers and only provide the links as an example of the components, not an endorsement of a seller or a guarantee of the linked product quality.

ComponentApprox. Price
Wemos D1 Mini v4 USB-CUSD 4 - 6
1.3" OLED displayUSD 3 - 5
Plantower PMS5003 PM SensorUSD 15 - 20
Senseair S8 CO2 SensorUSD 25 - 30
SHT31 Temperature and Humidity Sensor ModuleUSD 3 - 5
USB-C Connector 6 Pin< USD 1
JST Connector 1.25mm 8 Pin for PMS< USD 1
Female Pin Headers< USD 1
ScrewsPMS Sensor: M2*4.5 (Torx M6), PCB: M1.7x5 (Philips/Torx M6), Enclosure: M1.7x10 (Philips/Torx M6). The longest screws are for the enclosure. The screws with the washer are for the PCB and the remaining screws for the PMS Sensor.
USB-C Cable 90 degreesUSD 3 - 6
PCBSee below on how to make a PCB
EnclosureSee below on how to 3D print the enclosure
SGP 30 TVOC Sensor (Optional)USD 8 - 15 (not included in the AirGradient Kit)

AliExpress might not ship to all countries. In case they do not ship to your country, please try and source the exact same component from elsewhere.

You can also purchase the kit with all required components from our Online Store and be sure that everything fits. We ship world-wide.

Schematics

You can use the following schematics:

The schematics

Make Your Own PCBs

In case you want to make your own PCB you can use our Gerber files.

You can also get the components working without the PCB just by soldering the sensor modules with wires directly to the D1 Mini.

Monitor built without PCB

However, we strongly recommend you assemble the monitor with a PCB as it will be much easier and more robust.

Direct Flashing Through The Browser

You can either manually flash the code through the Arduino software or use the more simple buttons below.

Connect the D1 Mini to your computer through a data-capable cable and press the button below. Make sure you use the Chrome or Edge browsers on your computer for this to work.

Features
With temperature in Celcius Your browser doesn't support this. Please use Chrome or Edge on Mac or PC. You are not allowed to use this on HTTP!
With temperature in Fahrenheit Your browser doesn't support this. Please use Chrome or Edge on Mac or PC. You are not allowed to use this on HTTP!

Once the code is flashed, it will open a hotspot for 60 seconds to which you can connect and then set your Wi-Fi credentials. By default it will connect to the AirGradient Dashboard. If you want to use another endpoint you can change the code with the manual flashing method below.

If you do not connect it to Wi-Fi within the 60 seconds after startup it will go into the offline mode and show the air quality parameters without sending the data.

If you flash with the method above, you can skip the next section and continue at the section “Soldering the Components”.

Manual Flashing With The Arduino Software

The above direct flashing is the easiest way to get the firmware onto the D1 Mini but if you want to make changes to the code, you can also flash the code through the Arduino software environment. All software for the AirGradient DIY sensor is open source and thus you can make any changes you’d like.

Please read the following blog post on how to install the Arduino software, set up the D1 Mini board and the AirGradient Arduino library.

AirGradient Arduino Software Setup Instructions

Flashing Of The AirGradient Firmware

Once you have the Arduino Software setup for the D1 Mini, you can flash it with the AirGradient firmware.

StepDescription
1Go to Tools, Manage Libraries, and then search for AirGradient and install the AirGradient library.
2Once it is installed, go to File, Example, AirGradient and select the DIY_PRO code
3Read the instructions on top of the example code and install the additional libraries
4Then flash this code the same way you flashed the BLINK example
5Once you have successfully uploaded the code you can continue building the hardware

Soldering The Components

Now that you have the firmware flashed, you can solder the components onto the PCB. Make sure you solder the pins in the correct direction.

Location of the Components on the PCB

We recommend you start in the following order:

OLED Display Soldering

To fit the OLED display perfectly into the enclosure, the pins need to be adjusted because they reach out too far. Please follow these three steps:

  1. Remove the black spacer with a small screwdriver or with a small pair of pliers (see Step 1 in the figure below)
  2. Take the hot soldering iron and push the pins inwards so that they do not stand out too much anymore (see Step 2)
  3. To ensure that the pins still have strong contact with the display, add some solder on the backside around the pins (see Step 3)
Steps to adjust the Display Pins
  1. Put the OLED display through the PCB and mount it into the enclosure. Make sure you tighten all four screws of the PCB. Move the OLED so that it is correctly aligned and use tape to temporarily fix it in place.
  2. From the opposite side, check that the display is properly aligned.
  3. Solder the display as quickly as possible to prevent damage to the enclosure (melting or deformation from the soldering heat). Put the soldering iron at the lowest temperature that still ensures proper contact. After the soldering is done, immediately use a fan to cool down the solder points as fast as possible.
  4. Clip off the outstanding pins and carefully remove the tape without damaging the display cable.
Soldering the OLED Display onto the PCB

D1 Mini Soldering

We recommend to solder all components with pin sockets so that it is easier to replace components or troubleshoot if something does not work.

Important: If you solder the D1 directly on the board, leave enough space between the D1 and the PCB so that you can plug in the USB cable.

First solder the female pin headers onto the PCB where it says: “Microcontroller”.

Pin Sockets on PCB

Then solder the male pins onto the D1 Mini.

D1 Mini soldering

Then you can put the D1 Mini onto the PCB. Make sure that the orientation is correct and that all pins go into the socket.

Soldering The SHT31 Module (Temperature and Humidity)

To solder the small pins onto the SHT31 module, you can use a breadboard to fix the pins into place. No need to do anything with the two pins on the top of the sensor. Only solder the four pins at the bottom of the module.

Soldering Pins onto the SHT Module

Then solder female pin headers onto the board. The SHT is located at the far isolated corner of the PCB to help ensure accurate temperature measurement.

SHT placement with pin sockets

Then put the SHT31 module onto the pin socket and make sure you have it on in the correct direction.

Soldering The Senseair S8 Module (CO2 Sensor)

To solder the small pins onto the S8 module, you can use a breadboard to fix the pins into place.

Make sure that the pins face upwards as can be seen on below image.

Important: Compared to the smaller DIY Basic kit, the pins here are soldered the opposite way to enhance the accuracy and airflow around the sensor.

Senseair S8 pin header soldering

Solder female pin headers onto the PCB. Then put the S8 onto the pin headers.

Female pin headers soldering for the Senseair S8

Connecting The PMS5003 (PMS Sensor) Cable

The PMS Sensor is connected with a cable to the PCB. There are two ways to connect it. If you can solder the small JST connector, then solder it on the board:

PMS JST Connector

Make sure it is soldered in the correct way (as indicated with the silkscreen and can be seen in the image above).

In case you cannot solder these small pins, you can also cut and splice the cable and solder it directly onto the PCB.

Prepare the following four wires as per this image. Please make sure you cut the correct wires.

PMS Cable Wiring

NOTE: It can be confusing that the default cable of the PMS has a black cable for VCC as normally VCC uses red color.

Solder the cable onto the PCB. Please make sure that you solder the correct cable to the correct pin.

PMS PCB Connection

After you have soldered the cable onto the PCB, connect the PMS5003 with the other end of the cable. Then screw the PMS5003 onto the PCB.

USB-C Connector

If you are confident with soldering the small pads, you can solder the USB-C connector onto the board.

PMS USB C Connector and Resistors

Note that you cannot flash the device through this USB-C port. It only provides power. To flash the D1, you need to connect the cable directly to the MCU.

If you want to use the monitor with smart power adapters (e.g. ones providing a range of voltages), you need to also solder two 5.1k resistors onto the board. If you just want to use a normal 5V power adapter you do not need to do this.

Alternatively, you can use the bigger hole on the back of the enclosure to feed the cable in and connect it directly to the D1. Then you do not need to solder the USB-C connector. Please note that only a straight USB-C cable fits through the hole. So if you get the 90-degree cable from our kit but do NOT want to solder the USB-C connector, you either need to make the hole larger or get a straight USB-C cable.

Optional SGP30 TVOC Sensor

If you want to measure chemicals you can connect a Sensirion SGP30 TVOC sensor to one of the I2C slots on the top left of the PCB. Check the module specifications if it should be installed in the 3 volts or 5 volts slot. Most modules can be installed in both. However since all I2C modules already have pull-up resistors on the I2C bus, the system might become unstable.

In this case, removing the pull-up resistors on any of the modules will help. It is easiest to remove it on the SHT temperature / humidity module with a soldering iron. The following picture indicates which resistors need to be removed:

Pull-Up resistors to be removed on SHT3x module

You can solder female pin headers on the PCB if you want to be able to easily remove the module.

Testing And Putting It Into The Enclosure

Now you can power on the device and you should be able to see the display lighting up. If you flashed the Wi-Fi version, you need to connect it to the Wi-Fi. To do this open you Wi-Fi settings on the phone and look for a hot spot called “AirGradient______”. Then connect to it and enter your Wi-Fi network credentials. It will then connect to Wi-Fi and start displaying and sending the air quality data.

In case you have any issue, check this guide or get help from the Open AirGradient Forum.

If everything works, you can screw the PCB into the top cover of the enclosure and close the enclosure.

3D Enclosure

You can download STL 3D printer files to print an enclosure that exactly fits the PCB. The 3D enclosure consists of three parts: a top, a bottom and a back cable connection part. The ZIP file also contains the STEP file so that you can make adjustments.

Download Enclosure STL Files

If you do not want to print, our DIY PRO Kit includes a high-quality UV-resistant injection molded plastic enclosure.

3D printable PRO enclosure

Solutions For Schools

AirGradient offers a sophisticated, powerful and responsive Air Quality Monitoring Solution for Schools. You can connect these DIY monitors to the AirGradient platform, integrate with many existing brands or use our professional AirGradient ONE monitor.

If you are interested in a free trial of the solution for schools, please contact us.

AirGradient Dashboard

Our kits come with several months of free subscription to the AirGradient dashboard. To connect your monitor to the dashboard, please follow these instructions.

MIT License

The AirGradient DIY sensor’s hardware and software is open source and licensed under the MIT license. So feel free to use it any way you like. We would be happy to hear from you and also appreciate any link back to our page.

Copyright AirGradient Co. Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.