Indoor air quality plays a major role in health and comfort, especially since most daily life takes place inside homes, offices, schools, and healthcare facilities. The air indoors can shift in quality depending on many factors, from volatile organic compounds (VOCs) released by everyday activities and cleaning products to external environmental pollution.
Monitoring air quality has become valuable in many areas, such as:
- Industrial pollution control
- Public health initiatives
- Wildfire detection
- Climate and building management
- Air purification systems
- In-vehicle air monitoring
This tutorial outlines the process of building a particulate matter monitor with RAK products and integrating it into a professional IoT platform for data storage and visualization. The completed system collects air quality data and transmits it wirelessly using two widely adopted IoT communication protocols: LoRaWAN and NB-IoT.
This is the first project that was not developed by Blues Wireless in its accelerators, but rather proposed by the RAKwireless team. For that reason, it will not be compared directly with a Blues Wireless reference project.
Use Case
Particulate sensors are designed to measure the concentration of suspended particles in the air, specifically PM particles ranging from 0.3 µm to 100 µm. These sensors are widely used in both indoor and outdoor air quality monitoring.
They can detect particles ranging from PM0.3 to PM10. The smallest particles are of particular concern because prolonged exposure can significantly affect the respiratory system.
When deployed in a particulate matter monitoring system, the data enables real-time improvements to indoor environments. Air purification, ventilation, and filtration systems can be adjusted automatically, while alerts and preventive measures help protect the health and comfort of building occupants.
Requirements
Necessary Hardware
- Particle Matter Sensor Plantower PMSA003I
- WisBlock Baseboard RAK19001
- WisBlock Core RAK4631
- WisBlock Blues Carrier Module RAK13102
- LiPo Battery
- Blues Notecard (Select one according to your location)
- Blues Notecarrier A, B or F (Optional)
Gateway:
- RAK7268V2 WisGate Edge Gateway for LoRaWAN (used in this guide)
Back-End Services
Hardware Connection
The hardware adopts a modular approach provided by WisBlock. The complete firmware is developed and available in the official RAKwireless GitHub repository, and the IoT data visualization platforms are cloud-ready.
Connecting the WisBlock elements is straightforward:
Plug the core into the core slot and the RAK12039 Particle Matter Sensor IO slot of the card. In this guide, you will use the RAK19001 WisBlock Base Board, but you can select a different compatible WisBlock Base Board.
The Blues Notecard can be connected via the WisBlock Blues Carrier Module, which should then be plugged into the base board's IO slot.
Finally, to prepare your product for deployment, use the WisBlock enclosure, specifically designed for this purpose.
If you want to 3D print the custom enclosure for this project, you can find the RAKBox-UO150x100x45(D1)_F3D v3 enclosure design file on Thingiverse.
Now that the devices are connected, you can begin programming.
The Notecard requires a peak current of 2 A to send data. The VDD pin of the WisBlock cannot provide this current, so it is recommended to use a battery or connect an additional USB cable to the Notecard during your project testing.
Firmware Development
The code can be downloaded from the official RAKwireless GitHub repository. It was developed using Visual Studio Code and PlatformIO, which are two widely used tools for programming firmware.
In case the libraries are not available on PlatformIO, you can find them from the following sources:
If you need more information about how to configure and code your WisBlock setup with PlatformIO, check the guide for setting up WisBlock on PlatformIO.
Sending Data to the Cloud
LoRaWAN Communication
The process of communicating with end devices via LoRaWAN networks can be accomplished through a public network, such as Helium, or by setting up your network using a LoRaWAN gateway. In this instance, configure the second option. For this process, you will need:
This process is straightforward and can be completed in just a few minutes. For a detailed, step-by-step guide, refer to the RAK7268V2 gateway configuration guide.
After the successful configuration and connection of the gateway to the TTN LNS, use the given payload decoder.
TTN Payload Decoder
function Decoder(bytes, port)
{
var decoded = {};
if (bytes[0] == 1)
{
decoded.ppm10_standard = ((bytes[1] << 8) | (bytes[2]));
decoded.ppm25_standard = ((bytes[3] << 8) | (bytes[4]));
decoded.ppm100_standard = ((bytes[5] << 8) | (bytes[6]));
decoded.ppm10_env = ((bytes[7] << 8) | (bytes[8]));
decoded.ppm25_env = ((bytes[9] << 8) | (bytes[10]));
decoded.ppm100_env = ((bytes[11] << 8) | (bytes[12]));
decoded.ppm_03um = ((bytes[13] << 8) | (bytes[14]))*100;
decoded.ppm_05um = ((bytes[15] << 8) | (bytes[16]));
decoded.ppm_10um = ((bytes[17] << 8) | (bytes[18]));
decoded.ppm_25um = ((bytes[19] << 8) | (bytes[20]));
decoded.ppm_50um = ((bytes[21] << 8) | (bytes[22]));
decoded.ppm_100um = ((bytes[23] << 8) | (bytes[24]));
return decoded;
}
else if (bytes[0] == 5) {
// add more sensor data formats here
// } else if (bytes.[0] == xx) {
}
}Blues Communication
Just create an account on the Notehub page and then create a new project. For a detailed guide, you can review the Blues documentation to see the process step by step.
Blues Payload Decoder
This payload decoder is used when the transmitted data is sent via the Blues Wireless hardware.
function Decoder(request) {
var data = JSON.parse(request.body);
var device = data.device; // this is your Device UID
var decoded = {};
decoded.ppm10s = data.body.ppm10s;
decoded.ppm25s = data.body.ppm25s;
decoded.ppm100s = data.body.ppm100s;
decoded.ppm10e = data.body.ppm10e;
decoded.ppm25e = data.body.ppm25e;
decoded.ppm100e = data.body.ppm100e;
decoded.ppm03 = data.body.ppm03;
decoded.ppm05 = data.body.ppm05;
decoded.ppm10 = data.body.ppm10;
decoded.ppm25 = data.body.ppm25;
decoded.ppm50 = data.body.ppm50;
decoded.ppm100 = data.body.ppm100;
return [
{
device: device,
field: "ppm10s",
value: decoded.ppm10s
},
{
device: device,
field: "ppm25s",
value: decoded.ppm25s
},
{
device: device,
field: "ppm100s",
value: decoded.ppm100s
},
{
device: device,
field: "ppm10e",
value: decoded.ppm10e
},
{
device: device,
field: "ppm25e",
value: decoded.ppm25e
},
{
device: device,
field: "ppm100e",
value: decoded.ppm100e
},
{
device: device,
field: "ppm03",
value: decoded.ppm03
},
{
device: device,
field: "ppm05",
value: decoded.ppm05
},
{
device: device,
field: "ppm10",
value: decoded.ppm10
},
{
device: device,
field: "ppm25",
value: decoded.ppm25
},
{
device: device,
field: "ppm50",
value: decoded.ppm50
},
{
device: device,
field: "ppm100",
value: decoded.ppm100
},
];
}Datacake Connection
The connection to Datacake will be established by integrating TTN and Notehub with the platform. You can create two devices in Datacake or configure a single device to receive data from multiple platforms.
After configuring your device on the Datacake platform, check if the payload fields are being received correctly. If so, start configuring the field with the appropriate name and variable.
Figure 5: Datacake Fields Configuration
If everything has been set up correctly, you should see a data history display similar to the following image:
After completing the Notehub and TTN integration using Datacake's official guides, your dashboard should look similar to Figure 7:
You can now send data to Datacake using LoRaWAN or NB-IoT/BLE/Cat-1.
Strengths of Working with WisBlock
Figure 8: RAKwireless Particle Matter Sensor Final Assembly
Production-Ready: Not just a prototype, this is a finished product ready for real-world use.
Modular Design: Easy and fast to set up thanks to WisBlock's plug-and-play modular architecture.
Clean & Professional: Results in a polished and compact final product with minimal assembly.
Developer-Friendly Firmware: Compatible with Arduino and PlatformIO, no need for complex IDEs.
Multi-Network Communication: Supports LoRaWAN and cellular (NB-IoT, LTE-M, CAT-1) connectivity.
Quick Integration with Dashboards: Easily connected to IoT platforms, no advanced front-end/backend coding required.
Space-Efficient: Small form factor ideal for installations with limited space.
Stock Notice: Some components used in Blues' reference solution may no longer be available.
Summary
As presented in this tutorial, WisBlock is a modular hardware solution developed by RAKwireless that simplifies the development of industrial-grade IoT applications. When paired with Blues Wireless components, it enables rapid deployment without the need for a custom PCB design and offers some good features like:
Plug-and-Play Hardware: There's no need to design your PCBs. Just stack the modules and go.
Industrial Application Ready: Designed for reliable use in professional and commercial environments.
Prebuilt Firmware: Core functionality is already developed and ready for deployment, saving time and effort.
Developer-Friendly: Works seamlessly with platforms like Arduino and PlatformIO.
|
|
Harold Duarte Harold is an electronics engineer and senior technical content writer at RAKwireless. He is passionate about learning and developing new solutions for IoT, making it #IoTMadeEasy. |
Changelog
-
Version 1 - Indoor Particulate Matter Monitor with RAK WisBlock and
Blues Notecard
- Author: Harold Duarte
- Reviewer: Karla Jimenez
- Date Published: 10/02/2025
Updated