Air Quality Wing for Particle Mesh Documentation

Jared Wolff · 2019.11.13· 8 Minute Read

Air Quality Wing

The Air Quality Wing (Previously Particle Squared), designed by Jared Wolff, is an all-in-one air quality sensor for Particle and Feather based development boards. It brings together a trio of sensors to give you as many data points as possible. That way, there won’t be anything missing when you go to measure the air inside your home or workplace.

Here’s what’s on board:

Particulate Sensing

The Air Quality Wing has support for the Honeywell HPMA115S0 dust sensor. This sensor counts the concentration of potentially harmful particulates in the air. Plus, it does it all using lasers.

It can detect both large particles 10µm in diameter and smaller ones less than 2.5µm in diameter. These are the same readings that are commonly known as PM10 and PM2.5.

Sensing Volatile Compounds

Second to that, is the AMS CCS811. This senses volatile organic compounds (VOCs) and eC02. These types of readings are useful in places where there may be combustion. (Think stoves, furnaces, etc) It can act as an early warning mechanism. That way you stay safe, happy and healthy!

Temperature and Humidity

Finally, the Silicon Labs Si7021 temperature and humidity sensor. These readings can be used on their own. Additionally they’re used by the CCS811 to compute an accurate TVOC and C02.

Flexible Power Sources

No outlet nearby where you want to measure? No problem!

You can easily plug in almost any lithium polymer battery to your Particle or Feather based board and use it immediately. The Air Quality Wing has extra circuitry that allow you to use either USB or battery power. How great is that?

Board format

Labeled Air Quality Wing

Rev 4 Pictured Above

The board has four main parts. Here are the details on each:

  1. This is the connector for the HPMA115S0. It’s a Molex 532610871 and mates nicely with 0510210800
  2. This section is the power supply for the HPMA115. It allows you to use either battery or USB to power your particulate sensor. That way the HPMA115 get’s a clean 5V no matter what it’s connected to. The power supply is only designed to supply the HPMA115.
  3. The Si7021 is situated on a lily pad. If you look closely there is no ground fill on either side. This helps isolate the heater inside from other heat sources on the board. (Primarily the CCS811!) That way you get accurate readings using the standard factory calibration.
  4. Similarly, the CCS811 is on it’s own lily pad. This lily pad also has all ground fill removed for the same reasons as the Si7021. Earlier boards had both parts on the same lily pad which lead to erroneous temperature readings. This has been fixed as of Rev 4.

Note: to see the fully change history scroll to the bottom of this page.

Special Thanks to Tom F. who happened who wrote in with the suggestions to make the Air Quality Wing even better.

Getting Setup

Headers

Every Air Quality Wing comes with a set of female headers. One is 12 pins and the other is 16. They should always be populated on the rows closest to the sensors. Here’s an illustration:

Where to put the headers.

The best way to solder them is to insert them. Then hold the board and headers upside down and place on the end of table.

Slide on the edge of the desk

Slide the board so it’s the headers are sitting flat. Solder one pin on each header. Check to make sure the headers are perpendicular with the board.

Solder each pin

Note: this is the area where things could go wrong. Always check your work before continuing.

Note 2: remember, you’ll always be soldering on the side without components and the Rocket Bulb logo.

Connecting the Particle Sensor

If you purchased an Air Quality Wing with an HPMA115S0, it will come with a 50mm cable. Each cable has 4 wires. When inserting the cable, make sure that the wire orientation matches the position on the Air Quality Wing and HPMA115S0.

First insert the cable into the HPMA115S0 if it hasn’t already. Note that the group of three wires are on the left side and the Honeywell logo is visible.

Connect to the HPMA115S0

Then plug the cable into the Air Quality Wing. Notice the group of three are on the right side.

Connect to the Air Quality Wing

That’s it! You’re ready to start using your HPMA115S0 particle sensor!

Power Supply

There are two ways to power the Air Quality Wing USB and battery. Here are some important points to remember when powering everything up!

Using USB - connect a Micro-B USB cable into a port that can supply at least 500mA. That will ensure that it will power your Particle Mesh Board as well as the Air Quality Wing. If you are using a Boron, make sure that the source can provide at least 1A of current.

Power using USB

Using battery - similarly, you will have to size the battery to how long you want to run the Air Quality Wing for. At the very least, it’s recommended to use a lithium battery larger than 100mAh. This will ensure that the HPMA115 will get enough current to take measurements.

Power using battery

Software

You can get started immediately by cloning the latest working code from Github:

git clone git@github.com:jaredwolff/air-quality-wing-code.git

If you are working on your own project, you can also install the library separately using the instructions below.

Installing The Library

The Air Quality Wing has it’s own library! You can install it to your project using Particle Workbench’s library functionally.

Search for and install AirQualityWing. As of this writing 1.0.2 is the latest version.

Need more details on how to get it all working?

