Go Down

Topic: Temp, Humidity CO2 sensor and library. (Read 75510 times) previous topic - next topic


Hey everyone.  First time poster here. 

Currently running the Github library and sample sketch posted by DirtGambit (thanks much).  The COZIR is functioning when I run a sketch shell on my Mega 2560 and hook up the COZIR TX and RX to the hardware serial on the Mega.  The humidity, temp, and CO2 readings all display on the output.  However, when I run the sample sketch, the output is as follows:

Fahrenheit : 32.00
Humidity : 0.00
CO2 : 0
Digital Filter : 0

When I adjust the Digital Filter value, all values change directly with the digital filter value.  I'm stumped.  Please help.


@Dew321, I'm not entirely sure if I understand entirely what you want, but I created a sketch for logging to SD card where from 15 measurements only the highest and lowest are saved and an average is calculated for every added measurement, until the measurements for that array are saved. If I'm correct, you want to see the velocity at which change happens, so you only have to divide by time after that. The snippet:

Code: [Select]
  float currentCO2 = (float)czr.CO2();
  if ((currentCO2 < CO2[0]) || (pollsInLog == 1)){// save CO2 if it's the lowest value in this interval.
    CO2[0] = currentCO2;
  CO2[1] = (CO2[1] * (pollsInLog - 1)/pollsInLog) + (currentCO2 / pollsInLog);// calculate and save average
  if (currentCO2 > CO2[2]){// save CO2 if it's the highest value in this interval.
    CO2[2] = currentCO2;

The complete sketch is over here on GitHub.

If others are looking for inspiration for logging measurements to an SD card: check it out :-)


Feb 26, 2015, 09:46 am Last Edit: Feb 26, 2015, 11:09 am by kslstn
@Simas, I had that issue too. After setting the sensor to poll mode and starting the calibration manually, everything worked fine with Rob's library.

You can find the sketches to do that here on the forum and in my repo (the SetToPolling and Calibrate sketches).

Edit: Also make sure the sensor is connected to pin 2 and 3. If, after trying the above, you still get the 0 readings, try switching the wires, there was some confusing about Tx and Rx. And give it a bit of time. After it's connected to power, the sensor needs about 5 seconds before it measures correctly.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131