Because of the decrease in international travel over the last couple of months, the postal service doesn’t have enough flights available to carry international letters and parcels.
As of this week, Australia Post can’t process “Economy” class international packages at all. Some premium classes of package, such as trackable services and International Express, are still being accepted at post offices. However, even these more expensive shipping options are experiencing weeks of delays.
Sadly, this means that I simply can’t ship international packages at the moment. I can still ship orders to Australian customers without any problems: domestic packages are being processed and transported as normal. It’s the lack of international flights that is the big problem.
I’ve now turned off all shipping methods for international customers.
The moment that the postal service has resumed international service, I’ll turn international shipping back on. Until then, I can only process orders for Australian customers.
You can build the Air Quality Sensor project without understanding how the software works, but if you want to know what’s really going on behind the scenes you can join me for a deep dive into the source code.
Printing a case is totally optional, of course. You can use whatever enclosure you like. My case has been designed to be a press-fit over the PMS5003, which holds the two halves together by friction. See the link above to download the STLs if you want to print it yourself, or you can buy a case from me if you don’t have access to a printer. I’ll include a 6x6x9mm tact switch with the “Display” version of the case:
Put switch into case
The space for the tact switch is very tight.
To fit it into the slot, trim off the pins from the right side and trim the pins on the left side so they are a couple of millimeters long. Bend those leads out at a 45 degree angle, and solder a pair of jumper wires to them.
Push the switch into the cavity in the case as shown above, and guide the wires around the slot to the left and then down.
The button connects between GND and I/O pin D3:
Connect 128×32 OLED to D1 Mini
The 0.91″ 128×32 OLED module already has I2C pull-ups included, so there’s no need to add them. All we need to do is connect power and I2C:
The connections are:
OLED GND to D1 Mini GND
OLED VCC to D1 Mini 3.3V
OLED SCK to D1 Mini pin D1
OLED SDA to D1 Mini pin D2
Connect PMS5003 to D1 Mini
In the “Basic” version of this project, we only needed to connect to the 5V, GND, and Tx pins of the PMS5003. Now we also need to connect I/O pin D6 to the sensor’s Rx pin, to allow commands to be sent to the sensor:
The connections are:
PMS5003 pin 1 (5V) to D1 Mini 5V
PMS5003 pin 2 (GND) to D1 Mini GND
PMS5003 pin 4 (Rx) to D1 Mini pin D6
PMS5003 pin 5 (Tx) to D1 Mini pin D4
Close the case
This can be more tricky than it sounds! Be gentle so you don’t damage anything.
With the electronics sitting neatly in the “back” (or “right”) half of the case, make sure all the wiring is neatly tucked into the slots. It should look something like this:
Slide the other half of the case over the modules, checking that no wires are pinched between the halves. The case should close completely.
Set up Arduino IDE for ESP8266
If you don’t already have it, download and install the Arduino IDE:
By default, the Arduino IDE does not support the ESP8266 processor on the D1 Mini. To add this support, go to the following URL and follow the instructions. The easiest method is to use the Boards Manager:
The “PMS” library is directly embedded within the program, so you don’t need to install it. This is done to force a specific version of the library, which was forked from the official version by GitHub user SwapBap to add extra features. There’s nothing you need to do because it’s part of the project.
In the Arduino IDE, go into “Sketch -> Include Library -> Manage Libraries…“
Then search for each of these libraries, and click “Install”:
The easiest way is to click the green “Clone or download” button near the top right of the page and select “Download ZIP”. Once you’ve downloaded it, extract the folder and put it in your sketchbook directory. You can find the correct location for this by looking in the Arduino IDE preferences.
Configure and compile sketch
Open the Arduino IDE, open the sketch, and have a look at the 4 tabs across the top. You can ignore the first three. Open the “config.h” tab, and modify the settings for WiFi and your MQTT broker:
Plug in the Air Quality Sensor using a USB cable.
Select “Tools -> Board:” and set it to “LOLIN(WEMOS) D1 R2 & mini”. Select the port, and upload the sketch:
After the sketch has uploaded the Air Quality Sensor will reboot, connect to your WiFi and MQTT broker, and show values on the display once it has successfully received data from the PMS5003.
Stay tuned for part 3, which will explain how the sketch works and how to read the data from it.