use corrected values
This commit is contained in:
parent
a794de5eb8
commit
5f9ccca0cf
3 changed files with 19 additions and 21 deletions
|
@ -25,7 +25,7 @@ v1.0 - First release
|
||||||
#define RLOAD 10.0
|
#define RLOAD 10.0
|
||||||
/// Calibration resistance at atmospheric CO2 level
|
/// Calibration resistance at atmospheric CO2 level
|
||||||
// #define RZERO 76.63
|
// #define RZERO 76.63
|
||||||
#define RZERO 4000
|
#define RZERO 840
|
||||||
/// Parameters for calculating ppm of CO2 from sensor resistance
|
/// Parameters for calculating ppm of CO2 from sensor resistance
|
||||||
#define PARA 116.6020682
|
#define PARA 116.6020682
|
||||||
#define PARB 2.769034857
|
#define PARB 2.769034857
|
||||||
|
|
|
@ -12,3 +12,5 @@
|
||||||
platform = atmelavr
|
platform = atmelavr
|
||||||
board = megaatmega2560
|
board = megaatmega2560
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
lib_deps =
|
||||||
|
adafruit/Adafruit BME280 Library @ ^2.1.2
|
34
src/main.cpp
34
src/main.cpp
|
@ -35,15 +35,14 @@ void setup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void printValues();
|
void printValues(float ppm, float temp, float humidity);
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
if (count >= maxCount || count < 0) {
|
if (count >= maxCount || count < 0) {
|
||||||
ppm = co2_sensor.getPPM();
|
float temp = bme.readTemperature();
|
||||||
Serial.print ("ppm: ");
|
float humidity = bme.readHumidity();
|
||||||
Serial.println (ppm);
|
ppm = co2_sensor.getCorrectedPPM(temp, humidity);
|
||||||
Serial.print ("rzero: ");
|
|
||||||
Serial.println (co2_sensor.getRZero());
|
|
||||||
count = 0;
|
count = 0;
|
||||||
if (ppm < 1000) {
|
if (ppm < 1000) {
|
||||||
digitalWrite(PIN_LED_GREEN, 1);
|
digitalWrite(PIN_LED_GREEN, 1);
|
||||||
|
@ -61,7 +60,7 @@ void loop() {
|
||||||
digitalWrite(PIN_LED_RED, 1);
|
digitalWrite(PIN_LED_RED, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// printValues();
|
printValues(ppm, temp, humidity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ppm > 2000) {
|
if (ppm > 2000) {
|
||||||
|
@ -76,23 +75,20 @@ void loop() {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void printValues() {
|
void printValues(float ppm, float temp, float humidity) {
|
||||||
Serial.print("Temperature = ");
|
Serial.print("Temperature = ");
|
||||||
Serial.print(bme.readTemperature());
|
Serial.print(temp);
|
||||||
Serial.println(" *C");
|
Serial.println(" *C");
|
||||||
|
|
||||||
Serial.print("Pressure = ");
|
|
||||||
|
|
||||||
Serial.print(bme.readPressure() / 100.0F);
|
|
||||||
Serial.println(" hPa");
|
|
||||||
|
|
||||||
Serial.print("Approx. Altitude = ");
|
|
||||||
Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
|
|
||||||
Serial.println(" m");
|
|
||||||
|
|
||||||
Serial.print("Humidity = ");
|
Serial.print("Humidity = ");
|
||||||
Serial.print(bme.readHumidity());
|
Serial.print(humidity);
|
||||||
Serial.println(" %");
|
Serial.println(" %");
|
||||||
|
|
||||||
|
Serial.print ("ppm = ");
|
||||||
|
Serial.println (ppm);
|
||||||
|
|
||||||
|
Serial.print ("rzero = ");
|
||||||
|
Serial.println (co2_sensor.getCorrectedRZero(temp, humidity));
|
||||||
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue