Close
0%
0%

Hydroponics control

Automated control of hydroponics Garden with Control Via Blynk

Similar projects worth following
My brother is has put together a hydroponics garden and wanted to automate some of the functions. controlling water flow to the grow bed along with temperature and humidity in the green house are the primary requirements

Specifications

  • Inputs
    • Grow media moisture (analog, input 0-3V)
    • Humidity (digital, one wire bus)
    • Ambient Temperature (digital, one wire bus)
    • Water storage level ( digital, float valve)  
  • Outputs
    • Water Pump (240V AC 200W)
    • Exhaust Fan (240V AC 100W)
    • Mister (12V Solenoid 10W)
  • Connectivity
    • Remote data viewing via mobile phone
    • Remote parameter alteration

Background

In the current configuration the grow bed is flooded by running a pump for 6 minutes a timer than turns the pump off for a period of time which allows the grow bed to drain and then the cycle is repeated.

This current arrangement does not allow for any variation in environmental conditions and variations in the moisture uptake transpiration of the plants throughout their life cycle.

Operation 

Moisture

The proposal is to monitor the moisture level of the grow medium and when the moisture level drops below a preset level the pump will be activated to flood the bed. Once the bed has flooded the pump will be switched off and the bed allowed to drain. 

Temperature 

The temperature of the green house will also be monitored if it raises above a predetermined level an exhaust fan will be activated to expel the hot air and draw fresh air in. 

Humidity 

In conjunction with the temperature monitoring the humidity will also be tracked and adjusted through the  operation of the exhaust fan or misting sytem. 

Proposal

It is proposed to use the Blynk system for providing “cloud” services to allow remote monitoring and control of the system. 

It will use an ESP8266 in the form of an NodeMCU 1.0 board ( I have some at hand) to provide processing power and WiFi connectivity.

240V devices will be switched using optocoupled Triacs with Zero crossing detection to minimize radiated noise. 

12V solenoid driven by optocoupled MOSFET

Hydro_control.csv

19 May 2018

Comma-Separated Values - 1.14 kB - 05/19/2018 at 12:02

Download

ino - 5.84 kB - 05/19/2018 at 11:43

Download

kicad_pcb - 171.36 kB - 05/19/2018 at 11:36

Download

Hydro_control.sch

19 May 2018

sch - 15.04 kB - 05/19/2018 at 11:35

