I want to add Co2 to a grow room and control the Co2 unit with the arduino but my sensor keep giving me wrong results, mostly -295ppm.
Is there anything I can do to change that?
This sketch is only for the Sensor, in the full sketch I also have others sensors, lcd and data logging shield but the problems with the K30 I also have with this simple sketch
This is my first Arduino project and I have zero coding experience, so I don't understand what the code you gave me is doing but I ran it and still have the same issue, here the result from the serial:
This will not solve whatever is causing the negative read (could be connections), however if a negative read is made for co2, it will read again. (checks twice).
include "kSeries.h"
#include <Wire.h>
kSeries K_30(8, 9);
unsigned long previousMillis = 0;
const long interval = 7000;
void setup()
{
Serial.begin(9600);
}
void loop()
{
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
double co2 = K_30.getCO2('p');
(co2 < 0) ? co2 = K_30.getCO2('p') : co2; //re-read if negative
(co2 < 0) ? co2 = K_30.getCO2('p') : co2; //re-read if negative
Serial.println(co2);
}
}
EDIT: There would need to be 3 negative reads in a row before co2 would end up negative.
Wow, thank you very much.
So it seems the problem should be the 5V, at the moment the the Sensor is in use and will log data for a week, after that i will check if i can solve the problem with the suggestions from the Application note.
Hi, I actually have the same problem as you, always a negative value. I tried to do as Application Note AN144: K30 Sensor Lockups with Arduino recommend but still the same issue. Drunken1337: do you have any progress on the issue?