Calibrating CO2 cozier sensor with proper Vernier CO2 sensor

Hello anyone,

I am using CO2 gas sensor(Vernier) as my "correct" base sensor, and I am trying to calibrate four of my CO2 Cozir sensors. My calibration process goes, I have placed both sensors (1 cozir and 1 Vernier sensor) in a closed compartment (zip bag) and breathed through it using a straw. I then close the straw and the zip bag (compartment) and I wait 4-5 minutes for the readings to settle. Once I have 1 reading from the Vernier and 1 reading from the CO2 Cozir sensor, I note down the data points. I have done this a lot where I have multiple data points resulting to an equation of calibration for my cozier sensor.
When I run another test separate from the this experiment, I note down the Cozir CO2 data and plug it into the calibration equation derived from the data above. The answer of actual CO2 readings comes close or very close to what the Vernier sensor is reading. This is where I need some exterior help. I am trying to figure out a way to implement this equation into my Arduino code, so that my readings can be automatically calculated using the equation of calibration and the readings that come out are the correct or near the correct CO2 readings.

We can't see your calibration results. Basically find the difference between the values from the two sensors. Is the difference always pretty close to the same value? If so, just apply that difference to the Cozier readings.

Q1. I assume you actually measure the CozIR signal with the arduino?
If so, you can share the code to have more help.

Q2. I assume the relation is linear? Like: Y = aX + b?

Essentially, I understand you want to acquire the data with the arduino and then recalculate the value using the calibration curve coefficient.
With your Arduino code, this should be easy to have help to implement it.

C.

Put the data in a spread sheet and draw a graph. The add a trend line . When you are happy with the fit you can see the terms used in the equation of that line .
Use that equation !

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

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

void setup()
{
Serial.begin(9600);
delay(2000);
//czr.SetOperatingMode(CZR_POLLING);
//czr.SetOperatingMode(CZR_STREAMING);
//czr.CalibrateFreshAir();
// czr.SetDigiFilter(64);
}

void loop()
{
delay(2000);
int c = czr.CO2();
int digi = czr.GetDigiFilter();

Serial.print("CO2 : ");Serial.println(c);
//Serial.print("Digital Filter : ");Serial.println(digi);
Serial.println( ' ');
}

That is the code I am using to get the COZIR CO2 sensor readings. And this is the equation of calibration for one of the sensors [ y= 4x + 672 ]. How could I put this into my code and get calibrated readings?

thank you v much!

Hi,

this code should do what you want. Not the best code but basic and straigth forward. I haven't test it.

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

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

const int Slope = 4;
const int Offset = 627;

void setup() {
	Serial.begin(9600);
	delay(2000);
	//czr.SetOperatingMode(CZR_POLLING);
	//czr.SetOperatingMode(CZR_STREAMING);
	//czr.CalibrateFreshAir();
	// czr.SetDigiFilter(64);
}

void loop(){
	delay(2000);
	int c = czr.CO2();
	int digi = czr.GetDigiFilter();
	int CO2_cal = c * Slope + Offset  // The calibration curve here.  
	//float CO2_cal = c * Slope + Offset     // Could be a float for some more precision
	Serial.print("CO2 : ");
	Serial.println(c);
	Serial.print("Slope and Offset used: ");
	Serial.print(Slope);
	Serial.print("and ");
	Serial.println(Offset);
	Serial.print("CO2 calibrated : ");
	Serial.println(CO2_cal);
	
	// This part I don't know what it is :)
	//Serial.print("Digital Filter : "); Serial.println(digi);
	Serial.println( ' ');
}

I would used float instead of Integer but this is just because I like 400.1 ppm of CO2 instead of 400! If you also prefer this, you can uncomment the line starting with a float.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.