• Hydroponics Nutrient feeder unit

    01/06/2022 at 15:00 0 comments

    I have been growing leafy greens using Hydroponics for the last 3 years. I was tiered checking out for the nutrient levels and pH level of the nutrient water solution, so I decided to make a nutrient feeding unit to maintain the optimal nutrient level and PH 

    To measure th EC I needed to get a EC sensor, the EC sensor available in market were quite expensive so I decided to check if I can make DIY it. Luckily I found one project on hackaday (3 dollar Ec Meter) so  I made my own EC sensor
    I bought  EC sensor from an Electronics Ecommerce for about 20 USD


    So the total components used were :
    1 Arduino Mega
    2 DS18B20 temperature sensor
    3 2 Peristaltic Pump
    4 Seven Segment LCD display 
    5 pH sensor probe 
    6 Ec sensor 
    7 tubes to feed nutrient solution
    8 Relay Board to control Peristaltic Pump

    Arduino Code 

    #include <LiquidCrystal.h>
    #include <OneWire.h>
    #include <DallasTemperature.h>
    #define set A0   //set pin on A0
    #define inc A1  //increment pin on A1
    #define dec A2  //decrement pin on A2
    //********Serial_Data**************
    float data1 = 0;
    float data2 = 0;
    float data3 = 0;
    
    //######################SETTINGS_FOR_EC_MEASUREMENT##############################
    
    #define ECPump 10 
    #define ONE_WIRE_BUS 6                    // Data wire For Temp Probe is plugged into pin 2 on the Arduino 
    int R1=450;                                 //resistance provided for the votage 
    int Ra=25;                                  //Resistance of powering Pins
    int ECPin= A3;
    int ECGround=A4;
    int ECPower =A5;
    
    float TemperatureCoef = 0.019;             //this changes depending on what chemical we are measuring
    float K=3.3;                               //value from the calibration test
    OneWire oneWire(ONE_WIRE_BUS);             // Setup a oneWire instance to communicate with any OneWire devices
    const int TempProbePossitive =9;           //Temp Probe power connected to pin 9
    const int TempProbeNegative=8;             //Temp Probe Negative connected to pin 8
    DallasTemperature sensors(&oneWire);       // Pass our oneWire reference to Dallas Temperature.
    float Temperature=0;
    float EC=0;
    float EC25 =0;
    float finalEC=0;
    float raw= 0;
    float Vin= 5;
    float Vdrop= 0;
    float Rc= 0;
    float buffer=0;
    int ecMaxStatus=0; //flag to check if the Ec has reached its maximum value
    
    //#################################LCD_SETTINGS###############################################
    
    
    const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; // pin number on arduino
    LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
    
    //void screen1(int ec,int ph,int temp);
    //#################################PH_SETTINGS################################################
    #define PHPump 7
    float ph=0;
    #define SensorPin A6            //pH meter Analog output to Arduino Analog Input 0
    #define Offset -9.45            //deviation compensate
    unsigned long int avgValue;     //Store the average value of the sensor feedback
    //################################CHECK_TIMES################################################
    long int EC_CheckTime=10000; // 30 seconds
    long int PH_CheckTime=12000;
    unsigned long int previousMillis = 0;
    //################SET_EC&PH####################################################
    float setEC=2.7;
    float setPH=1;
    
    
    void setup(){
      //***************LCD_SETUP****************
      lcd.begin(16,2);
      lcd.print("T  F  C");
      //****************EC&TEMP_SETUP*******************
      pinMode(TempProbeNegative , OUTPUT );             //seting ground pin as output for tmp probe
      digitalWrite(TempProbeNegative , LOW );           //Seting it to ground so it can sink current
      pinMode(TempProbePossitive , OUTPUT );            //ditto but for positive
      digitalWrite(TempProbePossitive , HIGH );  
      pinMode(ECPin,INPUT);
      pinMode(ECGround,OUTPUT);                         //setting pin for sinking current
      digitalWrite(ECGround,LOW);                      //We can leave the ground connected permanantly
      pinMode(ECPump,OUTPUT);
      digitalWrite(ECPump,LOW);
      pinMode(PHPump,OUTPUT);
      digitalWrite(PHPump,LOW);                                      // gives sensor time to settle
      
      sensors.begin();
      delay(100);
      R1=(R1+Ra);         
      //************************************************
      Serial.begin(9600);
    
    }
    
    void loop(){
      GetEC();
      GetPH();
      Data(Temperature,finalEC,ph);
      
     screen1(finalEC,ph,Temperature);
    ...
    Read more »