Temp, Humidity CO2 sensor and library.

aaah thanks! I am testing on pins 11-12. works also perfect :slight_smile:

Hello All. New to this forum and arduino so im at a loss for what im doing wrong.

I've used the new code/re calibration last listed to yield positive CO2 readings, yet my humidity and temperature readings are all 0. Is this an error within the sensor or my doing?

Hi everybody , Recently I've got the cozir wide range

I just read the datasheet and the process to do the calibration part is the same I've used the library provided by
DirtGambit and robtillaart ,my doubt is about this process we need to calibrate the sensor each time I turn on the arduino device or I do need to recalibrate the sensor ?

Thanks for your support.

Hector

hector915:
I've used the library provided by
DirtGambit and robtillaart

Where are these libraries available? They do not seem to be attached to this thread. :frowning:

Hi, I have the same issue as roder have.. I can not find the library cozir.h attached with the post

robtillaart:
yes.
the lib is attached on the first post (it includes the .h file)

Dear robtillaart,
I can not find the cozir.h file attached with the first post. Could you please guide me how can I download this file.

Regards,
Abbas

I have to search for the latest version I have,
"I'll be back"

Attached my latest cozir 0.1.03 lib version. There is a sketch included which compiles.
Disclaimer: I still do not have such sensor so I cannot test it in real life ...

@DirtGambit
Is it OK to include this library in my Github repo?

cozir0.1.03.zip (93.6 KB)

Thanks a lot Rob for the file.
I tried to run it but on monitor nothing is displaying. I am using 1.0.5 version. May be its compatibility issue ?

Dear Rob Tillart,
I tried to run this code http://www.co2meters.com/Documentation/AppNotes/AN128-%20Cozir_Arduino.pdf -

I tried to send the command " z\r\n" to get the co2 values but it didn't work for me so i removed the while condition and it started displaying co2 values

//while(buffer[ind-1] != 0x0A)
{
if(mySerial.available())
{
buffer[ind] = mySerial.read();
ind++;
}
//}

Now when I included the cozir.h file and tried to run this code (posted by @DirtGambit) nothing is displaying on serial monitor. I tried this arduino 1.0.3 as well.

#include <SoftwareSerial.h>
#include "cozir.h"

SoftwareSerial nss(3,2);
COZIR czr(nss);

void setup()
{
Serial.begin(9600);
delay(3000);
//czr.SetOperatingMode(CZR_POLLING);
//czr.SetOperatingMode(CZR_STREAMING);
}

void loop()
{
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);
}

I can't say as I do not have a sensor to verify problems, sorry :frowning:
(reaction on post - 2 :slight_smile:

Try this echo script

#include <SoftwareSerial.h>

SoftwareSerial nss(3,2);

void setup()
{
  Serial.begin(9600); 
  nss.begin(9600);
  delay(3000);
}

void loop()
{
  if (nss.available()) 
  {
    Serial.write(nss.read());
  }
}

does it show anything?

lemme try i ll let u know in a while

yes it displayed this

ÿÿ

I have connected sensor RX -> with Arduino pin#3
and sensor TX _> with pin #2

I added Serial.println("test");

it displayed this text on monitor...
strangely I have to re insert the wire connecting the sensor's RX with microcontroller pin#3 in order to display the text on the serial monitor.

ajaved200:
yes it displayed this

ÿÿ

I have connected sensor RX -> with Arduino pin#3
and sensor TX _> with pin #2

that means you have made a hard wired connection between the hardware Serial and the software serial.
The if statement in the code should do the copying but only if there is data available on the SW serial.
the yy indicates there is nothing to read() (In fact it is ASCII char 255 or -1)

#include <SoftwareSerial.h>

SoftwareSerial nss(3,2);

void setup()
{
  Serial.begin(9600); 
  nss.begin(9600);
  delay(3000);
  nss.println("z")
}

void loop()
{
  if (nss.available() > 0) 
  {
    Serial.write(nss.read());
  }
}

slightly different, added a "z" to tickle the sensor, and an explicit >0 test
can you try?

I tried this as well.. still showing "ÿ"

robtillaart:

#include <SoftwareSerial.h>

SoftwareSerial nss(3,2);

void setup()
{
  Serial.begin(9600);
  nss.begin(9600);
  delay(3000);
  nss.println("z")
}

void loop()
{
  if (nss.available() > 0)
  {
    Serial.write(nss.read());
  }
}




slightly different, added a "z" to tickle the sensor, and an explicit >0 test 
can you try?

Which version of the IDE are you using?
Which board? UNO/MEGA?
The COZIR is connected to pin 2 and 3 I assumed....Right?

I am using audrino UNO and yess cozir is connected with pin 2 and pin 3