Pages: 1 ... 7 8 [9]   Go Down
Author Topic: Billie's Hydroponic Controller  (Read 73153 times)
0 Members and 3 Guests are viewing this topic.
Offline Offline
God Member
*****
Karma: 13
Posts: 580
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you hane a picture, my valves use
NPT sizes.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

These are the Valves I ordered from Ebay,  They  have male 1/2"-14 tpi  straight thread fittings.


* valve.JPG (29.22 KB, 400x400 - viewed 72 times.)
Logged

0
Offline Offline
Newbie
*
Karma: 1
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I've decided to build this Hydroponic Controller. I've already ordered many parts but I have one question : what is the use of this valve (Pressure Solar Water Heater Dedicated 12V Solenoid Valve) ? This project seems to be very nice.

Thank you very much
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@ lolocaledo
Hello- To answer your question directly, the solenoid valve is used to replenish the potable water in the hydroponic nutrient or aquaponic nutrient  tank. I am trying this valve as I have tried toilet tank valves in the past and they always fail at the worst time, or just fail and waste your money by flushing all of your nutrients out on the ground.

I too am building this project, started mine about 2 weeks ago, most of my parts are in from china and Hong Kong. Still missing a few. I attempted to build a PH controller using the practical maker arduaruim PH board a few years back. It did not work as the PH board can not be calibrated to span the PH range needed for plants. I was not aware of the Phidgets board at the time. (THANK YOU BILLIE!!)
 I grow salad greens in plastic beer cups filled with small lava chips placed in PVC pipe similar to what Billie uses.

One of the pitfalls I have found with this build  is the additional code libraries needed have various and sundry names, and some have been updated and called a different name or obsoleted . I managed to sift the pearls from the shit and now have  Billie's latest code release compiling and loading on my mega. I want to get Billie's build working first , and then later add an  EC measurement to fully automate the system.  I currently use an BlueLab Truncheon for my EC reading now.

Where on the planet are you?   .nc  North Carolina?

With kind regards,
Zatheros
« Last Edit: February 25, 2014, 07:56:56 am by zatheros7 » Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Does anyone else run into issues when connecting the tft sheild pins to the MEGA? I am trying to use less cable, and when I connect the 20 pins to their respective slots on the MEGA and screen displays the image, but the code and the screen do not work at all. Which pins are we supposed to connect to?
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a like program running on an Arduino Mega. I'm also running a 3.2 inch TTF Touch Screen on a mega v2 shield.
Mega Shield utilizes pins 5V, 3V3, GND, 2-6, 20-41, & (50-53 for SD Card) I found it still runs 100% w/o pins 20 & 21 (the v2 shield does NOT have 20 & 21 thru header pins)
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone. I am working with this too. My problems is here:

Code is the same as uploaded here, Billie's Hydroponic Controller V1.1.2b

So, i cant find working ITDB02_Touch.h anymore. At first i have working lcd and touch, but the touch was upside down?? I changed the library, to another downloaded from somewhere, and the calibration is too much at the left...

So, i tried the UTouch, and it worked pretty great, BUT.. Touch stop working, when plugged to external power supply??? Working OK when connected to computer, until reboot with ext power...

Anyway, the touch works with the ''right''  ITDB02_Touch.h, but upside down.. Work with external power too smiley

Anyway, how i can calibrate this display?
Can i use Utouch someway?

Sorry about being noob, bought my first arduino about two months ago.. smiley and sorry about my bad English.. smiley-grin
1st post at the forum , jihaa!
« Last Edit: March 13, 2014, 05:55:32 pm by Leinonen » Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey Billie, I am interested in regarding hydroponic system. On the controller to add the EC (PPM) probe and Dosage for fertilizer. Interests elsewhere to get the cheapest material to the matter up and run.
Greetings!
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just wanted to say thanks for all the great info. I'm still turning on LED lights so I am far from understanding all of the code. However I have been growing in hydroponics for ten years and understand what I want to automate and how to do it. (just not how to write yet). What a great thread you have going here. What a great start for anyone looking to automate. I know it's time consuming answering all of these questions so just wanted to say thanks. Not a lot of people are willing to keep up with all the questions so it's great to see your willingness to spread the knowledge. An idea I had for nutrient mixing etc is to mix nutes in a different reservoir and then have a pump from there to your current reservoir. You could then set your floats to activate the pump in the nute reservoir. You could set the program to add from nutes reservoir if ec of the nutes reservoir is proper level else fill from plain water or whatever you currently do. I know I like to add in plain water for a couple top offs and then do half strength nutrients until I change the reservoir out so that could also be programmed as well.

