config.public.h 4.35 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#ifndef CONFIG_H_INCLUDED
#  define CONFIG_H_INCLUDED

// This file is a config template, and can be copied to config.h. Please don't save any important password in this template.

/**
 * WIFI
 */

// Setting WIFI_SSID to "NO_WIFI" will disable WiFi completely, and all other dependent services (MQTT, HTTP, NTP, ...)
#  define WIFI_SSID     "NO_WIFI"
#  define WIFI_PASSWORD "P4SSW0RD"
#  define WIFI_TIMEOUT  20 // [s]

/**
 * Sensor
 */

// How often should measurement be performed, and displayed?
//NOTE: SCD30 timer does not seem to be very precise. Variations may occur.
#  define MEASUREMENT_TIMESTEP 60 // [s] Value between 2 and 1800 (range for SCD30 sensor)

// How often measurements should be sent to MQTT server?
// Probably a good idea to use a multiple of MEASUREMENT_TIMESTEP, so that averages can be calculated
// Set to 0 if you want to send values after each measurement
// #  define SENDING_INTERVAL MEASUREMENT_TIMESTEP * 5 // [s]
#  define SENDING_INTERVAL 300 // [s]

// How often should measurements be appended to CSV ?
// Probably a good idea to use a multiple of MEASUREMENT_TIMESTEP, so that averages can be calculated
// Set to 0 if you want to send values after each measurement
#  define CSV_INTERVAL 300 // [s]

// Residual heat from CO2 sensor seems to be high enough to change the temperature reading. How much should it be offset?
// NOTE: Sign isn't relevant. The returned temperature will always be shifted down.
#  define TEMPERATURE_OFFSET -3 // [K]

// Altitude above sea level
// Used for CO2 calibration
// here: Stuttgart, Schellingstr. 24. (Source: Google Earth)
#  define ALTITUDE_ABOVE_SEA_LEVEL 260 // [m]

// The reference CO2 concentration has to be within the range 400 ppm ≤ cref(CO2) ≤ 2000 ppm.
// Used for CO2 calibration
// here : measured concentration in Stuttgart
#  define ATMOSPHERIC_CO2_CONCENTRATION 425 // [ppm]

// Should the sensor try to calibrate itself?
// Sensirion recommends 7 days of continuous readings with at least 1 hour a day of 'fresh air' for self-calibration to complete.
#  define AUTO_CALIBRATE_SENSOR true // [true / false]

/**
 * LEDs
 */

// LED brightness, which can vary between min and max brightness ("LED breathing")
// max_brightness should be between 0 and 255.
// min_brightness should be between 0 and max_brightness
#  define MAX_BRIGHTNESS 255
#  define MIN_BRIGHTNESS 60

/**
 * WEB SERVER
 * available at http://local_ip, with user HTTP_USER and password HTTP_PASSWORD
 */

#  define HTTP // Comment or remove this line if you want to disable HTTP webserver

// Define empty strings in order to disable authentication, or remove the constants altogether.
#  define HTTP_USER "co2ampel"
#  define HTTP_PASSWORD "my_password"

/**
 * MQTT SERVER
 */
#  define MQTT // Comment or remove this line if you want to disable MQTT

/*
 * If MQTT is enabled, co2ampel will publish data every SENDING_INTERVAL seconds.
 * An MQTT subscriber can then get the data from the corresponding broker, either encrypted or unencrypted:
 *
 *  ❯ mosquitto_sub -h 'test.mosquitto.org' -p 8883 -t 'CO2sensors/#' --cafile mosquitto.org.crt -v
 *  CO2sensors/ESPd05cc9 {"time":"2020-12-13 13:14:37+01", "co2":571, "temp":18.9, "rh":50.9}
 *  CO2sensors/ESPd05cc9 {"time":"2020-12-13 13:14:48+01", "co2":573, "temp":18.9, "rh":50.2}
 *  ...
 *
 *  ❯ mosquitto_sub -h 'test.mosquitto.org' -t 'CO2sensors/#' -v
 *  CO2sensors/ESPd05cc9 {"time":"2020-12-13 13:15:09+01", "co2":568, "temp":18.9, "rh":50.1}
 *  CO2sensors/ESPd05cc9 {"time":"2020-12-13 13:15:20+01", "co2":572, "temp":18.9, "rh":50.3}
 *  ...
 */

/*
 * Allow sensor to be configured over MQTT? Very useful for debugging. For example:
 *   mosquitto_pub -h 'test.mosquitto.org' -t 'CO2sensors/ESPe08dc9/control' -m 'timer 30'
 *   mosquitto_pub -h 'test.mosquitto.org' -t 'CO2sensors/ESPe08dc9/control' -m 'calibrate'
 *   mosquitto_pub -h 'test.mosquitto.org' -t 'CO2sensors/ESPe08dc9/control' -m 'reset'
 */
#  define ALLOW_MQTT_COMMANDS false

#  define MQTT_SERVER "test.mosquitto.org"  // MQTT server URL or IP address
#  define MQTT_PORT 8883
#  define MQTT_USER ""
#  define MQTT_PASSWORD ""
#  define MQTT_SERVER_FINGERPRINT "EE BC 4B F8 57 E3 D3 E4 07 54 23 1E F0 C8 A1 56 E0 D3 1A 1C" // SHA1 for test.mosquitto.org

/**
 * NTP
 */

#  define NTP_SERVER "pool.ntp.org"
#  define UTC_OFFSET_IN_SECONDS 3600 // [s] 3600 for UTC+1

/**
 * Others
 */
#  define BAUDS 115200 // Transmission rate

#endif