co2_sensor.h 1.18 KB
Newer Older
1
2
3
4
5
6
7
8
#ifndef CO2_SENSOR_H_
#define CO2_SENSOR_H_

// The SCD30 from Sensirion is a high quality Nondispersive Infrared (NDIR) based CO₂ sensor capable of detecting 400 to 10000ppm with an accuracy of ±(30ppm+3%).
// https://github.com/sparkfun/SparkFun_SCD30_Arduino_Library
#include "src/lib/SparkFun_SCD30_Arduino_Library/src/SparkFun_SCD30_Arduino_Library.h"  // From: http://librarymanager/All#SparkFun_SCD30

namespace config {
9
  extern uint16_t measurement_timestep; // [s] Value between 2 and 1800 (range for SCD30 sensor)
10
  extern bool auto_calibrate_sensor; // [true / false]
11
  extern uint16_t co2_calibration_level; // [ppm]
12
13
14
15
16
  extern const float temperature_offset; // [K] Sign isn't relevant.
}

namespace sensor {
  extern SCD30 scd30;
17
  extern uint16_t co2;
18
19
  extern float temperature;
  extern float humidity;
Eric Duminil's avatar
Eric Duminil committed
20
  extern char timestamp[];
21
22

  void initialize();
Eric Duminil's avatar
Eric Duminil committed
23
  bool processData();
24
  void startCalibrationProcess();
25
26
27
28
29

  void setCO2forDebugging(int32_t fakeCo2);
  void setTimer(int32_t timestep);
  void calibrateSensorToSpecificPPM(int32_t calibrationLevel);
  void calibrateSensorRightNow(int32_t calibrationLevel);
30
  void setAutoCalibration(int32_t autoCalibration);
31
  void resetSCD();
32
33
}
#endif