Here’s a step by step:

Open Workbench and the project you’d like to add the library to. Then, hit CMD + Shift + P and type Install Library

Installing library in Particle Workbench

Type in AirQualityWing and press enter. Particle Workbench should install the library to your project. Watch the bottom right hand corner for status updates:

Install progress

You can also use the CLI to accomplish the same task. Remember, for this command you’ll need to be in your root firmware directory for the library to be installed correctly!

particle library install AirQualityWing

Remember: this library only supports Particle Mesh. Photon, E-Series, etc are not supported.

Using the Library

The library has been designed to be as easy as possible to use. Here are some important points if you want to add it to your own projects.

First make sure that you create an AirQualityWing object.

// AirQualityWing object
AirQualityWing AirQual = AirQualityWing();

Setting up I2C must be done before setting up the library. This is as simple as invoking Wire.begin()

Wire.setSpeed(I2C_CLK_SPEED);
Wire.begin();

Then, to initialize you’ll have to create an AirQualityWingSettings_t structure.

    // Default settings
  AirQualityWingSettings_t defaultSettings =
  { MEASUREMENT_DELAY_MS, //Measurement Interval
    false,                //Has HPMA115
    true,                 //Has CCS811
    true,                 //Has Si7021
    CCS811_ADDRESS,       //CCS811 address
    CCS811_INT_PIN,       //CCS811 intpin
    CCS811_RST_PIN,       //CCS811 rst pin
    CCS811_WAKE_PIN,      //CCS811 wake pin
    HPMA1150_EN_PIN       //HPMA int pin
  };

This is where you can customize the board to match your needs. Some of the most important functionality is the default measurement interval along with enabling and disabling a certain sensor. For the Air Quality Wing all devices should be enabled. The definitions for the pin assignments will be in board.h located in the example code repository.

AirQual.setup() will configure the drivers for all the different sensors. You also use it to configure a callback that fires after data collection.

AirQual.setup(AirQualityWingEvent, defaultSettings);

Data collection begins once you call the begin() function.

AirQual.begin();

In the main loop() run the .process() function

uint32_t err_code = AirQual.process();
if( err_code != success ) {

    switch(err_code) {
      case si7021_error:
         Particle.publish("err", "si7021" , PRIVATE, NO_ACK);
          Log.error("Error si7021");
      case ccs811_error:
         Particle.publish("err", "ccs811" , PRIVATE, NO_ACK);
          Log.error("Error ccs811");
      case hpma115_error:
         Particle.publish("err", "hpma115" , PRIVATE, NO_ACK);
          Log.error("Error hpma115");
      default:
        break;
    }

  }

As you can see above, you can also check for errors and report them if they happen.

Most importantly, you can use the .toString() method to create a JSON string representation of the data. This can be used with Particle.publish() like the example below:

// Handler is called in main loop.
// Ok to run Particle.Publish
void AirQualityWingEvent() {

  // Publish event
  Particle.publish("blob", AirQual.toString(), PRIVATE, WITH_ACK);

}

Once you’re publishing data, it’s time to collect and view it all. Check out the next section on integrations for more info.

Integrations

Grafana for the Air Quality Wing

There are many integrations that you can use with the Air Quality Wing. One of the most useful is the Grafana + InfluxDB integration. A full writeup on how to use that is located here.

Where can I get one?

They’re available for purchase directly from the following:

Schematics

A schematic of each design are available for download below:

The hardware up to Revision 3 are also available on Github and BitBucket:

Enclosure

If you’re wondering, yes there’s an enclosure! Many thanks to the designer, Nicholas, for taking the time to make this amazing enclosure.

Air Quality Wing Enclosure

Provided courtesy of Nicholas.

You can print your own by downloading the STL files in this Github repository.

Side note: as of this writing, there are some issues with holes lining up with the holes on the board. Only the stand-offs should be used:

Installation tip 1

Also you may have to grind away at the area closest to the USB connector.

Installation tip 2

This is due to the header bits extending beyond the bottom of the board.

Version History

Here is the changes since revision 2 of this board.

Revision 5 (coming soon)

  • Reduced the size to match traditional Featherwing footprint.
  • Fixed bug where D5 was attached to both the CCS811 and the Load Switch enable

Revision 4

  • Relocated the Si7021 to a separate “lily pad” for heat isolation

Revision 3

  • Fixed bug related supply voltage not being stable to the HPMTA115S0
  • Relocated D7 to D5 for CCS811 reset signal
  • Changed connector pinout. That way the cable does’t have to be twisted.

Revision 2

  • Added ferrite to shunt noise
  • Swapped out MCP1624 with MCP1640
The Ultimate Guide to Particle Mesh Cover

Get Ready for the Ultimate Guide

Signup to get updates on The Ultimate Guide to Particle Mesh. Early subscribers get a discount when it becomes available!

Sign me up!