Hello and sorry I havent replied to any posts, i havent touched an arduino for a long time, so tonight i took my COZIR sensor and arduino and had a play around, i indeed got some of the problems that many of the users have been having, i was able to reproduce the errors and quickly found out that the sensor need calibrated, i will include the library to this post that i used tonight and also put some functions in and comment them out so in Setup() you can do calibration or change digital filter.
Here is the code i used for my main sketch
#include <SoftwareSerial.h>
#include "cozir.h"
SoftwareSerial nss(2,3);
COZIR czr(nss);
void setup()
{
Serial.begin(9600);
delay(5000);
//czr.SetOperatingMode(CZR_POLLING);
//czr.SetOperatingMode(CZR_STREAMING);
//czr.CalibrateFreshAir();
// czr.SetDigiFilter(64);
}
void loop()
{
delay(4000);
float t = czr.Celsius();
float f = czr.Fahrenheit();
float h = czr.Humidity();
int c = czr.CO2();
int digi = czr.GetDigiFilter();
Serial.print("Celcius : ");Serial.println(t);
Serial.print("Fahrenheit : ");Serial.println(f);
Serial.print("Humidity : ");Serial.println(h);
Serial.print("CO2 : ");Serial.println(c);
Serial.print("Digital Filter : ");Serial.println(digi);
Serial.println("");
}
Some of the problems people have been having is due to not calibrating the sensor at first use
Here is a step by step
uncomment czr.SetOperatingMode(CZR_POLLING);
Upload Sketch
comment czr.SetOperatingMode(CZR_POLLING);
and uncomment czr.CalibrateFreshAir();
Upload Sketch
comment czr.CalibrateFreshAir();
Upload sketch
and if you want to change digital filter do the same, as the settings are kept on the sensor you never need to do these again unless you want to. I have found if i uncomment them all the sensor plays up and gives bad values until i comment out and upload the sketch again, i dont know why this is, it would have been such a better sensor if it were polling by default.
I have attached the lib i used tonight to this post
Regards
DirtGambit
cozir.zip (2.99 KB)