Download

  • Circuit and PCB Designed

    Saabman05/19/2018 at 11:32 0 comments

    Knuckled down this week and got the Circuit drawn up in Kicad and the PCB laid out. reasonably happy with how it came out. Working with Kicad for the first time after using Eagle for the last 10 years or so was a bit of a challenge but with plenty of tutorials and information available anything I struggled with was solved in a minute or 2 with the help of Duck DucK Go.

    Next step will be to produce the PCB and put it all together.

  • Hardware

    Saabman03/13/2018 at 10:24 0 comments

    Things have been moving along a bit slow on this project of late but some progress has been made this week on the circuit design. 

    Primarily this is a NodeMCU board with a bunch of IO associated with it. Normally I would have just copied and pasted the IO stages of other projects and the job is done but..   I’ve taken the opportunity to jump from using Eagle (which I’ve alsways hated anyway) over to Kicad and I hope I find it more palatable than Eagle.  I cut my teeth doing circuit design on Protel 98  I think the version was but with no Mac equivalent about when I made the switch from windows to MacOS (7.6 I think it was) I didn’t have many options.

    So to get the ball rolling while I come to terms with libraries and the like in Kicad I’ve reverted to sketching the IO stages on paper while I make my component selections than I’ll input it all into Kicad for the schematic capture and board creation.

    Inputs are pretty straight forward sensor connects via a connector to the board and wired directly to the NodeMCU. In this case Im expecting the sensors to be fairly close to the board if not directly on it so at this stage I am not considering anything more than clamping diodes to keep induced signals to within the power rails.

    Outputs are switching primarily 240V AC devices so opto isolated Triac drivers and Triacs are the order of the day.

    At this stage MOC3033 opto isloated zero crossing triac drivers will be used to switch the BT138 600V 12A Triacs - serious over kill for this application but the cost difference for a lower spec triac is pretty negligible and this gives me the advantage of repoursing the circuit for other things :)

    The DC switching will also be opto isolated (TLP185) coupled with an IRF840 500V 8A MOSFET as a high side switch. Again a fair bit of over kill but will lend itself to other projects requiring a higher voltage range and more power. 

  • Firmware Completion

    Saabman12/26/2017 at 10:59 0 comments

    A good run today saw me complete the Firmware, no doubt modifications will be coming but things have progressed enough to move on to the Hardware.

    The code is listed below.
    from the App it is possible to adjust the setpoints for the Temperature, Humidity and Moisture level pressing the save button stores the values in the EEPROM of the ESP8266 which is read on start up should the 8266 ever be rebooted.

    /*************************************************************
      Blynk is a platform with iOS and Android apps to control
      Arduino, Raspberry Pi and the likes over the Internet.
      You can easily build graphic interfaces for all your
      projects by simply dragging and dropping widgets.
    
        Downloads, docs, tutorials: http://www.blynk.cc
        Blynk community:            http://community.blynk.cc
        Social networks:            http://www.fb.com/blynkapp
                                    http://twitter.com/blynk_app
    
      Blynk library is licensed under MIT license
    
     *************************************************************/
    
    /* Comment this out to disable prints and save space */
    #define BLYNK_PRINT Serial
    
    #include <SPI.h>
    #include <ESP8266WiFi.h>
    #include <BlynkSimpleEsp8266.h>
    #include <SimpleTimer.h>
    #include <DHT.h>
    #include <EEPROM.h>
    
    // You should get Auth Token in the Blynk App.
    // Go to the Project Settings (nut icon).
    char auth[] = "xxxx";
    char ssid[] = "xxxx";
    char pass[] = "xxxx";
    bool level = 0;
    int fan;
    int mist;
    int pump;
    int lowWater;
    int moisture = 0;
    int dryLevel = 100;
    int maxTemp = 30;
    int minHumidity = 50;
    float humidity = 0;
    float temperature = 0;
    
    #define DHTPIN D2          // What digital pin we're connected to
    #define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
    
    DHT dht(DHTPIN, DHTTYPE);
    SimpleTimer timer;
    
    
    void readInputs()
    {
      digitalWrite(D8,HIGH);                // turns on Moisture sensor
      humidity = dht.readHumidity();        // Reads Humidity
      temperature = dht.readTemperature();  // Reads Temperature
      lowWater = digitalRead(D1);           // Read Low  water level sensor
      moisture = analogRead(A0)/4;          //read moisture sensor scales value to have a max of 255 for easy storage in EEPROM
      digitalWrite(D8,LOW);                 // turns off moisture sensor
    
      if (isnan(humidity) || isnan(temperature)) {
        Serial.println("Failed to read from DHT sensor!");
        return;
      }
      
    }
    
    
    void reportToBlynk()
    //Sends data values to Blynk
    {
      // Sets sliders to values from Controller
      Blynk.virtualWrite(V1, dryLevel);
      Blynk.virtualWrite(V2, minHumidity);
      Blynk.virtualWrite(V3, maxTemp);
      // Display Values 
      Blynk.virtualWrite(V5, humidity);
      Blynk.virtualWrite(V6, temperature);
      Blynk.virtualWrite(V7, moisture);
      Blynk.virtualWrite(V4, moisture);
    
      // Satus LED's
      Blynk.virtualWrite(V12, fan);         // Controls LEDs in App to indicate
      Blynk.virtualWrite(V11, mist);        // status of Pumps and fans etc
      Blynk.virtualWrite(V10, pump);
      Blynk.virtualWrite(V9, lowWater*255);     // Low Water warning indicator. Reading the input pin returns 1 but need to scale up to 255 to drive the BLYNK LED widget to full brightnes so * 255
    
      
    }
    
    BLYNK_WRITE(V1)
      /*  gets called when Slider attched to virtual pin 1 in the Blynk app changes
          sets the value of the sider to drylevel. This is the setpoint level for the
          activation of the flood pump.
      */   
    {
      dryLevel = param.asInt();           // assigning incoming value from pin V1 as an int to the dryLevel variable
      Serial.print ("Moisture set ");
      Serial.println (dryLevel);
      EEPROM.write(1,dryLevel);           //Stores the value of drylevel to EEPROM
    }
    
    BLYNK_WRITE(V2)
      /* 
       * sets the min Humidity level for the mister to turn on 
       */
    {
      minHumidity =param.asInt();
      Serial.print ("Humidty ");
      Serial.println (minHumidity);
      EEPROM.write(2,minHumidity);           //Stores the value of minHumidity to EEPROM
    }
    
    BLYNK_WRITE(V3)
    /*
     * sets the tempertaure level for the fans to come on
     */
    {
      maxTemp = param.asInt();
      Serial.print ("Temp Set ");
      Serial.println ( maxTemp);
      EEPROM.write(3,maxTemp);           //Stores the value of maxTemp to EEPROM
    }
    
    BLYNK_WRITE(V8)
    /*
     * Loads settings into EEPROM on Button press
     */
    {
      EEPROM.commit();
    }
     
    void controlOutputs()
    
    /* Turns on watre pump...
    Read more »

  • Blynk Pin Assingnment

    Saabman12/19/2017 at 07:17 0 comments

    Bynk uses "Virtual Pins" to pass data between the App and the hardware.

    Virtual PinDescription
    V1Moisture level of the grow bed
    V2Min Humidity Level
    V3Max Temperature
    V4Graph (Moisture level of grow bed)
    V5Humidity
    V6Temp
    V7Moisture
    V8Save Settings

    V9Water Low
    V10Pump Run
    V11
    Mister
    V12Fan

    The Blynk Library calls BLYNK_WRITE(Virtual Pin#) when the appropriate virtual pin value is changed by the app.

    In my Firmware once the function is called I store the Value of the Vpin in the appropriate variable for use later.

    As an example

    BLYNK_WRITE(V3)
    /*
     * sets the temperature level for the fans to come on
     */
    {
      maxTemp = param.asInt();
      Serial.print ("Temp Set ");
      Serial.println ( maxTemp);
    }

    every time the temp Slider is moved the value of the slider is stored and printed.

    Unfortunately the value stored will be lost if the NodeMCU is ever reset - ## Need to store the values in Flash to be read when the unit reboots ##

  • Blynk

    Saabman12/18/2017 at 07:04 0 comments

    This control system is designed run on its own but also make use of the facilities a connected device affords us.

    The control unit will be just a box with a few outlets for pumps etc. No buttons, no display. All the feedback and adjustments will be done by a mobile phone interface and for this project Ive chosen to work with the Blynk system.

    http://www.blynk.io/#home

    In a nut shell Blynk allows you to pass data between the Blynk App and your connected device.

    Requirements

    • Display
      • Temperature
      • Humidity
      • Moisture Level
    • Adjust
      • Fan set point
      • Mister set point
      • Water pump set point

    Ive put together a Blynk App to get the ball rolling and looks something like this

    The Temp, Humidity and Moisture level will be displayed across the top of the screen the sliders below those will adjust the set point for each parameter.

    The LED at the bottom is a warning indicator that the water resivior  is low.

    The Graph at this stage will display moisture level of the bed over time.

  • Slow Progress

    Saabman12/13/2017 at 07:13 0 comments

    Having a couple of kids under 3 doesn't bode well for rapid development - They take up a lot of time.

    So progress has been slow but non the less there has been progress.

    Software has been started and the ESP8266 sends temperature, humidity and moisture readings to the Blynk App. just need to add the water level sensor value and thats the inputs taken care of.

    Next step will be to take the setpoint parameters from the Blynk app for the fan and water pump activation that will have the software largely sorted.

    once that is organised I will get to work on the hardware to control the fan and pump   

  • Firmware development 1

    Saabman11/17/2017 at 23:28 0 comments

    Now I have the IO sorted out time to move onto making the firmware come together.

    The basic frame work.

    Read All   the sensor values  -

    • Grow Bed moisture level (Moisture)
    • Temperature (Temp)
    • Humidity (Humid)
    • Water level (WaterLevel)

    Send Values to Blynk App.

    If Moisture is low - Turn on the Pump for 6 minutes (the length of time it takes to flood the bed)

    If Temp is above X level  - Turn on fans

    If Humid is below Y level - Turn on mister for 1 minute (this is an arbitrary value and will need tuning)

    If WaterLevel is low - Set an Alert on the Blynk App.

    Set points to be adjusted by Blynk

    Temperature and Humidity readings displayed on the Blynk App

  • Lock Down

    Saabman11/16/2017 at 19:31 0 comments

    Today the project starts in earnest. I was contacted last night by my brother with a rather disturbing picture of dead plants.

    Due to the unattended operation some failure occurred and with no monitoring of the system the grow bed was devoid of water for a period of time.

    While contemplating the requirements of the project all manner of ideas have come up and what we could control and needless to say feature creep was starting to set in so a decision has been made to lock down the parameters just as indicated in the description above and save the added features for a future project and upgrade once we had the opportunity to try the system out. Implementing great ideas that may be not necessary will only delay the project further which will lead to greater crop loss.

    The project in its current form will be limited to 3 inputs and 3 outputs

    Inputs

    Node MCU Pin
    DescriptionType
    A0Grow media Moisture
    Analog
    D1Water Storage Level
    Digital
    D2Temperature and Humidity
    One wire Bus

    Outputs

    Node MCU Pin
    Description                        
    Type              
    D5Water PumpDigital
    D6Exhaust Fan
    Digital
    D7MisterDigital
    D8Moisture Sense Activate
    Digital



    Specs for the NODE MCU 1.0 Board available from

    https://github.com/nodemcu/nodemcu-devkit-v1.0

    Pinouts

View all 8 project logs

Enjoy this project?

Share

Discussions

Saabman wrote 04/17/2020 at 00:16 point

Hi, I was building this for my brother and he ended up moving so the whole project got shelved till he decides to re visit it again. So it never got finished 

  Are you sure? yes | no

Ivan Stepaniuk wrote 04/16/2020 at 22:50 point

Very interesting project! What were the results?

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates