14 OCT 2020
Below is a development notebook for constructing a DIY CO2 monitor.
Click here to jump to the latest remote CO2 node + gateway setup.
Needs 5V power minimum (actually, looks like it's best run at 6-9V); meanwhile, Logic levels for the UART are at 3.3V.
Useful info on logic levels / etc from the datasheet:
|Table 1 from the K30 datasheet.|
Meanwhile, though -- good advice on connecting to signals that run at higher voltage from JeeLab, here. Punchline -- can add a 1K resistor in series with signal as protection.
|Figure 2 from the K30 datasheet.|
Datasheet says: should avoid connecting analog and digital ground pins externally in order to avoid ground loops
This suggests using 6 to 9V input. (Might be good to upgrade the spec on the MCP1702 voltage reg so we can take > 6V input on the Mothbot). Needs to be able to provide 500mA. So: direct from battery power is likely best.
Schematic of the Feather M0 Lora.
Datasheet for the AP2112-3.3 voltage regulator used on the feather is here.
From the AP2112K datasheet -- 6V max allowed on Feather:
Note: Logic levels for the UART are at 3.3V.
|Blowing on the sensor and then letting it recover.|
Guide here for hookup to Arduino UNO.
Example code here.
Code for remote and gateway is here.
|Mothbot remote node connected to K30 CO2 sensor.|
|Closeup of Mothbot.|
|Closeup of K30 CO2 sensor.|
|Heltec Wifi-LoRa gateway|
|Graphing on FarmOS|
Would be nice to develop useful ways of connecting to some standard hardware (e.g. Feathers, etc).
Article on measuring CO2 in greenhouses:
Until recently, the vast majority of growers in the U.S. did not measure CO2 or use it to enrich their greenhouses. However, during the winter, CO2 levels can quickly become limiting in unventilated greenhouses full of plants on cold and sunny days. Over the past 10 years, we have also seen greenhouse growers seal up their greenhouses in an effort to control their heating bills during the winter. Other growers, especially in northern latitudes, have invested in supplemental lighting because of the numerous benefits, from improved quality and yields to reduced production time. An apparent result of tightly sealing the greenhouse is increased humidity and condensation. A not-so-apparent result of reducing air infiltration is a reduction of CO2 levels within the greenhouse below ambient levels found outdoors.
Oct 9 2020:
Maybe a good configuraiton is to have the sensor powered via a 7.4V rechargeable lith-ion, while the micro attached has its separate battery voltage?
oct 13 2020:
Recreating the prototype but using a Feather M0 instead ...
now we want to use Hardware Serial instead of Software Serial ...
We noticed a Twitter thread by Linsey Marr on Oct 8 2020 that references using a CO2 monitor to assess activity in a space re: COVID-19; they use the HOBO CO2 monitor pictured in Fig C below.
|Fig C. HOBO CO2 Logger used to assess activity level / air turnover in a college gym.|
Note: some power options (if plugging into the wall): use a 9V power wall wart, and drop down voltage to 5V; or use a 5V wall wart (more commong), and boost up to 9V.
If the latter, probably need to check on current (mA) requirements of the K30.
Offhand, seems like drop down is easier; boosting to 6V / 9V is a bit odd.
|Fig A2. Feather M0 connected to a K30 sensor.|
Feather firmware is here.
Wiring for test:
|Fig A. UART connection on the K30. When connecting to the Feather, connect TXD (K30) to RX0 (Feather) and RXD (K30) to TX1 (Feather).|
|Fig B. Data from Feather, plotted in Arduino plotter utility. Data shows breathing on sensor at a particular time and and watching decay. Time interval unit is 2 seconds.|
UPDATE: looks like the K30 can be powered by up to 14V. So a 12V boost, or power supply, could be an option.
Started by closing door, sitting next to sensor. At 150 time mark, opened door and left room. Then At 250 time mark, reentered room and closed door. At 280 time mark, started a conversation.
'room_test_later.png' -- had a phone call
'room_test_later_2.png' -- left room for a bit with door open, then emilie came back and worked with the door open.
Nice discussion here, thanks to Laura P.
Specifically mentions NDIR.
For sale on Banggood. Another option
Mentions infrared. This is the one that Craig used / that I have in my possession now.
For sale on Banggood for $20.
Goal as of 13 OCT 2020: get this up and running in parallel to the K30 and see how they compare with the 'ambient' test.
Nice article on testing out the Z19 on a Raspberry Pi.
Update 15 OCT 2020: Just found a fairly official-looking Arduino library for the MH-Z19 here by WifWaf.
In that repo they have some nice notes about calibration. The Z19 allows us to turn autocalibration off (which seems useful -- otherwise it is using the lowest reading in a 24 hour period as '400 ppm'). Would be good to experiment with this.
Also, here's another library for the MH-19 -- looks a bit older. Going to try the WifWaf one above for now.
Note that the WifWaf github MH-Z19 lib is already in the Arduino online Lib repo, can just install via Library Manager in IDE.
Update 15 OCT 2020: was able to get the WifWaf lib running on the MothbotV3. Radiohead + the library ends up generating a 'low memory' warning. This is fine; we'll likely end up using the Feather; also, we can pare down the full library to just generate raw values, likely.
Add this to Boards Manager:
Select 'Heltec Wifi Lora (v2)'
Add this to Boards Manager:
Oct 14 2020
|Posting CO2 PPM data from a K30 to FarmOS, measuring overnight from 14 OCT to 15 OCT 2020.|
This article mentions a technique, using their library.
(TODO: set up using chappy-server as a model?)
As Of 15 OCT 2020 10:42 AM -- K30 is autocalibrating, Z19 is not.
Ah -- looks like the K30 also can give temp, and RH! Cf the example here.
How to read the K30 via I2c app note here.
Ahhh here is a library for multiple params by CO2meter for the K30 -- boom.
need to modify their library so that it doesn't rely on SoftwareSerial (necessarily)
-- but first check whether we can even disable autocalibration?
Reading the K30 datasheet
Useful CO2meter guide to K30 ABC here.
-- looks like it can be disabled in EEPROM via I2C, at least ...
Nice reference on connecting a Teensy to a K30 here
Reference to a key application note re: K-Series eeprom setup here
-- need to email them, UART command lib is missing ...
15 OCT 14:00 -- Interesting link to the Yoctopuce V2, which uses a 'better sensor' than the K30, they claim ...
The K30-based yoctopuce-c02 is here
More about the yp-co2-v2 is here
Yp-co2 (K30) user's guide
this is the serious guide, here
simple i2c example here
The yocto uses the SCD30 -- listed for $54 on digikey
Here's the SCD30 datasheet
Arduino library here
And on github
annnnd the Sparkfun library has a 'disable calibration' settting here
K30 seems outdated; won't trust it until we figure out how to turn off the autocalibration ... waiting to hear back from CO2 meter
MH-Z19 is also a bit older; can at least control the autocal ...
The calibration assumption with these meters seems to be that they use the lowest ppm value over some period and consider it to be 400 ppm -- assumes that all spaces end up getting 'fresh air' at some point in that period. For the K30, this is et to 7 days. Not sure for the other sensors.
Also: readings for NDIR are temp, humidity, and pressure dependent. My sense is that all the sensors measure these variables and compensate; the SCD30 also allows for feeding it the current ambient pressure and using it for calibration.
My current thought is the SCD30 would be a good one to get, along with an ambient pressure sensor.
OCT 16 2020
Example of an electrochemical CO2 sensor.
Really nice collection of references from co2meter.com
OCT 21 2020
Looks like the SCD30 can run off 3.3V, requiring max current of 80mA -- that's well within range of Feather LDO I believe!
SCD30 datasheet has the following table:
|Electrical characeristics of SCD30.|
Listing for th SCD30 on Amazon, here.
And on Digikey, here.
Note: should likely pair with a precision pressure sensor like the BME280 or better.
OCT 22 2020
CO2Meter note on calibration here
Calibration for the SCD30 sensor document here p. 7 / 10.
|Calibration of the SCD30, via this document|
Upshot: seems as though with the ABC algorithm, sensor needs to see at least 1 hour of fresh air daily.
With the 'manual' mode, can run it for 2 minutes outdoors and press button saying 'calibrate' and set it to '400ppm'.
Seems like this latter mode would work best.
|Assembly of SCD30 PCB, via this doc|
OCT 23 2020
|Effect of 'forced recalibration' (FRC) of SCD30 as described in the SCD30 ield calibration guide|
|Effect of automatic self-calibration (ASC) algorithm used in SCD30 as described in the SCD30 ield calibration guide.|
OCT 24 2020
Might consider adding a high-precision pressure sensor to any SCD30 breakout board; the SCD30 can compensate for pressure if sent values directly. E.g. the BMP388 breakout from Adafruit.