DIY Aeroponics Arduino Timing

Hello, I have made this post before but I guess it was deleted because I was not actively updating it? I will try to make a better post this time:

parts:

Arduino Uno (or any of these: http://arduino.cc/en/Main/Hardware)
Arduino relay: http://www.google.com/search?hl=en&tbm=shop&q=arduino+relay&oq=arduino+relay&aq=f&aqi=g3&aql=&gs_l=products-cc.3..0l3.6838.8854.0.9190.13.6.0.7.7.0.63.322.6.6.0...0.0.
USB Cable for the arduino
Computer/Laptop: (to program the arduino)
12V to 5V DC step down converter: http://www.google.com/search?hl=en&tbm=shop&q=arduino+relay&oq=arduino+relay&aq=f&aqi=g3&aql=&gs_l=products-cc.3..0l3.6838.8854.0.9190.13.6.0.7.7.0.63.322.6.6.0...0.0.#hl=en&tbm=shop&sclient=psy-ab&q=12v+5v+step+down+dc&oq=12v+5v+step+down+dc&aq=f&aqi=&aql=&gs_l=serp.3...108401.108401.0.108699.1.1.0.0.0.0.64.64.1.1.0...0.0.1DrI6DfB_0U&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&fp=c98cb5f7c30965f0&biw=1159&bih=791
12V trickle charger: used to power the system even when power is off.
12v 8mAh battery
12v solenoid valve: http://stores.ebay.com/valves4projects


1. Download and install the arduino software onto your computer: http://arduino.cc/en/Main/Software

2. Connect the 12v trickle charger to the 12v battery. The battery will supply power to the 12v to 5v DC DC converter and also supply power to the 12v solenoid valves.

set up diagram:Untitleddrawing.jpg

3. Program your arduino using the code below. the // means that it is a comment and will not be used by the program.
Code:
unsigned char relayPin[12] = {4,5,6,7};//Remainining pins: (22,23,24,25,26,27,28,29}; // Define the led's pin


//initializes the function: Zone
void Zone(unsigned long on, unsigned long off, int i);




int mode[4]={LOW,LOW,LOW,LOW}; //Initilizes mode array  to LOW (OFF) Mode
unsigned long previousMillis[5]={0,0,0,0,0}; //initilizes previousMillis array
//Conversions
unsigned long Sec = 1000UL;
unsigned long Min = 60000UL;
//unsigned long Hour=60*Min;


//unsigned long daytime=43200000UL;


void setup()
{
  //Initilizes the Pins as OUTPUT going through the for loop. 
  int i;
  for(i = 0; i < 4; i++)
  {
    pinMode(relayPin[i],OUTPUT);
    digitalWrite(relayPin[i],mode[i]);
  }
}


void loop(){
  Zone(3*Min,15*Min,0);
  Zone(6000UL,900000UL,1);
  Zone(4000UL,900000UL,2);
}


/*
Zone:
Recieves: On time, Off time, and Pin Number(0-4)
Note: millis() function calls time since arduino has been on, in milliseconds (ms)
psuedocode: 
if (millis) - previlousMillis[i] is greater than (Off Time) and mode is equal to LOW
  then set previousMillis[i] to (millis), set pin mode to HIGH(ON), 
then it does it again for the ON time
*/
void Zone(unsigned long on, unsigned long off, int i){
  if (millis() - previousMillis[i]>= off && mode[i]==LOW){
    previousMillis[i]=millis();
    mode[i]=HIGH;
      digitalWrite(relayPin[i],mode[i]);
  }
  if (millis()-previousMillis[i]>= on && mode[i] == HIGH){
    previousMillis[i]=millis();
    mode[i]=LOW;
      digitalWrite(relayPin[i],mode[i]);
  }
}
5. Select the correct board, and port to upload under Arduino> Tools


You may need to change the output pins, since your arduino may be different than mines. but it is very basic and very easy to program and use. Please ask any questions. i promise to respond.
 

fatalflowers

Active Member
Great project, I didn't think the code was finished as it looked like it ended after the setup function and I couldn't see your function in use anywhere so just to check I did a copy n paste. I can now see that it's all there. Brilliant project was thinking of doing subverting very similar bit adding beyond so timing could be adjusted without policing arduino back into pc,.but now I've doing this had helped alot n the buttons can wait. Forgot to say was going to add lcd so one could see what on n off times are set.
Cheers again,
Fatalflowers.
 

Dennnmark

Member
This is awesome. I've wanted to get into arduino for a while, and combining it with this other great hobby is just awesome. It's like getting two birds stoned at once.
 

420hydro

Well-Known Member
Change the trickle charger to a solar charger and you have a stand alone control system.
Also the arduino is great for sensors like humidity and temperature.
And since you can read humidity and temperature why not go ahead and control exhaust fans, humidifiers, de-humidifiers, lights, etc.
 

Mike Young

Well-Known Member
What about ph & ppm/ec reading? My thoughts are that if you could make arduino read these things, you're a couple of solenoids away from a controller. =D Those dosing machines look expensive as hell. To be able to build one for 100 bucks or so would be fantastic. Might even find yourself on the next Massimo Banzi video.
 

Aleister93

Active Member
There are arduino ph sensor shields, I think they have them on the arduino store site? I know I saw them somewhere.
 
i'm also working on a PH+PPM controller with automatic dosing with a web interface. I need to save up some cash for ph, ec stamps + the probes, flow meter, etc.
i will upload the details when i complete that project (the parts are pretty expensive,)
I only have dosing motors so far.


I want to create a system which will automatically fill and drain the reservoir, fill with nutrients, check ph and PPM, and you can check and change everything from an iphone/android.
If anyone is interested who has a programming background, we can work on it together... let me know. i mostly need help on the web interface.


Thanks. if there is any questions, just ask.
 

Anna Marsh

New Member
Hi! I am very very new to arduino programming and was wondering how you set up your pin-board with respect to that code... do you have a photo? Thanks so much :)
 
Top