Miniature CO2 Monitor With Alarm

by rabbitcreek in Circuits > Microcontrollers

7044 Views, 117 Favorites, 0 Comments

Miniature CO2 Monitor With Alarm

IMG_1200.jpeg
IMG_1214.jpeg
IMG_1210.jpeg

I have recently been spending a lot of time indoors working with human breathing physiology. Prior Instructables have used O2 and CO2 sensors and I had tried switching to a new one from Sensirion SCD 41. It is very tiny and uses a new type of sensing for the level of CO2 ...acoustic something or other. The previous version: SCD 30 works really fast and has a wide detection range...it is based on laser CO2 light absorption. When experimenting with the small model I found its speed too slow for my use and the range limiting so I was looking for something else to build with them. I have put together a short instructable on how to built a elegant very tiny CO2 sampler for home or school use. It uses the raw SCD 41 that is usually surface mounted or you can obtain it already mounted on a trial board but it is so much bulkier and not as much fun to put together. The other requirement was that it be unobtrusive and have a tiny buzzer to alert the occupants that the boring stream of data had gone over some limit--much like a fire alarm. Naturally it would have to have an App to graph your data stream and keep it locally on your phone.

Gather Your Materials

SCD40-SCD41-CO2-temperature-and-humidity-sensor-module-CO2-sensor-I2C-output-SCD40-D-R2-SCD41.jpg

There are only 3 components to this project. Total cost about $50.

1. 3v buzzer CMI-1295IC-0385T -- digikey $1

2. SCD 41 -- Digikey $42

3. TTGO T-Display ESP32 CP2104 WiFi bluetooth Module 1.14 Inch LCD Development Board $11

The SCD41 also comes as a development board from a variety of sources--some have STEMMA QT connectors for easy hookup. These boards would make the whole unit considerably bigger but the all the rest of the components would be the same.

3D Print Your Parts

wallWartBody.jpg
wallWartFront.jpg

There are only 3 parts to this tiny instrument. All parts are printed in PLA with no support.

Wire It

IMG_0781.jpeg
IMG_0780.jpeg
IMG_0960.jpeg
Untitled Sketch 2_bb.jpg

The only difficult part is wiring up the tiny SCD 41, but that's what makes it fun. Use as small a gauge of wire that you have available. Clamp the unit to stabilize it. Make sure you have the wiring diagram at hand and orient the unit to correctly wire each unit. One of the pads is trimmed to orient the unit. The five connections include the VDD, GND, SDA and SCL (all on the lower tier) and DDH across from the VDD. This is connected to power so you can either connect across or connect it to power when you splice the wires to the TTGO. Use plenty of flux on the pads and place a tiny ball of solder on each one prior to attaching the wires. Place a tiny ball of solder on the ends of each wire to enable an easy connection with minimal heat. Solder the wires to the appropriate pads. Carefully hot glue the wires into position to prevent tearing of the small connections. The I2c connections are made through GPIO 21 and 22. Power and Ground and provided through the 3 Volt connector on the board. The buzzer is connected to GPIO 13 and to GND. The power to the board is connected from the USB back connector to the 5 Volt connector and GND on the board. A small color LED is spliced into the power connection to the sensor.

Build It

IMG_0963.jpeg
IMG_0947.jpeg
IMG_0956.jpeg
IMG_0948.jpeg
IMG_0949.jpeg
IMG_0954.jpeg

The power for this unit comes from a 3D printed USB connection unit located on its back. I wanted some power option that was minimal in form so that it could easily slipped into any power block or a USB port on the side of a computer. The USB printed unit has two thin indents that accommodate two small strips of copper foil. Carefully trim the copper to fit the two indents and superglue them into position. The wires that connect power and ground go through the back of the unit. Use plenty of flux to make soldering easy to the copper strips. Connect the wires at the base of the copper strip so that the soldering blob does not extend onto the open areas where the USB connects. Superglue the USB connector onto the back of the unit after you run the wires through the holes. Place the TTGO unit into included slots in the holder. The CO2 sensor unit and tiny buzzer nest with the wires in the upper chamber of the unit. The LED sits near the openings for air movement. Make sure that the USB-C connection for the TTGO is available for programming through the open slot. Check to see if the unit functions correctly and finally superglue the face plate into position.

Program It

IMG_0965.jpeg
IMG_0969.jpeg

Most of the program is taken from the Sensirion App programming for the SCD-30 unit but switched for the SCD-41. It uses a couple custom fonts included in the program. The program sets up a bluetooth link to the Sensirion App for the iPhone that permits downloading of Humidity, Temperature and CO2 level to an easily connected App. The App also saves the data stream and timestamps it for emailing to a database program of your choice. The first function, displayCo2(), sets up the screen and the fonts for the CO2 printout and the device string. Depending on the level of CO2 it changes the color of the projected font. The setup() function starts the wire transmission for the I2C link to the SCD-41 and the digitalWrite function for the buzzer. The loop() function polls the sensor for data, broadcasts it to the bluetooth link, displays it on the TFT sceen and if the level of CO2 is greater than 1600 sets the digitalWrite output to high to activate the buzzer through GPIO Pin 13. The time interval for the sampling can be set in the software.

Using It

CO2Monitor
IMG_1213.jpeg
IMG_0980.jpeg

The unit is easy to use. Just plug it in to any available USB wall wart or empty computer USB port and it will begin monitoring your room for excess CO2. To collect data on your humidity, Temp or CO2 level just open the Sensirion App on your phone and it will immediately connect and save data points in your phones memory. No connection to the web to worry about. The data will be saved for as long as you want on the phone and can be sent by txt or email wherever. The file has a strange format that must be changed to .CSV to make it functional on an Apple computer. The App itself can easily graph the data for you. The CO2 level font changes color depending on how high it goes and the alarm level is set for 1600 but this can easily be changed in the software.