In your new nutrient reservoir you could even have a separate controller if needed and setup similar to your ph method with a delay after a certain amount of nutrients are added in order to assure your reading is valid. If you using a 2 part nutrient you could set it up to add part A until ec is met then add part B in same fashion. Just my .02

Also would any of these TDS sensors work with arduino? http://webpages.charter.net/tdsmeter/products.html

Looking forward to learning more. Thanks again for all of the contributions from everyone.
« Last Edit: March 30, 2014, 06:30:02 pm by MiracleDro » Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Billie,

Are you still there??
Logged

The Great MidWest, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey DX,

Thanks for your kind reply!! The purpose of this project was to create a low budget, open-source controller which could be used all over the world so people could improve their crop yield and have more money to spend on other things other then food...
Though this project is still in it's infancy I hope one day it will be used by many people.
And off course I'm interested to see your code so you'll soon get a pm from me smiley-grin
The screen shots from your web interface look very promising, though implementing CO2 wasn't initially in my plan. I looked it up for some idea's about it and one could build a CO2 generator for a very low budget...So thanks for pointing this out to me smiley-wink
Will be looking out for some cheap CO2 sensors out there...

With kind regards,

Billie


Hey Billy -Had not logged on for a while & didn't see your post & message.
I'll past the code to control CO2 using an analog source or 0-5vdc >>my monitor actually is 0-4vdc = 0-2000ppm but that's OK. There are a lot of off-the-shelf CO2 sensor/monitors made for the HVAC industry with o-10VDC output so a simple voltage divider circuit would do the trick (use 1% resistors & a mathched pair to get 0-5vdc & then change the arduino code for 0-5v or whatever.
The monitors I am using are made by a company called PureChoice -they contain a Telaire 6004 CO2 module >>and a Senserion SHT15 temp/RH sensor. Both the Telaire and Senserion sensors are the best of the best at their price level.  Too bad PureChoice went out of business because they had some great products -although good for me because I was able to buy the NOSE monitors on the cheap (less than the cost of the sensors! --and less than the price of the crappy no-name sensor I saw that some guy in another post bought from futurlec (or something like that).
Anyway, back to the sensor. Here is the NOSE unit http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=231088338207 -And
The NOSE has the Telaire & Senserion sensors & uses a Freescale Coldfire MCF5329 processor, running uCLinux with 256MB SDRAM & 128MB Flash memory, external LAN USB controller >which is strange because there are no USB ports -plus the processor has multiple USB ports and an onboard LAN controller -They really overkilled everything. There is also a SVGA LCD controller onboard but it's driving a 8x2 LCD!  There is a webserver so you can view the temp/RH/CO2 via the web as well as a lot of other data about the device status (mostly there to communicate with PureChoice servers that no longer exist -So every once in a while you get this "NO HTTPS" message.
I'm working on logging software with notifications if the temp/rh or co2 get out of whack (sms & email) but for now I just have remote view and graphing -which will keep logging as long as the host computer is running >can be remote computer, I'm currently loggin a couple local NOSE monitors & another in Canada.


Here is the CO2 control code. I don't use bottled CO2 so "fuzzy logic" (PID) control was not something I was concerned with but might be something to add later...
There is also some lines for LCD control that I don't use because the NOSE has its own display -but if you are using another CO2 sensor you might want an LCD display.

Looking at the code, I can say that it definitely can use some cleaning up!
But hopefully you or somebody else will find it useful!

code in next message (this post is too large)
*******************************************************************************************



Logged

DX

The Great MidWest, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


// CO2 Controller for NOSE Monitor
// Feel free to distribute all or part of work but leave reference to www.dxhydro.com and monitor.dxhydro.com
// push button connect to GND and to PUSH_BUTTON_PIN
// SPDT switch connect center to GND, other switch pins to MODE_1_PIN and MODE_2_PIN

// if need pins D0 and D1 then remove all rows that contain 'Serial'

//!!!!!!!!!!!!!!!!!!
//BEFORE UPLOAD SET 'USING_PUSH_BUTTON' DEFINITION
//default is for a pushbutton to scroll from 1200, 1300 & 1450 or whatever you enter for setting values.
//A ON-OFF-ON toggle can also be used. If more level options are desired, they could be added to the code.
//Three was enough for me & If I want to go with a higher or lower set point, I'll change the code.
//!!!!!!!!!!!!!!!!!!

#define USING_PUSH_BUTTON 1   // 1 - push button 0 - SPDT switch

// pins

#define CO2_PIN A6
#define LIGHT_PIN A7

#define RELAY_PIN 12

// push button  start
#define PUSH_BUTTON_PIN 2  // for push button only pin 2 !!!
#define PUSH_BUTTON_SELECTOR_PIN 5
#define buttonInterrupt 0
// push button  end

// SPDT switch  start
#define MODE_1_PIN 2
#define MODE_2_PIN 5
// SPDT switch  end


#define OVVERIDE_LIGHT_PIN 3
#define MAY_OVVERIDE_PIN 4

#define L1600_PIN 10
#define L1400_PIN 8
#define L1250_PIN 6

// sensors constant
#define CO2_LEVEL_TRESHOLD 200   // 200ppm
#define CO2_BAD_LEVEL 320  // 300 ppm If reading is below 350, there is a problem with the sensor & CO2 relay will turn OFF

#define LIGHT_HIGH_LEVEL  256 //if light sensor > 300 (0-5V == 0-1023  1.5v=~300  1023*1.5/5=~300)then light is on else off
// might need to tweek this number a bit, depending on the photocell -you can bypass this input too

#define DEFAULT_CO2_MAX_LEVEL 1600    // OLD WAS 1300


// EEPROM
#define BUTTON_COUNT_ADDR 0  //address in internal EEPROM for store CO2 max level when using push button

// LIBS
#include <EEPROM.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
//Libs for I2C LCD

LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27  CHANGED TO 0x21

int maxLevelsCount=3;
int maxLevels[] = {1600,1400,1250};

boolean waitForMax=true;

boolean isPushButton=false;
int buttonCount=0; // ->maxLevels[0] == 1600
boolean buttonChange=false;


void prepareSwitchPins(int pin1, int pin2){
  pinMode(pin1, INPUT);
  pinMode(pin2, INPUT);
  digitalWrite(pin1, HIGH);
  digitalWrite(pin2, HIGH);
}

void detectLevelSelectorType(){
 
  isPushButton=USING_PUSH_BUTTON==1;
  
  /*
  prepareSwitchPins(PUSH_BUTTON_PIN, PUSH_BUTTON_SELECTOR_PIN);
  isPushButton=digitalRead(PUSH_BUTTON_PIN)==HIGH && digitalRead(PUSH_BUTTON_SELECTOR_PIN)==HIGH;
  */
}

void setupPushButton(){
  prepareSwitchPins(PUSH_BUTTON_PIN, PUSH_BUTTON_SELECTOR_PIN);
  
  attachInterrupt(buttonInterrupt, Rise, RISING);
}

void setupSPDTSwitch(){
  prepareSwitchPins(MODE_1_PIN, MODE_2_PIN);
}

void setPinsMode(){
  pinMode(RELAY_PIN, OUTPUT);
  
  pinMode(L1600_PIN, OUTPUT);
  pinMode(L1400_PIN, OUTPUT);
  pinMode(L1250_PIN, OUTPUT);
  
  pinMode(OVVERIDE_LIGHT_PIN, INPUT);
  pinMode(MAY_OVVERIDE_PIN, INPUT);
}

int getCO2Level(){
  byte i=0;
  long s=0;
  while(i<10){
    s+=analogRead(CO2_PIN);
    i++;
  }
  int a=s/10;
  if(a>820){a=820;} // 4 volts its 820 from analogRead (1024/5 * 4 = 820)   5 -> max volts that read arduino
  int res=map(a, 0, 820, 0, 2000);  // 0 - 4  volts ->  0 - 2000 ppm
  return res;
}

int getLightLevel(){
  byte i=0;
  long s=0;
  while(i<10){
    s+=analogRead(LIGHT_PIN);
    i++;
  }
  int a=s/10;
  return a;
}


int getCO2MaxLevel(){
  if(isPushButton){
    return maxLevels[buttonCount];
  }else{
    int m1=digitalRead(MODE_1_PIN);
    int m2=digitalRead(MODE_2_PIN);
    
    int res=DEFAULT_CO2_MAX_LEVEL;
    
    if(m1==HIGH && m2==HIGH){res=maxLevels[1];} //1400
    if(m1==LOW && m2==HIGH){res=maxLevels[0];} //1250?
    if(m1==HIGH && m2==LOW){res=maxLevels[2];} //1600?
    
    return res;
  }
}

// 0 - OK may switch on relay  1 - light sensor <300  -1 - CO2 sensor failure
int getMaySwitchOnRelay(){
  int co2_level=getCO2Level();
  if(co2_level>CO2_BAD_LEVEL){
    int light_level=getLightLevel();
    int may_ovveride=digitalRead(MAY_OVVERIDE_PIN);
    int light_ovveride=digitalRead(OVVERIDE_LIGHT_PIN);
    if(may_ovveride==HIGH){
      return light_ovveride==HIGH?0:1;
    }else{
      return light_level>LIGHT_HIGH_LEVEL?0:1;
    }
  }else return -1;
}

//state - true then ON relay else Off relay
void switchRelay(boolean state){
  if(state){
    digitalWrite(RELAY_PIN, HIGH);
    
    //lcd
     lcd.setCursor(0, 0);
     lcd.print("CO2 ACTIVE");
    //lcd
    
  }else{
    digitalWrite(RELAY_PIN, LOW);
    
        //lcd    
      lcd.setCursor(0, 0);
     lcd.print("CO2 OFF   ");
    //lcd
  }
}

void switchOffAllLevelLeds(){
  digitalWrite(L1600_PIN,LOW);
  digitalWrite(L1400_PIN,LOW);
  digitalWrite(L1250_PIN,LOW);
}

void showLevelLed(){
  switchOffAllLevelLeds();
  int maxLevel=getCO2MaxLevel();
  if(maxLevel==1600){digitalWrite(L1600_PIN,HIGH);}
  if(maxLevel==1400){digitalWrite(L1400_PIN,HIGH);}
  if(maxLevel==1250){digitalWrite(L1250_PIN,HIGH);}
}



void setup(){
  Serial.begin(9600);
  
  //LCD
    lcd.init(); // initialize the lcd
  lcd.backlight();
  //LCD
  
  detectLevelSelectorType();
  
  buttonCount=EEPROM.read(BUTTON_COUNT_ADDR);
  if(buttonCount>=maxLevelsCount){buttonCount=0; buttonChange=true;} //reset if EEPROM is clear
  
  if(isPushButton){
    setupPushButton();
    Serial.println("PUSH BUTTON");
  }else{
    setupSPDTSwitch();
    Serial.println("SPDT SWITCH");
  }

  setPinsMode();
}


void loop() {

  showLevelLed();
  
  if(buttonChange){
    buttonChange=false;
    Serial.print("Change CO2 level to:");
    Serial.println(getCO2MaxLevel());
    EEPROM.write(BUTTON_COUNT_ADDR, buttonCount);
  }

  
  int sres=getMaySwitchOnRelay();
  if(sres==0){
    
    //getting co2 level
    int co2max=getCO2MaxLevel();
    int co2min=co2max-CO2_LEVEL_TRESHOLD;
    int co2level=getCO2Level();
    
    Serial.print("CO2: ");
    Serial.print(co2level);
    //LCD
    

    //LCD
    
    Serial.print(" max level:");
    Serial.println(co2max);
    //LCD
    lcd.setCursor(0, 1);
        lcd.print("Set Point: ");
    lcd.print(co2max);
    //LCD
    
    // condition for switch relay
    if(co2level>co2max){
      switchRelay(false);
      waitForMax=false;
    }else{
      if(co2level<co2min){
        switchRelay(true);
        waitForMax=true;
      }else{
        if(waitForMax){
          switchRelay(true);
        }
      }
    }
  }else{
    switchRelay(false);
    
    if(sres==-1){Serial.println("CO2 sensor failure!");}
    if(sres==1){Serial.println("Not enough light!");}
  }
  delay(500);
}



//debounce push button logic

volatile int buttonState = LOW; //initial button state
volatile long lastDebounceTime = 0;   // the last time the interrupt was triggered
long debounceDelay = 30;    // the debounce time; decrease if quick button presses are ignored

void Rise()
{
  long currentTime = millis();
  if ((currentTime - lastDebounceTime) > debounceDelay)
  {
    lastDebounceTime = currentTime;
    if (buttonState == LOW)
    {
      buttonState = HIGH;
      attachInterrupt(buttonInterrupt, Fall, FALLING);
    }
    Switch();
  }
}

void Fall()
{
  long currentTime = millis();
  if ((currentTime - lastDebounceTime) > debounceDelay)
  {
    lastDebounceTime = currentTime;
    if (buttonState == HIGH)
    {
      buttonState = LOW;
      attachInterrupt(buttonInterrupt, Rise, RISING);
    }
  }
}

void Switch()
{
  buttonCount++;
  if(buttonCount>(maxLevelsCount-1)){buttonCount=0;}
  buttonChange=true;
}

Logged

DX

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


To those still having issues with the Greenhouse controller touchscreen, here is how I setup mine

Running on mega2560
SainSmart 3.2 touchscreen with the adapter board. Kit C97

I made three ribbon cables to go between the adapter and the mega and plugged them in as if plugged directly.
               I now have access to those missing pins smiley

Do a global search and replace for the ITDB02_Touch  and make it Utouch

Do not downgrade gcc.
 
The X axis is the problem with the system regardless of ITDB02_Touch or Utouch

The Y axis is fine, the scaling is fine.

X reads Right to Left NOT Left to right as it should.
Someone can probably tell me which two wires to swap for that to work normally
      but cant be fixed if you are plugged in directly to the mega smiley-sad

So you have about a dozen simple edits:

Find every         if ((x>=207) && (x<=307))
                                  These numbers can be ANY number

aka:                       if ((x>=LeftSideasZeroValue) && (x<=RightSideasZeroValue))
                   
And we need:    if ((x>=RightSideasZeroValue) && (x<=LeftSideasZeroValue))
                     
Subtract each number from 312 and put the new values back but reverse them


                                  if ((x>=207) && (x<=307))   becomes    if ((x>=5) && (x<=105))

Have fun.












Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

is there an easy way to run this on the yun without lcd/tft but with website controls/monitor?
Logged

Belgium
Offline Offline
Jr. Member
**
Karma: 11
Posts: 94
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey Everyone,

Long time since I've been on the forum...Great to see that this thread has taken off so nice!! smiley
I'm currently busy on a few projects with Arduino - 3D printer, A domatica system for the garden and...A new version of the Hydroponic Controller. This last one will be upgraded so that one can also measure/control the EC value of the nutrient tank.
Also will be trying to incorporate the ethernetshield so it can output data to Cosm (or what it's called today smiley-wink ) if there is enough room for it. I'm currently using the Aduariumshield from Practical Maker as hardware since this shield has got everything we need for this project. Only an Ethernetshield and TFT screen need to be added.
When I'm ready for it I will put the documentation for this project online and you'll all be able to enjoy this upgrade smiley-wink


I just wanted to ask... Have you tried to use the integrated SD card slot on the rear side of the LCD/TFT panel?
When I use the adjustable shield directly on top of the Mega, it works, but with the (8-bit) wiring like in your picture and adding MISO, SCK, CS(SS) and MOSI  to pins 50,52,53,51 (and shield's 16,17,35,34)  I have no luck so far. I am not sure which other pins I should connect or if it is at all possible. I do not know if you are using the break-out SD module for convenience or if you have ran into problems also.
The integrated SD reader from that specific TFT screen wasn't functioning. The seller on Ebay admitted this after a long time communicating about it... So I had to use an external one.


Hello Billie,

Are you still there??
Yes I am, but have been doing some other stuff. smiley


is there an easy way to run this on the yun without lcd/tft but with website controls/monitor?
I don't have a Yun so I can't say...


Greetings Billie
Logged

Pages: 1 ... 7 8 [9]   Go Up
Jump to: