34

The AirGradient DIY Air Quality Sensor (Pro Version PCB Version 3.7+)

 1 year ago
source link: https://www.airgradient.com/open-airgradient/instructions/diy-pro-v37/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Please note that these are the instruction for the DIY PRO PCB Version 3.7+ that has a configuration button. If you have the older version without button, please follow these instructions.

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 online shop 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.

pro_overview.jpg
Fully assembled AirGradient DIY PRO kit.

Skills And Equipment Required

For this project you should be familiar with the following:

Skill Description
Soldering skills Most 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 & Solder To solder the component pins and cables.
Breadboard A breadboard is helpful to fix the components in place during soldering.
Computer A 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 Cable A 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.

Component Approx. Price
Wemos D1 Mini v4 USB-C USD 4 - 6
1.3" OLED display USD 3 - 5
Plantower PMS5003 PM Sensor USD 15 - 20
Senseair S8 CO2 Sensor USD 25 - 30
SHT31 Temperature and Humidity Sensor Module USD 3 - 5
Button < USD 1
USB-C Connector 6 Pin < USD 1
JST Connector 1.25mm 8 Pin for PMS < USD 1
Resistors 5.1KΩ (2x) and 10KΩ (1x) < USD 1
Female Pin Headers < USD 1
Screws PMS 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 degrees USD 3 - 6
PCB See below on how to make a PCB
Enclosure See 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:

schematicpro37.png
The schematics

Make Your Own PCBs

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

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.

Firmware for PCB Version 3.7+ including code for optional AirGradient SGP41 TVOC / NOx Module

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.

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

Configuration

With the button, you can set the configuration of the display. Press the button on start up and it will enter a menu. In the menu you can set the unit for PM2.5 (μg/m³ or US AQI), the temperature unit (°C or °F) and also rotate the display.

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.

pro_parts_on_pcb.jpg
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)
oled_preparation.jpg
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.
oled_to_pcb.jpg
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”.

wemos2.jpg
Pin Sockets on PCB

Then solder the male pins onto the D1 Mini.

wemos1.jpg
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.

sht31pins.jpg
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.

sht1.jpg
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.

s8.jpg
Senseair S8 pin header soldering

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

s8_2.jpg
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:

pms1.jpg
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.

ag_diy_pms_cable.jpg
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.

pms2.jpg
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.

usbc.jpg
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.

Button

It is important that you solder the button so that you can use our software and are able to switch different configurations (e.g. Fahrenheit, Celcius etc.). A 10k resistors is also required so that the button works.

probutton.png
Button and Resistor

Optional SGP41 AirGradient TVOC / NOx Module

If you purchased the AirGradient TVOC / NOx module, you can solder female pin headers onto one of the top I2C slots and plug the module in there.

i2ctvoc.png
Slot for AirGradient TVOC / NOx Module

Please note that if you want to use some 3rd party TVOC modules, you might need to remove the pull-up resistors as the I2C bus already has the SHT and OLED module which both already have pull ups. We strongly recommend you use the AirGradient module which does not have pull-up resistors.

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.

diy_pro_3d_front.jpg
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.

CC BY-NC 4.0 Attribution-NonCommercial 4.0 International

This work is licensed under CC BY-NC 4.0.

This license requires that reusers give credit to the creator. It allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, for noncommercial purposes only.

Copyright AirGradient Co. Ltd.

Find the code on GitHub


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK