Problem with Gravity analog CO2 sensor

The sensor starts up seemingly properly and for a short time records about 400 ppm. Then it goes to a high voltage and returns large fluctuations. Does not respond to increases or decreases in CO2. Have checked with a more expensive sensor.

Code used to monitor is provided below. I have commented out some lines so I coudl use the serial plotter. Image of plot after startup is attached, no difference after some hours. Note sensor was placed in a glass jar to buffer against large CO2 fluctuations. I have had some experience with CO2 monitoring.
There is no other sensor attached to the Arduino.
/***************************************************

  • Infrared CO2 Sensor0-5000ppm

  • GNU Lesser General Public License.
  • See http://www.gnu.org/licenses/ for details.
  • All above must be included in any redistribution
  • ****************************************************/
    int sensorIn = A0;

void setup(){
Serial.begin(9600);
// Set the default voltage of the reference voltage
analogReference(DEFAULT);
}

void loop(){
//Read voltage
int sensorValue = analogRead(sensorIn);

// The analog signal is converted to a voltage
float voltage = sensorValue*(5000/1024.0);
if(voltage == 0)
{
Serial.println(“Fault”);
}
else if(voltage < 400)
{
Serial.println(“preheating”);
}
else
{
int voltage_diference=voltage-400;
float concentration=voltage_diference*50.0/16.0;
// Print Voltage
//Serial.print(“voltage:”);
//Serial.print(voltage);
//Serial.println(“mv”);
//Print CO2 concentration
Serial.println(concentration);
//Serial.println(“ppm”);
}
delay(1000);
}

Hey Steve,

To get a better idea of the issue can you please dramatically reduce the refresh time (maybe down to 2 rather than 1000) so that we can see just how jumpy the signal actually is and whether we need to modify the script with some kind of averaging setup so it takes 500 measurements per second, I’d be happy to help you write a script for that here if you’d like.

Have a great day and a Happy New Year!

Bryce
Core Electronics | Support