After covering this project's overview and goals in Part 1 - Introduction, it is now time to build the thing.
Putting it together does not require any specific tool. Just get the parts, connect the cables, download the Arduino code and libraries. That's it, ready to run.
Once working, this datalogger can be used to monitor potential pollutants from cooking, furniture, 3D printing, night sleep, woodworking, wildfires, city traffic, etc. Head on to Part 3 - Results (coming) to see actual recorded examples.
Everything is open source (Arduino code, CAD files...) and published in this Github repository
For questions or requests: either post a comment below or submit an 'issue' on Github.
Happy build and clean air to all !
Table Of Content
- Schematics
- Parts
- Parts-Holder
- Code
- User Guide
- Enclosure (coming)
- High-capacity Battery (coming)
- Basic Arduino Sketches
Schematics
Parts
All the sensors are optional. For the sensors shown in the schematics above, see Part 1 that documented each part's type & source, and alternatives. Note that if using an alternative part you may have to modify the code and libraries accordingly.
Regarding cables, make sure to procure the appropriate types. They depend on both the connector used by each supplier (Grove, JEMMA QT, JST PH or SH, etc) and by each user (male or female header pins, soldered, etc). So they aren't listed in this post to avoid mismatches and confusion.
Finally, to tame the tangle of cables and devices dangling from the WIO, the following 3 parts were also used. They are not needed to get a functional system, but can be very helpful during development, in conjunction with the Parts-Holder below.
GPIO Expansion Board for Raspberry Pi ($5): this board connects to the back of the WIO and brings out the 40-pin header's signals so they face the user. Makes it much more practical to move wires around and experiment.
Note that I also soldered a 40-pin female header on top of the through-hole pins of its back-facing header (see the Parts-Holder pic in the next section). This allowed to directly connect the male plugs from Sparkfun's SEN55 cable.
Grove I2C Hub (6 port) ($1.7): to connect several I2C devices on an I2C bus.
Adafruit Perma-Proto Half-sized Breadboard PCB - 3 Pack ($12.5): may be helpful during the coming development of the high-capacity battery option, and easily add discrete electronic components. The board neatly sits under the 18650-cells holder, as can be seen in the Parts-Holder pics below.
Parts-Holder
After losing a wire connection one too many times when moving the whole enchilada between benches, I 3D printed this Parts-Holder. Completely optional but makes life easier during development.
Just basic 3DP settings: PLA filament, 0.4mm nozzle, 0.28 layer height, 3 walls, 3 tops, 2 bottoms, 25% adaptive cubic infill, no support, no brim.
Both the Fusion 360 CAD model and the STEP file are on Github (link in the opening).
Code
The full Arduino code is on Github (link in the opening) and called WIO_Air_Quality_Monitor_Datalogger_V1_Local_Sensors.ino
To get started download the necessary libraries below.
No need to connect any sensor, the boot screen will just show the missing sensors and ask whether to proceed. In that case, the Values and Chart screens will simply be empty for the sensors that are absent. This said, at least one SEN55 Air Quality sensor should of course be connected (on I2C0 first) to make this application useful.
In case of issues, see the Basic Sketches section at the end for individual sensor testing and library details. Or drop a comment on this page, or log a Github issue, and I'll come back to you.
Bonne chance !
(1.0) color sensor values based on Alert Thresholds
(1.1) add optional Large Capacity battery
Warning: I am by no means a seasoned SW developer. Which explains the
aberrant mix of Arduino / C / C++ and the spaghetti
code. I don't envy anyone touching this... 😂 Hit me in case of questions or feature requests.
Libraries
Probably the most delicate part of the setup. I didn't track all the sources, or the order of installation. That might create pain points for some users. Sorry for that...
The Arduino IDE's Library Manager shows the following installed:
Mandatory
- Adafruit BusIO by Adafruit 1.16.1 (I2C/SPI related)
- Adafruit Zero DMA Library by Adafruit 1.13 (used by Seeed for the TFT screen)
- Seeed Arduino FS by Hongtai.liu 2.1.1
- Sensirion Core by Sensirion 0.6.0
- Sensirion I2C SEN5X by Sensirion 0.3.0
- Sparkfun BQ27441 LiPo Fuel Gauge Arduino Library by Sparkfun Electronics 1.1.0
- Not a library but MUST be included in the same folder as the datalogger sketch: lcd_backlight.hpp.
Optional
- Grove - Multichannel Gas Sensor by Seeed Studio 1.0.0
- RTCLib by Adafruit 2.1.4
- Sensirion I2C SCD4x by Sensirion 0.4.0
Now, I get a ton of "parameter passing changed in GCC 7.1" warnings during compilation, pointing at Seeed libraries. And the following:
Multiple libraries found for "TFT_eSPI.h". Used: ...\Seeed_Arduino_LCD-master. Not used: ...\Seeed_Arduino_LCD
Multiple libraries found for "Adafruit_ZeroDMA.h". Used: ...\Adafruit_ZeroDMA. Not used: ...\Adafruit_Zero_DMA_Library
Annoying but works so far... 😅
User Guide
A Quick Overview guide is in the works.
Enclosure
In the works.
High-Capacity Battery
In the works.
Basic Arduino Sketches
Use this section to help troubleshoot issues with your setup, or to play with individual sensors.
Learned a lot by starting with simple sketches for each sensor or interface: PM, VOC, CO2, RTC, uSD card, TFT screen, battery, etc.
Unfortunately, several of the WIO's example sketches had issues or limitations. And some basic code, like handling SD card insertion / removal or saving a screenshot, can be surprisingly challenging due to a lack of examples, bugs or poor results.
So I developed the following simple Arduino sketches for the WIO Terminal. They can be found on Github (link in the opening). Feel free to leverage into your projects.
Micro-SD Card Properties & Handling (WIO_SD_Card_Basic_Sketch_AQD.ino)
The WIO's SD Card example sketches inexplicably assume that the card is always in, so they hang on insertion / removal. This basic sketch handles such events gracefully, and supports ejection requests.
See file for instructions.
Note: the Seeed_Arduino_FS library does not seem to support file timestamping, and can't list files from the root directory. 2 issues have been opened, no reply yet.
Screenshot to micro-SD Card (WIO_Screenshot_to_SD_Card_Basic_Sketch_AQD.ino)
Displays colored text, captures a color-accurate screenshot via custom 565 to 888 RGB conversion, saves a BMP file to the micro-SD card.
See file for instructions.
Battery SOC gauge (WIO_Battery_Stats_SOC_Gauge_Basic_Sketch_AQD.ino)
Reports battery measurements by the BQ27441 BMC chip used in the WIO Battery Chassis accessory: voltage, current, SOC, etc, and displays a graphical SOC gauge.
Library: https://github.com/sparkfun/SparkFun_BQ27441_Arduino_Library
Note how unreliable the SOC & CapacityLeft values can be when <3.8V. There often is ~30% of actual capacity left but the BMC reports SOC=0. Coulomb counting seems off. Possibly due to missing 1uF capacitor on BQ27441's BAT pin in the schematics, a long unfiltered VBAT PCB trace, and BQ27441 + LiPo pouch calibration likely skipped by Seeed. See details in BQ27441 Datasheet and User's Guide
Dual SEN55 Air Quality Sensors (WIO_DUAL_SEN55_IC0_IC1_Basic_Sketch_AQD.ino)
Works with either 1 or 2 SEN55 sensors. Allows to confirm proper wiring to 5V and I2C0 or I2C1 for each sensor. Continuously reads and displays the PM1,2.5,4,10 / VOC / NOx / Temp / RH values.
Libraries: https://github.com/Sensirion/arduino-i2c-sen5x and https://github.com/Sensirion/arduino-core
If both sensors work properly the screen should look like this:
If a sensor does not respond, a red message will appear:
SCD40 CO2 Sensor (WIO_SCD40_CO2_Basic_Sketch_AQD.ino)
Displays CO2 / T / RH values from the Sensirion SCD40 sensor.
Libraries: https://github.com/Sensirion/arduino-i2c-scd4x and https://github.com/Sensirion/arduino-core
See file for instructions.
If the sensor works properly, the screen should look like this:
Multigas V2 Sensor - not recommended!
This sensor supposedly measures CO, NO2, C2H5OH Ethanol and VOC.
Seeed's example sketch works well for the WIO Terminal. Get it with its library here: https://wiki.seeedstudio.com/Grove-Multichannel-Gas-Sensor-V2/
Connect the board to the I2C1 Grove port (front left port, left of USB-C port). If things work, the screen should look like this (no DHT11 in my case so T=0 and RH=0):
Unfortunately, the readings are evidently bogus. Yeah, right, 280ppm of CO... see how great you'd feel with that ! And over 450ppm of VOCs is totally normal too 🙄
That's because the values displayed are ADC counts, and not ppm. Seeed recognized the issue but didn't change their code...
Build thread: https://www.hackster.io/Salmanfarisvp/air-quality-monitoring-station-with-wio-terminal-6ef85f. Note that it shows inconsistent readings between pictures, and comments report incoherent values.
Tenacious folks developed some improved code. Am planning to test it. When that happens this section will be updated and the sketch uploaded on Github.
PCF8523 RTC (TBD)
In the works.
________________________________________
>>> Part 3 - Results: COMING !
Note: Thomas Salander released a youtube video (Sep'24)
that is a good introduction to some of the emissions from 3D printing.
It also includes a home made Air Quality Monitor and test results from various
filaments and air scrubbers. Not sure if the low PLA & PETG numbers actually reflect their true emissions, or just the limitations of his
sensor selection. Will see in my own testing in the coming Part 3 - Results post above.
Comments
Post a Comment