This is our last version 2.1.
With this guide, you will be able to build a device to measure air quality by using a Panasonic SN-GCJA5 sensor which measures Particle material PM2.5 and sharing your measurement via your phone with the CanAirIO App or your wifi to the web page InfluxDBCanAirIO.Materials
Materials list (links in the list of Hardware components):
1. Panasonic sensor SN-GCJA5L (1)
2. Booster power source DC DC (1)
3. ESP32 TTGO T7 (d1mini v2) (1)
4. OLED display module D1 mini (1) with pin headers (2)
5. Wire adapter to battery (1) ---> Choose 2Pin and JST 1.25mm
7. Tools and others: Cutter, soldering iron, solder, 0.3mm MDF board for the box.
NOTES about the battery:
- The battery is one of the most difficult components to import due to restrictions in each country. In some countries there are problems to import this type of batteries sometimes, but there are local suppliers who sometimes have them.
- The battery used in the project has maximum dimensions of 10x34x50 millimeters, but can be smaller than that in order to fit in the box, always of the same voltage, the value in current determines the duration time of the device turned on.
Part 1: Hardware
Below are some important sections of the video to consider:
ESP32 board + OLED display
Please keep in mind the right position of OLED over the board, please check in the video the right side of these boards.
Panasonic PM sensor connection
You only need three cables to connect the sensor, from the original Panasonic connector please use, the red, black and blue cables. These cables should connect to ESP32 (VCC, GND y 17) pines, like this:
Optional: Temperature and Humidity sensor
These sensors could be help to validate the PM sensor values. In fixed stations outside we recommend it, because we need humidity below 95% for right PM values and at the outside the meteorology varies much. We are using a AM2320 sensor that has these sensors, and it we connected to the ESP32 via i2c port:
We need connect four cables from AM2320 sensor to to ESP32 pines: VCC, GND, 21 and 22, like this:
The device requires a software called firmware when talking about hardware, which will control the sensor, Bluetooth and other peripherals such as the screen or WiFi type radios. For the moment, we have two options to load the firmware, via installing from PlatformIO or from binaries on Windows:
1. PlatformIO Installation alternative
On your PC please install PlatformIO which is responsible for compiling and uploading the firmware to the device, also it is Arduino compatible firmware, this software can be installed in a minimum version, CLI, in Windows, Mac or Linux as described in the link and will be responsible for managing the USB port of your PC to connect the device and achieve this task every time you need to update the firmware.
If installation was correct, you should have the pio command in your console or Windows PowerShell, so check it out by running:
$ pio --version
PlatformIO, version 4.3.4
For some libraries, it is recommended to install Git in your system, you will find a version for your PC here
Compilation and Firmware Installation
Follow the steps below from your console or PowerShell by executing the commands described below:
$ git clone https://github.com/kike-canaries/esp32-hpma115s0.git
Cloning into 'esp32-hpma115s0'...
remote: Enumerating objects: 208, done.
remote: Counting objects: 100% (208/208), done.
remote: Compressing objects: 100% (132/132), done.
remote: Total 492 (delta 105), reused 167 (delta 68), pack-reused 284
Receiving objects: 100% (492/492), 7.18 MiB | 2.71 MiB/s, done.
Resolving deltas: 100% (239/239), done.
Checking connectivity... done.
Enter the directory:
$ cd esp32-hpma115s0
Connect your sensor from the micro USB port to a USB port on your PC and run the following command to compile and upload the firmware:
pio run -e d1mini --target upload
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 15088 bytes to 9755...
Wrote 15088 bytes (9755 compressed) at 0x00001000 in 0.1 seconds (effective 916.2 kbit/s)...
Hash of data verified.
Hard resetting via RTS pin...
================== [SUCCESS] Took 86.99 seconds ==========================
After uploading the firmware the information should appear on the display:
For more detail of the compilation process, firmware upload or problems with it, check the official Github of the application. If you find problems or errors you can also report them there.
2. From Windows alternative using binaries
This option not need compiling the binaries, you can download the pre-built binaries from our Github in the section releases, and please follow the next steps:
1. Download the zip file with the name canairio_revxxx_20xxXXXX.zip and uncompress it. Example:
2. Please download the official Espressif software: "Flash Download Tools (ESP8266 & ESP32)" from https://www.espressif.com/en/support/download/other-tools
3. Please connect your board using a USB data cable, some power bank or charger cables could not work. If you Windows machine don't have the drivers, please download it before.
4. Open the software Flash Download Tools.
5. Please choose "Developer Mode" and then, the third square "ESP32 DownloadTool".
6. After that, the window for load the binaries files will be show:
6.1. Please load the four files like is showed in the screenshot with the next values:
bootloader_dio_40m.bin... @ 0x1000
partitions.bin... @ 0x8000
boot_app0.bin.... @ 0xe000
canairio_d1mini_revxxx_xxxxxxxx.bin... @ 0x10000
6.2. check the speed:
SPI SPEED: 40MHz
SPI MODE: DIO
6.3. check the option: DoNotChgBin.
6.4. Please show your serial comm port and velocity.
6.5. Please click in the START button.
6.6. When the firmware downloading finished, please click STOP button.
7. Disconnect your board from the USB cable.
8. Reboot your device and CanAirIO home screen will be showed.
Parte 2: Assembled box.
If you wish, you can print a box for your device by laser cutting. In the attachments section you will find the template to print a single box in MDF 0.3 mm or another one for 14 boxes in a sheet of the same thickness with a similar content to this image:
Please turn on you CanAirIO device, it should be in the right position, keep in mind don't block the input/output air hole.
For now you need any Android device with Bluetooth 4 or above. You can download the CanAirIO app from GooglePlay, keep in mind that it is in continuous development then please any feedback, report errors, or any thing please let us know it via our contact form or on our Telegram chat.
The CanAirIO app need bluetooth and localization permissions if you using it with the sensor. If you only want see the public reports you don't need these permissions.
You have two configuration options of your CanAirIO device from the app:
1. Mobile Station Mode:
This option is for able to record tracks on your device (Sdcard) or for publish these tracks to the cloud (share). Please before, follow the next steps:
Recording track and share:
Video tutorial about the App use:
NOTE: Also all recorded tracks will be saved in the
/sdcard/canairio/ directory on
2. Fixed Station Mode:
Also, you can connect your CanAirIO device to the WiFi and leave this like a fixed station. In this mode you only need the Android app only for initial settings, after that the device could be publish data without the phone. For this you need configure it in settings section:
- Station Name: for example: PM2.5_BOG_XXX_XXXX_EXX (BOG: City Bogotá, XXX: Location, XXX: Neighborhood or zip code, EXX: Station number XX).
- Wifi Name and Password: Your credentials for connecting to your Wifi.
- InfluxDb Cloud: CanAirIO server (or your personal instance of InfluxDB server): Database Name: canairio
Enable InfluxDB Cloud: ON (switch to the right)
CanAirIO Cloud: For configure the CanAirIO API, you can get a username and password doing registration in this link and view captures here (if don't work please write to us). For details please see the firmware documentation CanAirIO API section.
- Current Location: The current position of your fixed station.
- Reboot device: Only for restart your CanAirIO device.
- Factory Reset: For set all settings to default on your CanAirIO device.
Note: If you want your device like a fixed station, your need connect it to a external power source.
In this webinar we explain how contribute to air quality monitoring through citizen science and how to make your own CanAirIO:
The CanAirIO device has the next specifications:
- Particle matter range: PM1.0, PM2.5, PM10 from 0 to 999 ug/m3.
- Bluetooth and Wifi supported.
- Bluetooth 4 Low Energy for mobile measures.
- WiFi for fixed stations
- Independent cloud alternative via influxdb.
- Display OLED 64x48 pixels.
- Battery life: 4-6h (220mAh aprox).
- Box dimensions 55x44x40 mm.