Humidistat
Arduino firmware for a humidistat (humidity controller)
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1#ifndef HUMIDISTAT_CONFIG_H
2#define HUMIDISTAT_CONFIG_H
3
4#include <Arduino.h>
5#include <etl/span.h>
6
7#include "Point.h"
8
11//#define HUMIDISTAT_CONTROLLER_SINGLE
12//#define HUMIDISTAT_CONTROLLER_CASCADE
13
17//#define HUMIDISTAT_DHT
18//#define HUMIDISTAT_SHT
19
22//#define HUMIDISTAT_INPUT_KS0256
23//#define HUMIDISTAT_INPUT_KS0466
24
28//#define HUMIDISTAT_UI_CHAR
29//#define HUMIDISTAT_UI_GRAPH
30
31namespace config {
33 const uint32_t serialRate = 115200;
34
36 const bool overrideEEPROM = false;
37
39 const uint8_t EEPROMAddress = 0;
40
42#ifdef HUMIDISTAT_SHT
43 const uint16_t dt = 250;
44#else
45 const uint16_t dt = 500;
46#endif
47
50 const double HC_Kp = 0.01;
51 const double HC_Ki = 0.001;
52 const double HC_Kd = 0.01;
53 const double HC_Kf = 0.01;
55
58 const double FC_Kp = 0.005;
59 const double FC_Ki = 0.05;
60 const double FC_Kd = 0;
61 const double FC_Kf = 0;
62 const uint16_t FC_dt = 100;
64
66 const double S_lowValue = 0.75;
67
69 const double HC_totalFlowrate = 2;
70
72 const double a = 0.75;
73
76#ifdef ARDUINO_AVR_UNO
77 const uint8_t PIN_DHT = 2;
78 const uint8_t PIN_BTN = A0;
79 const uint8_t PIN_S1 = 3;
80 const uint8_t PIN_S2 = 11;
81
84 const uint8_t PIN_LCD_RS = 8;
85 const uint8_t PIN_LCD_ENABLE = 9;
86 const uint8_t PIN_LCD_D0 = 4;
87 const uint8_t PIN_LCD_D1 = 5;
88 const uint8_t PIN_LCD_D2 = 6;
89 const uint8_t PIN_LCD_D3 = 7;
91
94 const uint8_t PIN_T1 = A1;
95 const uint8_t PIN_T2 = A2;
96 const uint8_t PIN_T3 = A3;
97 const uint8_t PIN_T4 = A4;
99#endif
100#if defined(ARDUINO_TEENSYLC) || defined(ARDUINO_TEENSY40)
101 const uint8_t PIN_DHT = 17;
102 const uint8_t PIN_BTN = A0;
103 const uint8_t PIN_S1 = 3;
104 const uint8_t PIN_S2 = 4;
105 const uint8_t PIN_F1 = A1;
106 const uint8_t PIN_F2 = A2;
107
109 const uint8_t PIN_LCD_CS = 10;
110 const uint8_t PIN_LCD_MOSI = 11;
111 const uint8_t PIN_LCD_SCLK = 13;
112
115 const uint8_t PIN_T1 = A6;
116 const uint8_t PIN_T2 = A7;
117 const uint8_t PIN_T3 = A8;
118 const uint8_t PIN_T4 = A9;
120#endif
122
129 const uint8_t interval = 20; // seconds
131 {0 * interval, 50},
132 {1 * interval, 30},
133 {2 * interval, 60},
134 {3 * interval, 70},
135 {4 * interval, 20},
136 };
137
139 const SPProfile profiles[] = {
140 {"Tuning test", etl::span<const Point>(profile_tuningtest)},
141 };
143
146
148 const uint16_t buttonDebounceInterval = 500;
149
151 const uint16_t inputInterval = 200;
152
154 const uint16_t blinkInterval = 500;
155
157 const uint16_t splashDuration = 2000;
158
160 const uint16_t infoDuration = 0;
161
163 const uint16_t refreshInterval = 100;
164
166 const uint8_t adjustStep = 10;
167
170 const double tolerance = 0.01;
172
175
177 const uint16_t longPressDuration = 500;
178
180 const uint8_t configSaveCooldown = 20 * 1000 / refreshInterval;
182}
183
184#include "config_assert.h"
185
186#endif //HUMIDISTAT_CONFIG_H
Define either HUMIDISTAT_CONTROLLER_SINGLE or HUMIDISTAT_CONTROLLER_CASCADE. In the latter case,...
Definition config.h:31
const uint16_t refreshInterval
Interval for updating the display (in millis)
Definition config.h:163
const uint16_t blinkInterval
Interval for blinking display elements (in millis)
Definition config.h:154
const double tolerance
Tolerance in difference between process variable and setpoint outside which the setpoint blinks (in p...
Definition config.h:170
const uint8_t EEPROMAddress
EEPROM address for storing the block.
Definition config.h:39
const double FC_Kf
Definition config.h:61
const uint16_t dt
Global interval for PID/logger (based on polling rate of sensor, in millis)
Definition config.h:45
const double HC_Kf
Definition config.h:53
const uint16_t FC_dt
Definition config.h:62
const double HC_Kd
Definition config.h:52
const double HC_Ki
Definition config.h:51
const uint16_t longPressDuration
Duration for counting a press as 'long' (in millis)
Definition config.h:177
const uint16_t buttonDebounceInterval
For debouncing: interval the keypad state must be stable for (in micros)
Definition config.h:148
const double HC_Kp
Definition config.h:50
const SPProfile profiles[]
Setpoint profile definitions.
Definition config.h:139
const double FC_Kd
Definition config.h:60
const bool overrideEEPROM
Set to true to override the values stored in EEPROM and use the default PID parameters defined below.
Definition config.h:36
const double HC_totalFlowrate
Total flowrate (for cascade controller) (L/min)
Definition config.h:69
const uint16_t infoDuration
Duration for which to show the info screen (in millis)
Definition config.h:160
const double S_lowValue
Minimum solenoid duty cycle (deadband)
Definition config.h:66
const Point profile_tuningtest[]
Definition config.h:130
const double FC_Kp
Definition config.h:58
const uint8_t configSaveCooldown
Cooldown on saving the config to EEPROM (in refresh cycles)
Definition config.h:180
const uint32_t serialRate
Serial communication symbol rate (baud)
Definition config.h:33
const double a
Smoothing factor of EMA filter for derivative.
Definition config.h:72
const uint16_t splashDuration
Duration for which to show the splash screen (in millis)
Definition config.h:157
const uint8_t adjustStep
Step size by which to in-/de-crement for coarse adjustment.
Definition config.h:166
const uint8_t interval
Definition config.h:129
const double FC_Ki
Definition config.h:59
const uint16_t inputInterval
Repeat interval for keypress events (in millis)
Definition config.h:151
Point: a vector of a time and setpoint value.
Definition Point.h:8
Setpoint profile: a label and a span over Points.
Definition Point.h:14