co2_sensor.h 1.08 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
#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
#include "config.h"
#include "led_effects.h"
#include "csv_writer.h" // To close filesystem before restart.
#include <Wire.h>

12
13
14
15
#ifdef MQTT
#  include "mqtt.h"
#endif

16
namespace config {
17
  extern uint16_t measurement_timestep; // [s] Value between 2 and 1800 (range for SCD30 sensor)
18
  extern const bool auto_calibrate_sensor; // [true / false]
19
  extern uint16_t co2_calibration_level; // [ppm]
20
21
22
23
24
25
26
27
28
29
30
  extern const float temperature_offset; // [K] Sign isn't relevant.
}

namespace sensor {
  extern SCD30 scd30;
  extern int16_t co2;
  extern float temperature;
  extern float humidity;
  extern String timestamp;

  void initialize();
31
  void processData();
32
33
34
  void startCalibrationProcess();
}
#endif