Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: Ph meter code check please on: April 06, 2011, 08:24:13 am
Thank you very much. I will go though and replace these things brought up. I need to be told these things other wise I will continue to fail. You can call me a moron if you keep giving me good advice  smiley.Thank you for your help and assistance. You get a shiny gold star  smiley

Thanks again
2  Using Arduino / Programming Questions / Ph meter code check please on: April 06, 2011, 04:05:51 am
Hi guys

I have searched this forum with lots of different terms relating to my project and found lots of helpful info. But no answers directly to my questions. I have seen hydro/grow/reef/aquarium controllers but none seen to be be what I am looking for/ don't get completed. I have read a few  books on the arduino and my mind goes off on tangents of what I can control. This arduino stuff is pretty cool as I am sure you are aware.

I am doing a hydroponic project (yes another one). I would like to make this project as cheap as possible. So that means making stuff myself. First I want to control ph. In hydroponics ph nutrient lockout is a major factor for healthy plants. If they do not get the right ph the plants will not take in the right nutrients. I will add other things to this project but baby steps for the first one.

What I am trying to accomplish is have an analogue input of a ph meter/probe. I plan on building this ph meter which is 12v and use a voltage divider http://blea.ch/wiki/index.php/PH_Meter . From that number (voltage) turn on a pump to dose a ph solution into the main tank of water/nutrient to receive the desired ph in the tank. I will fiddle with the values of the ph meter (0-1023) and the seconds on (delay) when I have the ph meter completed, also the pin numbers might not be correct. I have tried to apply the principals of KISS (keep it simple stupid). I need some of you geniuses to read and hopefully correct my code.

One quick question, I have read that after 9 hours and 32 min or something like that the arduino resets its self. I also read this has been fixed in version 15. can someone confirm or deny this.

Thanks in advance. FYI this is my first project on the arduino and also my first code for many years so I am a noob. Question are in the comments.

Code:
int phprobe = 1; //phprobe connected to pin 1
#define phpump = 3; //ph pump connected to pin 3 (should I use #define??)
int value; //value for reading. Do I need this???

void setup ()
{
pinmode(phprobe, INPUT); //sets ph probe as input
pinmode(phpump, OUTPUT); //sets ph pump as output
}

void loop()
{
{
int val = analogRead(phprobe, high); //read ph probe ON
int inputvariable = 0; //do i need this??
if (inputvariable <#); //variable more than number 0-1023(i dont know this # yet)
{
analogWrite(phpump, high); //turn ph pump on
delay (5000); //delay for 5 sec
analogWrite(phpump, low); //turn ph pump off
}
if else (inputvarible >#); //if varible is below ^
{
analogWrite(phpump, high); //turn ph pump on
delay (1000); //delay for 1 sec
analogWrite(phpump, low); //turn ph pump off
}
delay(300000) /delay 5 min before remeasuring. is there a better way???
}

After this I plan on a EC or Ppm meter/dosing section of code. I hope to put my competed project on here including code but that might be a bit of time.

Thanks again.
Pages: [1]