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
|
||||
/// Calibration resistance at atmospheric CO2 level
|
||||
// #define RZERO 76.63
|
||||
#define RZERO 4000
|
||||
#define RZERO 840
|
||||
/// Parameters for calculating ppm of CO2 from sensor resistance
|
||||
#define PARA 116.6020682
|
||||
#define PARB 2.769034857
|
||||
|
|
|
@ -11,4 +11,6 @@
|
|||
[env:mega]
|
||||
platform = atmelavr
|
||||
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() {
|
||||
if (count >= maxCount || count < 0) {
|
||||
ppm = co2_sensor.getPPM();
|
||||
Serial.print ("ppm: ");
|
||||
Serial.println (ppm);
|
||||
Serial.print ("rzero: ");
|
||||
Serial.println (co2_sensor.getRZero());
|
||||
float temp = bme.readTemperature();
|
||||
float humidity = bme.readHumidity();
|
||||
ppm = co2_sensor.getCorrectedPPM(temp, humidity);
|
||||
|
||||
count = 0;
|
||||
if (ppm < 1000) {
|
||||
digitalWrite(PIN_LED_GREEN, 1);
|
||||
|
@ -61,7 +60,7 @@ void loop() {
|
|||
digitalWrite(PIN_LED_RED, 1);
|
||||
}
|
||||
|
||||
// printValues();
|
||||
printValues(ppm, temp, humidity);
|
||||
}
|
||||
|
||||
if (ppm > 2000) {
|
||||
|
@ -76,23 +75,20 @@ void loop() {
|
|||
count++;
|
||||
}
|
||||
|
||||
void printValues() {
|
||||
void printValues(float ppm, float temp, float humidity) {
|
||||
Serial.print("Temperature = ");
|
||||
Serial.print(bme.readTemperature());
|
||||
Serial.print(temp);
|
||||
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(bme.readHumidity());
|
||||
Serial.print(humidity);
|
||||
Serial.println(" %");
|
||||
|
||||
Serial.print ("ppm = ");
|
||||
Serial.println (ppm);
|
||||
|
||||
Serial.print ("rzero = ");
|
||||
Serial.println (co2_sensor.getCorrectedRZero(temp, humidity));
|
||||
|
||||
Serial.println();
|
||||
}
|
Loading…
Add table
Reference in a new issue