Go Down

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

arduale

Hallo everybody,
I have a cozir-wx 60 sensor and it works fine in streaming mode. I need to operate in polling, so i will try this library. I Hope it will help.
Thank for your great support!

arduale

#166
Mar 03, 2016, 11:39 am Last Edit: Mar 03, 2016, 12:21 pm by arduale
hi!
it seams that this library does not work with my sensor, which is a cozir wx 60, slightly different from cozir ambient. here is the datasheet of my sensor: cozir wx 60
the pin scheme seems the same as ambient sensor.
i have connected the same way described in this thread: pin2-tx, pin3-rx.
if i use the sketch provided by co2meter, it works fine. but it is in streaming mode, and i need to use it in polling mode, in order to read co2 values each 30 sec.
i tryied cozir.h library version 1.0, and 1.0 and 1.03, but the only thing i was able to get is:

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

i did not find the link at 1.05 version, which should be stable, if you can tell me where to download this, i could try.

just to give you some informations, if i run the sketch of dirtgambit:

Code: [Select]

#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("");
}


and something happen, because after this sketch, the sensor probably is set in polling mode, because my sketch, which works in streamning mode, does not work anymore. i must send the command to put the sensor in streaming mode, to make it work again whit my sketch.

if anyone could help me, it would really be appreciated, since i need this sensor working in polling mode!

thanks,
bye!

EDIT: i use arduino uno and ide 1.6.7

tkvib

Hi,

i want to use the gsm shield2 to send via sms if the co2 value is out of range.
I use a cozir co2 sensor.

Separately all is fine, but I got problems using both libraries together in one sketch.

I'm not so skilled, but i guess it's a problem with the using of the SoftwareSerial.

So i tried to use the Hardwareserial sketch created by robtillaart. But i get weird values, also without any sensor connected to my mega.

Now I use again the libraries from roder. The cozir probe is working fine. But the same problems recure if i put the gsm library into the sketch.

Anybody knows this problem?

Thanks tkvib

Belal1987

Hi all,
Is there a way to calibrate the COZIR CO2 sensor using a reference value? I think the fresh air calibration assumes a 450ppm concentration. is there a way to pass a specific number?

Thanks,
B.

V-king

HiBela
For calibrating Cozir and MinIr sensors, I would recommend using a terminal program (e.g. Hyperterminal or CO2meter.com's GasLab software, which will recognize many sensors bought through CO2meter.com !). This way, you can connect your sensor through a UART to USB-interface (such as your FTDI arduino-mini programmer or even a chinese CP1202). But instead of you having to write the instructions, you simply enter the basic communication codes as stated in GSS' datasheets for your sensor (send line ends with line feeds !).
This will keep your arduino code limited to the minimum required for use.
Since revision AL19 (2013), the communication protocol for Cozir, SprintIR, Misir and MinIR sensors is the same for the three types of sensors. To calibrate the lower span point, you can either choose to use a known gas concentration or to use a fresh air calibration.
The problem is that, due to global warming, fresh air tends to contain more and more CO2 every year, and that actually, on the northern hemisphere, fresh air contains over 400 ppm, depending on the area. In 2016, the CO2-concentration in the southern hemisphere has also exceeded 400 ppm.
But lets's assume that fresh air contains 400 ppm, then you can simply send the command G\r\n to your sensor, which sets the zero point assuming the sensor is in 400 ppm.
If you want it more precise and you know the real value of fresh air, e.g. you want to set the lower span point of, let's say, 450 ppm, then you have to send the command F 410 450\r\n where the first value is your actual reading and the second one the known gas concentration in ppm.

atsaz

Hi,

I have just got my Cozir wide range 5-100% co2 sensor and i have uploaded the code on this forum for it to start co2 measurements. Could some one please help me understand a couple of things. Thanks alot.


1) i believe there are multiple models of cozir for example 20%, 65% , 100% range etc .. How does this library handle these models. Because for example if i am using 100% range co2 sensor than do i have to multiply my output with 100 ? if i am using 20% range sensor than do i have to multiply co2 measurement with 10 ? .. So on .. where and how does this library takes this in to account ?
Right now i have followed the instructions in this forum of commenting and uncommenting

Code: [Select]
//czr.SetOperatingMode(CZR_POLLING);
//czr.SetOperatingMode(CZR_STREAMING);

//czr.CalibrateFreshAir();


to calibrate the sensor for first use. And after that i get the following measurement from my sensor on the serial monitor:


Celcius: 29.20
Farrenheit : 84.56
Co2: 1
Digital Filter: 16

Celcius: 29.20
Farrenheit : 84.56
Co2: 0
Digital Filter: 16

Celcius: 29.20
Farrenheit : 84.56
Co2: 0
Digital Filter: 16


NOTE: CO2 values.

When i blow on it the values go up to 20.

My question: Shouldn't these values be in the range of something like 400-600 ppm . (My environment is normal office with window open for fresh air with one person in the room)...



Thank you people for the love forum.

timothypaul26

I have been using the cozir sensor for a few years now, and your code/libraries have been great. I would like to add it to a TFT touch screen and for the life of me cannot find a way to print the readings to the screen. What is the easiest way to go about tackling such a task? Seems like reading the Serial.print since we are already establishing that would be the easiest, but does that still work when you're not connected to a computer? I am not asking for someone to write the code, because I want to learn how to do this myself, but to point me where I can learn the easiest and most efficient way to perform the task.

robtillaart

@timothypaul26

First learn to work with the TFT of your choice without any sensor or so, just have simple messages like "Hello" and move from there to e.g. the time in millis() since start. What you need to learn is to erase part of the screen before writing a new value to it.
Then connect the Cozir and capture the data from it and send it to the TFT, updating in a similar way.

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

timothypaul26

thanks Rob, I have my tft working, and using a 1307 rtc and I can send all of that data. Maybe I do need to work more, but I cannot figure out what in the cozir.h can be sent. I'm assuming that I need to write varriables and such? Is there an example that you could reccomend? For practice?

robtillaart

(I do not have a COZIR sensor but helped writing the library for it)

Besides the CO2 level you could print the other values the sensor can provide (lux and temp). Besides the actual level you could print the average upto that moment or so. Or peak info of the last 7 days?

Or did I misinterpret your question?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

timothypaul26

I think that my sensor only has temp, humidity and co2. Is it possible to read the pins for those or do I have to read off of the serial, or is this an IIC setup? I'm not sure where to look into how to create the varriables and statements to get the information from the sensor to print to the TFT.

timothypaul26

I guess I should know that it's serial only as it states that in the data sheet... And that is where my trouble is, i'm not sure how to use the serial communication. I'll continue reading and see if that helps me get a bit closer to my goal.

robtillaart

#177
Aug 22, 2017, 11:32 pm Last Edit: Aug 22, 2017, 11:32 pm by robtillaart
The code in post #166 above might help you to get all info out of the sensor...
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

timothypaul26

#178
Aug 23, 2017, 01:14 pm Last Edit: Aug 23, 2017, 01:25 pm by timothypaul26
I had that code from the example. Every time I would try to myGLCD.print(c(), CENTER, 0); I would get an error. After reading through the UTFT manual a few times I realized that it told you how to print a float... myGLCD.printNumF(c(), CENTER, 0); did the trick. Once I got that figured out things went well from there. I was having a funny issue where my rtc and my co2/temp/humidity would only update for 5 seconds and freeze. Only thing I could think of is that there was some sort of serial conflict? I changed the rtc speed to 4k, and it seems to have fixed the issue, but I'm not sure that it's the best fix, might be more of a band-aid? Time will tell I guess. I really do appreciate your patients with me and the work that you and DirtGambit have done on this library, also thanks to Henning for his work. My hat is off to all of you.

Sklindt

Hello everyone, i have read the entire thread now, can i still can't get my COZIR av-2000 sensor to work.

First off i have the sensor without temperature and humidity so only the CO2 sensor.

have today 27/11-2017 downloaded the newest versions of the cozir.h
i am trying to get this to work on an ATMega2560 and using the following code


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

SoftwareSerial nss(11,12);
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(1000);
 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("");
}


and i am getting the following output:

Celcius : 0.20
Fahrenheit : 32.36
CO2 : 2
Digital Filter : 2

Hope somone can help

Ps nothing happens when i blow on it..

Go Up