12static const uint8_t Version = 16;
17static const uint8_t MaxWordLength = 32;
18static const uint8_t MaxShotTextLength = 128;
19static const uint16_t MaxLongTextLength = 1280;
20static const uint8_t LogDepth = 4;
21static const uint8_t QueueDepth = 32;
22static const uint8_t MovingAverageDepth = 10;
30static const uint8_t WirelessCSNPin = 49;
31static const uint8_t WirelessCEPin = 53;
32static const uint8_t WirelessDelay = 8;
33static const uint8_t WirelessRetry = 10;
34static const uint8_t WirelessPayloadSize = 32;
35static const uint16_t WirelessMessageTimeout = 500;
36static const uint16_t WirelessReceiveTimeout = 65000;
39#define PushingBoxLogRelayID "v755877CF53383E1"
42#define MqttPubTopic "Gbox420/"
43#define MqttSubTopic "Gbox420CMD/#"
44#define MqttLwtTopic "Gbox420LWT/"
45#define MqttLwtMessage "Gbox420 Offline"
49#define HomeAssistantServerIP "192.168.1.100" ///< Address of Home Assistant server ip
50#define HomeAssistantServerPort 8123 ///< Address of Home Assistant server port
51#define HomeAssistantServerURL "/api/states/sensor.gbox420" ///< Where to send the JSON formatted Log containing sensor readings
52#define HomeAssistantServerToken "Authorization: Bearer YOUR-TOKEN" ///< Generate a token in Home Assistant - USERNAME- Security - Long-lived access tokens
76 struct AeroModuleSettings AeroModule1 = {.
PressureTankPresent =
false, .Duration = 3.0, .DayInterval = 6, .NightInterval = 10, .PumpSpeed = 100, .PumpTimeOut = 420, .PrimingTime = 10, .MaxPressure = 7.0, .MinPressure = 5.0};
134 struct MainModuleSettings Main1 = {.
SerialReportDate =
true, .SerialReportMemory =
true, .SerialReportJSON =
true, .SerialReportJSONFriendly =
true, .SerialReportWireless =
true, .ReportToGoogleSheets =
false, .SheetsReportingFrequency = 30, .ReportToMqtt =
true, .MQTTReportFrequency = 5};
155 struct HempyModuleSettings HempyModule1 = {.
StartWeight_B1 = 16, .WateringIncrement_B1 = 0.3, .EvaporationTarget_B1 = 2.0, .DrainTargetWeight_B1 = 0.1, .MaxWeight_B1 = 20, .PumpSpeed_B1 = 35, .PumpTimeOut_B1 = 60, .DrainWaitTime_B1 = 300, .StartWeight_B2 = 16, .WateringIncrement_B2 = 0.3, .EvaporationTarget_B2 = 2.0, .DrainTargetWeight_B2 = 0.1, .MaxWeight_B2 = 20.0, .PumpSpeed_B2 = 35, .PumpTimeOut_B2 = 60, .DrainWaitTime_B2 = 300};
181 struct LightsSettings Lt1 = {.
Status =
false, .RelayPin = 29, .DimmingPin = 11, .DimmingLimit = 16, .DimmingDuration = 10, .Brightness = 75, .TimerEnabled =
true, .OnHour = 4, .OnMinute = 20, .OffHour = 16, .OffMinute = 20, .FadingEnabled =
false, .FadingInterval = 1, .FadingIncrements = 1};
182 struct LightsSettings Lt2 = {.
Status =
false, .RelayPin = 24, .DimmingPin = 12, .DimmingLimit = 6, .DimmingDuration = 10, .Brightness = 55, .TimerEnabled =
false, .OnHour = 4, .OnMinute = 20, .OffHour = 16, .OffMinute = 20, .FadingEnabled =
false, .FadingInterval = 1, .FadingIncrements = 1};
197 uint8_t CompatibilityVersion = Version;
Settings * loadSettings(bool ResetEEPROM=false)
Load settings from EEPROM.
void restoreDefaults()
Load sketch default settings into EEPROM.
char CurrentTime[MaxWordLength]
Buffer for storing current time in text format.
char LongMessage[MaxLongTextLength]
Temp storage for assembling long messages (REST API, MQTT reporting)
char ShortMessage[MaxShotTextLength]
Temp storage for assembling short text messages (Log entries, Error messages,etc)
void saveSettings(Settings *ToSave)
Store settings in EEPROM - Only updates changed bits.
MainModule * Main1
Represents a Grow Box with all components (Lights, DHT sensors, Power sensor, Aero/Hempy/Reservoir wi...
bool & Debug
True - Turns on extra debug messages on the Serial Output.
bool & Metric
True - Use metric units, False - Use imperial units.
ReservoirModule * ReservoirMod1
< AeroModule default settings
uint8_t Speed
PWM duty cycle to adjust motor speed.
< AeroModule default settings
bool PressureTankPresent
Is there a pressure tank connected or not.
uint16_t NightInterval
Spray every X minutes - When the lights are OFF.
float MinPressure
Turn on pump below this pressure.
float MaxPressure
Turn off pump above this pressure.
float Duration
Spray length in seconds (Actual duration is ~0.5sec longer due to thread + solenoid delay)
uint16_t PrimingTime
(Sec) For how long to keep the bypass solenoid on when starting the pump - Removes air bubbles from t...
uint8_t PumpSpeed
Pump duty cycle to adjust motor speed.
uint16_t PumpTimeOut
(Sec) Max pump run time
uint16_t DayInterval
Spray every X minutes - When the lights are ON.
< AirPump default settings
bool State
true - ON, false - OFF
uint8_t Pin
Relay pin controlling AC power to the air pump.
< DHTSensor default settings
uint8_t Pin
DAT pin of the DHT sensor.
uint8_t Type
Type defines the sensor type: 11 - DHT11, 12 - DHT12, 21 - DHT21 or AM2301 , 22 - DHT22.
uint8_t OnOffPin
Relay pin controlling AC power.
bool State
true - ON, false - OFF
bool HighSpeed
true - High speed, false - Low speed
uint8_t SpeedPin
Relay pin for speed selection.
uint16_t DrainWaitTime_B1
(sec) How long to wait after watering for the water to drain
float StartWeight_B2
Target weight for watering: Turn on pump below this weight.
uint16_t PumpTimeOut_B1
Waste reservoir full weight -> Pump gets disabled if reached.
uint16_t PumpTimeOut_B2
Waste reservoir full weight -> Pump gets disabled if reached.
float EvaporationTarget_B1
(kg/lbs) Amount of water that should evaporate before starting the watering cycles
float MaxWeight_B2
Waste reservoir full weight -> Pump gets disabled if reached.
float WateringIncrement_B1
(kg/lbs) Amount of water that should be pumped at each watering cycle
float DrainTargetWeight_B1
(kg/lbs) Amount of water that should go to the waste reservoir after a watering cycle
float EvaporationTarget_B2
(kg/lbs) Amount of water that should evaporate before starting the watering cycles
float StartWeight_B1
Target weight for watering: Turn on pump below this weight.
float WateringIncrement_B2
(kg/lbs) Amount of water that should be pumped at each watering cycle
uint8_t PumpSpeed_B2
Pump duty cycle to adjust motor speed.
uint16_t DrainWaitTime_B2
(sec) How long to wait after watering for the water to drain
uint8_t PumpSpeed_B1
Pump duty cycle to adjust motor speed.
float MaxWeight_B1
Waste reservoir full weight -> Pump gets disabled if reached.
float DrainTargetWeight_B2
(kg/lbs) Amount of water that should go to the waste reservoir after a watering cycle
< LightSensor default settings
uint8_t DigitalPin
Light sensor D0 pin.
uint8_t AnalogPin
Light sensor A0 pin.
< Lights default settings
uint8_t RelayPin
Relay port controlling AC power to LED driver.
uint8_t OffHour
Light OFF time - hour.
uint8_t Brightness
Light intensity: 0 - 100 range for controlling led driver output.
uint8_t DimmingPin
PWM based dimming, connected to optocoupler`s base over 1k ohm resistor.
bool TimerEnabled
Enable/Disable timer controlling lights.
uint8_t DimmingDuration
Temporary dimming duration in Seconds.
uint8_t FadingIncrements
How much to change the brightness during a fade in/out in Percentage <Not exposed to Web interface>
uint16_t FadingInterval
(Sec) How often should the brightness change during a fade in/out <Not exposed to Web interface>
uint8_t OffMinute
Light OFF time - minute.
uint8_t OnMinute
Light ON time - minute.
uint8_t DimmingLimit
Sets the LED dimming limit (Usually around 5%)
bool FadingEnabled
Enables/disables fading lights in when turning on, and fading lights out when turning off <Not expose...
bool Status
Startup status for lights: True-ON / False-OFF.
uint8_t OnHour
Light ON time - hour.
< MainModule default settings
bool SerialReportMemory
Enable/disable reporting the remaining free memory to the Serial output.
uint16_t SheetsReportingFrequency
How often to report to Google Sheets. Use 15 minute increments only! Min 15min, Max 1440 (1day)
bool SerialReportDate
Enable/disable reporting the current time to the Serial output.
bool SerialReportJSON
Enable/disable sending JSON formatted reports to the Serial output.
bool SerialReportJSONFriendly
Enable/disable sending JSON report with friendly values (Sec,%,Min,kg/lbs..etc appended) to Serial.
bool ReportToGoogleSheets
Enable/disable reporting sensor readings to Google Sheets.
bool SerialReportWireless
Enable/disable sending wireless package exchange reports to the Serial output.
uint16_t MQTTReportFrequency
How often to report to MQTT. Use 5 Sec increments, Min 5sec, Max 86400 (1day)
bool ReportToMqtt
Enable/disable reporting sensor readings to an MQTT broker.
< ReservoirModule default settings
uint8_t Pin
Piezo Buzzer red(+) cable.
bool Enabled
Enable/Disable sound.