COSIO AIR QUALITY SENSOR (WITH WIFI & MQTT)

by erikfunke in Circuits > Sensors

1405 Views, 5 Favorites, 0 Comments

COSIO AIR QUALITY SENSOR (WITH WIFI & MQTT)

banner.jpg
dash full.PNG
settings.png

ABOUT COSIO

This guide will teach you how to build your own CO₂ sensor for air quality monitoring. The sensor indicates bad air quality and shows when ventialtion is recommended, thus lowering the risk of infections carried by aerosols (like COVID-19). Elevated CO₂ concentrations (> 1500 ppm) also have a negative impact on concentration and can cause sleepiness and other unwanted effects.


This sensor is monitoring the current CO₂ concentration in ppm (particles per million) and indicates the level with RGB LEDs and an 0,96" OLED display in the front. The inbuild web interface allows remote CO₂ monitoring over the network and provides a configuration interface for the sensor. The sensor has a measuring range of 0 - 5000 ppm and a tolerance of ± 50 ppm, which is sufficient enough for indicating bad air quality.

Check out the project's website: https://cosio.christmann.info/ (In German)

Supplies

Electronics and Components:

  • 1x Winsen MH-Z19c NDIR CO₂ sensor module (with socket and cable [not pin header version])
  • 1x Wemos D1 mini (ESP8266)
  • 1x 0,96" Arduino OLED Display SSD1306 128x64 I2C/IIC
  • 13x WS2812b on a 144/m stripe
  • 1x 3D Printer & printed case components (case_complete.stl)
  • 4x M2x5 Screws (most screw types work here. I used )

Tools:

  • Glue (superglue recommended)
  • Small flathead screwdriver
  • Exacto or cutter knife
  • Soldering iron and solder
  • Side cutter
  • Wire stripper

Software:

  • Slicer for the 3D Printer
  • Flashing method for Wemos D1 mini (select one)
    • If you want to tinker with the project's code we recommend VS code with PlatformioIDE
    • If you want to install the ready-to-use software, download the COSIO Updater (Windows only)

Prepare the Case

print2.jpg

If you don't have a 3D printer you can also use online services that print the case for you. All case components are already layed out in the case/case_complete.stl

Recommended print settings

  • 0,16 or 0,12 mm layer height
  • Raft
  • Supports enabled

When the print is finished, carefully remove the support material from the case.

We had some troubles regarding tolerances in some places, because we used two different printers (Ultimaker 3 and Ender 3 Pro). One place that can cause problems are the distance-pins for the display on the top cover. To check if everything is okay you can hold the display to the cover and check the distance to the front cutout. Remove some material from the distance-pins with the exacto knife or side cutter if necessary.

When the support material is removed and the tolerances are fine you can proceed with glueing on the top-cover to the main body. Make sure that the "CO₂" in the top-cover faces towards the upper air slots in the main body.

Cutting the MH-Z19c Cable

WhatsApp Image 2021-03-02 at 10.29.26.jpeg

The next step would be to cut the provided cable as shown. All cable ends need to be stripped (around 1 - 2 mm) and tinned with the soldering iron.

Inserting Display and Sensor

Untitled Sketch 2_Steckplatine.png
WhatsApp Image 2021-02-26 at 11.25.45(1).jpeg

Following cables need to be soldered to the display pin-header:

  • 5 cm red cable -> VCC
  • 5 cm black cable -> GND
  • 8 cm green cable -> SDA
  • 8 cm blue cable -> SCL

Then place the sensor with the shortened cable inside the middle piece of the case print. Apply some glue if the sensor is too loose inside the carrier. When the sensor is fixed, the display cables can be routed through the small opening beneath the pinheader recess and the display glued into position.

Add LED Stripe

WhatsApp Image 2021-02-27 at 09.32.57.jpeg
WhatsApp Image 2021-02-26 at 11.25.44(6).jpeg
WhatsApp Image 2021-02-26 at 11.25.44(8).jpeg
WhatsApp Image 2021-02-26 at 11.25.44(5).jpeg

Bend the thirteen LEDs carefully like in the picture shown above. You can use the 5V and GND pins on the stripe for connecting the components power cables, because the stripe also doubles as the 5V power bus for the display and sensor.

Connect the yellow cable to the DIN (Digital In) pin of the stripe. The leftover red and black cables are for the stripe's power supply from the Wemos D1 mini.

Insert Carrier and Seal Case

WhatsApp Image 2021-02-26 at 11.25.44.jpeg
Untitled Sketch 2_Steckplatine.png

First insert the carrier inside the case body. When the carrier is not completely fixed inside the main body you can apply some superglue.

The Wemos D1 mini needs to be superglued into the backlid cutout. Make sure to get the orientation right (the micro USB port faces outwards).

When dried, connect all cables to the corresponding pins like in the schematic above.

Close the backlid, insert the m2 screws and the hardware is ready-to-go.

Flash the Wemos D1 Mini

You can either flash the Wemos D1 mini with PlatformIO (we used the VS code extension), or you can use COSIO Updater (Windows only).

Download COSIO Updater from GitHub

COSIO Updater requires internet connection to work. It downloads the esptool.exe, firmware.bin and spiffs.bin from the GIT repository.

The code and binary images can be found on GitHub.