Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
Christian
Published © GPL3+

Professional Hydroponics Chiller

Build your own low cost closed system Hydroponics Chiller

IntermediateFull instructions provided6 hours767

Things used in this project

Hardware components

IO Expander Bundle
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Hydroponics Chiller Setup

Setup of Hydroponics Chiller

Code

Hydroponics Chiller

C/C++
Build your own closed system Hydroponics Chiller
#define CHILLER_ON              "e4o"
#define CHILLER_OFF             "e4f"
#define WATER_PUMP_ON           "e5o"
#define WATER_PUMP_OFF          "e5f"
 
...
 
#define SOLENOID_ON_WATER_TEMP  66.25        
#define SOLENOID_OFF_WATER_TEMP 65.75
#define CHILLER_ON_WATER_TEMP   60
#define CHILLER_OFF_WATER_TEMP  50
#define CHILLER_CYCLE_TIME      10          // Chiller minimum on/off time to protect compressor
 
...
 
#define CHILLER_SOLENOID_POWER  5           // Water Solenoid Valve 4.8W
#define CHILLER_POWER           121         // Freezer 5ct
 
...
 
const char CHILLER_SENSOR[] =   "t2r76";     // Chiller Sensor 1-Wire Junction DS18B20 *** Change 76
 
...
 
void loop() {
 
...
 
  static int8_t chiller = false;
 
...
 
  float chiller_temp;
  static uint8_t chiller_cycle = CHILLER_CYCLE_TIME;
 
...
 
        // Check chiller temp
        if (SerialCmd(CHILLER_SENSOR)) {
          if (SerialReadFloat(&chiller_temp)) {
            if (chiller_cycle) chiller_cycle--;
            else {
              if (chiller) {
                if (C2F(chiller_temp) <= CHILLER_OFF_WATER_TEMP) {
                  chiller_cycle = CHILLER_CYCLE_TIME;
                  chiller = false;
                }
              }
              else {
                if (C2F(chiller_temp) >= CHILLER_ON_WATER_TEMP) {
                  chiller_cycle = CHILLER_CYCLE_TIME;
                  chiller = true;
                }
              }
            }
          }
          SerialReadUntilDone();
        }
        else {
          chiller_temp = ERROR_NO_ROM;
          chiller = false;
        }
 
...
 
          // Check chiller pumps
          if (grow_bed->chiller_relay) {
            if (chiller >= 0 && C2F(chiller_temp) <= CHILLER_ON_WATER_TEMP) {
              if (grow_bed->water_temp_error) grow_bed->chiller_solenoid = false;
              else {
                if (grow_bed->chiller_solenoid) {
                  if (C2F(grow_bed->water_temp) <= SOLENOID_OFF_WATER_TEMP) grow_bed->chiller_solenoid = false;
                }
                else {
                  if (C2F(grow_bed->water_temp) >= SOLENOID_ON_WATER_TEMP) grow_bed->chiller_solenoid = true;
                }
              }
            }
            else grow_bed->chiller_solenoid = false;  
            Serial.print("e");
            Serial.print(grow_bed->chiller_relay);
            SerialCmdDone((grow_bed->chiller_solenoid) ? "o" : "f");
            if (grow_bed->chiller_solenoid) {
              water_pump = true;
              AddPower(CHILLER_SOLENOID_POWER);
              delay(100); // Add a delay for current in rush to the solenoid if powered by the same 12V rail as the IO Expander and x16 Relay module
            }
          }
 
...
 
        SerialCmdDone((chiller) ? CHILLER_ON : CHILLER_OFF);
        SerialCmdDone((water_pump) ? WATER_PUMP_ON: WATER_PUMP_OFF);
 
...
 
        if (chiller) AddPower(CHILLER_POWER);
        if (water_pump) AddPower(WATER_PUMP_POWER);
 
...
 
              if (!prev_grow_bed->water_level) Serial.print(";sf0;sa0;sd0,0,\"LOW\"");
              else if (prev_grow_bed->chiller_solenoid) Serial.print(";sf0;sa0;sd0,0,\"CHILL\"");
              if (!grow_bed->water_level) Serial.print(";sf0;sa1;sd126,0,\"LOW\"");
              else if (grow_bed->chiller_solenoid) Serial.print(";sf0;sa1;sd126,0,\"CHILL\"");
 

Credits

Christian

Christian

24 projects • 134 followers
Senior Embedded Engineer

Comments