Pages: 1 ... 4 5 [6] 7 8   Go Down
Author Topic: Potted plant watering system. (Involves water pumps.)  (Read 8171 times)
0 Members and 1 Guest are viewing this topic.
Oz
Offline Offline
God Member
*****
Karma: 3
Posts: 659
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, I saw something.

When I am looking at the sensors, as I am "directly" looking at them by pin number, I realised I am using the "wrong" pins.
LED 5 is looking at Pin 13.  That's the onboard LED.

That isn't going to work.

Ok, so That is one problem detected.  I shall have to change the assigned pins to the analogue inputs.
Though that is going to be a problem as I need 6 inputs and two of the 6 analogue inputs are the I2C bus on which the RTC is going to live.

Hmmmmm...   But anyway.

That aside, I see I can't use the pins listed in the sketch.  BUT - and isn't there always one of them? - even if I negate the reading of the sensor pins for LED 5, it still doesn't glow.

Logged

Oz
Offline Offline
God Member
*****
Karma: 3
Posts: 659
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

After even more head bashing this is what I have learned:

(It seems my posting the sketch is not appreciated, so I won't.)

I shall put the names of the functions in capitols only for effect.

I put a couple of lines in the SETUP() to turn the LED 5 on/off and it works.
That is on Pin 12.
SecondLED is pin 1 - just to let you know now.

Then it goes into the LOOP()
And from there straight into the SOLENOID() function.

On loading the LED 5 blinked.  So all was good.

I then copied the lines from the SETUP() to the SOLENOID() function, but put it after the LED_CONTROL(1) call.
This just turns on another LED indicating the loop is running.

Uploaded it and LED 5 blinked only once.  The "main" LED turned on indicating the loop was running and the other LEDs blinked as per normal, but 5 didn't.

For what ever reason, I copied the lines and put them BEFORE the LED_CONTROL(1) call and uploaded.

Lo and behold, LED 5 blinked TWICE when the sketch was loaded.

Then I copied them again and put them AFTER the LED_CONTROL(1) call.

LED 5 still only blinked twice, not three times.

The only "difference was the positioning of the lines before the LED_CONTROL(1) call.

So, I remarked out that line.

Now excluding the blinking at the start, LED 5 works as per the others.

So, to me:  LED_CONTROL(1) is causing the problem.
All that does is get the (1) which is sent, and depending if it is 1 or 0, turns the LED on or off.
So to "test" what is going on, I simply put
digitalWrite(SecondLED,HIGH);
where the LED_CONTROL(1) call was.

LED 5 doesn't work.
How would doing a "digitalWrite(1,HIGH);" prevent a "digitalWrite(12,HIGH);" from working?

« Last Edit: July 21, 2012, 07:23:02 pm by lost_and_confused » Logged

Oz
Offline Offline
God Member
*****
Karma: 3
Posts: 659
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The definitive bit of code:

This kind of proves my problem and the WHY is beyond me.

There are 6 LEDs in total.  1 - 5 for the loop and a "loop running" LED.

Code:
#define LED 8

void setup()
{
    int i;
    for (i=0;i<5;i++)
    {
        pinMode(LED+i,OUTPUT);
        digitalWrite(LED+i,LOW);
    }
    pinMode(1,OUTPUT);
    digitalWrite(1,LOW);
}
void loop()
{
    while(1)
    {
        int i;
        //digitalWrite(1,HIGH);            //  With this line active, LED 5 doesn't glow.
        for (i=0;i<5;i++)
        {
            digitalWrite(LED+i,HIGH);
            delay(500);
            digitalWrite(LED+i+1,HIGH);
            digitalWrite(LED+i,LOW);
            delay(500);
        }
    }
}

I don't know if I can put it any better than the above sketch.

Oh, and please don't pick the "there is not a # 5 LED defined in the loop".
There are 5 leds in the loop.  1 to 4 glow.  5 doesn't with the line un-commented.
But with the line commented out, # 5 does glow.
« Last Edit: July 21, 2012, 07:49:47 pm by lost_and_confused » Logged

UK
Offline Offline
Shannon Member
****
Karma: 183
Posts: 11154
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You're connecting LEDs to the serial pins?
Logged

I only provide help via the forum - please do not contact me for private consultancy.

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8911
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
This kind of proves my problem and the WHY is beyond me.

After almost 80 post to help you solve your problem without success, it appears you have attempted something that is currently beyond your capabilities. I suggest you start out new with a simple part of your project and get it working, then attempt to move to the next part.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Offline Offline
Full Member
***
Karma: 0
Posts: 162
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd like to take a crack.
Code:
void loop()
{
        int i;
        //digitalWrite(1,HIGH);            //  With this line active, LED 5 doesn't glow.
        for (i=0;i<5;i++)
        {
            digitalWrite(LED+i,HIGH);
            delay(500);
            digitalWrite(LED+i,LOW);
            delay(500);
        }
        //digitalWrite(1,LOW);            //  With this line active, LED 5 doesn't glow.
        delay(2000);                       //   Just a longer delay to simulate the long time between waterings.  For now
}

Notes:
1.  You don't need the while(1) loop.  Your loop() already is the infinite loop.
2.  I think the LED+i+1  line was accidentally left in.
3.  LED 5 should get turned off after the watering sequence.  I put a 2 sec delay in so you could see what I think you mean,
that LED 5 indicates that a watering cycle is in progress.

Post if this doesn't do what you want.
Good luck.  Keep plugging.
By the way, I water my house plants with a 20 ft coiled thin hose connected with a valve under the sink.
I think gravity will not be forceful enough.  I give each houseplant 12 sec twice a week.
You can cannibalize a cheap battery operated faucet connected sprinkler timer to get the solenoid already connected to valve that can
switch water under presure.
(Ex.   http://www.amazon.com/Orbit-Hose-Watering-Timer-62024/dp/B0013I2MLS/ref=lh_ni_t  
If you need a bunch of them though, it starts to add up.  You don't really ruin it.  If you set it to On, remove the battery(s), and bring out two wires for power then when you provide power, via a digital out, you get a strong flow of water.  I have a similar one.  They're geared; the turn on/off is not instant but takes about a second.)
« Last Edit: July 22, 2012, 10:46:11 am by Techylah » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 46026
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
void loop()
{
    while(1)
    {
Why are you putting an infinite loop inside an infinite loop?
Logged

Oz
Offline Offline
God Member
*****
Karma: 3
Posts: 659
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Paul,

That was a mistake on my part I admit.

Originally it was triggered by a pin going low and causing the LEDs to cycle once.

Just with me cutting it back, and back and back, I made a mistake.

Techylab,
Thanks very much.
You do seem to have the idea of what I am wanting to do.
Yes, you are correct, the +1 bit was an artifact from other trials.
I'll give it a go when I get home.
As a further note:  I have tried other pins for LED 5 and have the same result to a degree.
Explaination:
From what I remember (sorry if that sounds lame, so much has happened since then) if I use a different PIN for LED 5, different LEDs don't glow.
After several attempts, I just gave up on that and went on to the next "problem".
Logged

0
Offline Offline
Sr. Member
****
Karma: 3
Posts: 268
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Probably late to the party here and somewhat irrelevant unless you can get the code working but I happened to run across this on ebay while I was looking for cheap arduinos.  Perhaps it could be useful to you.

http://www.ebay.com/itm/Moisture-Sensor-For-Arduino-urban-garden-tool-Arduino-Compatible-/150845999918?pt=LH_DefaultDomain_0&hash=item231f1f4b2e
Logged

Arduino Uno;
Mega328

Oz
Offline Offline
God Member
*****
Karma: 3
Posts: 659
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dunno if I should put it here or ask in the "design" section but here goes:

Folks "I have a problem".

The analogue inputs.

2 are the I2C bus and so they will be used.

That leaves only ......  3?

I need 6.

One way or the other I will have to switch the remaining/some inputs between sensors.

I guess I could use 2.  1 for the "reserve level" from which the water is taken and one which is switched between the 5 different inputs.

That could work.  Note:  COULD.  As it is I have 5 big relays on the board to drive the solenoids.  Though they are 2 pole change over, the second one is being used to drive the pump's motor.

I'm thinking/guessing I could use something like 2 x 4016/4066 (yeah I know:  CMOS, but as an EXAMPLE) switches and switch the input as needed.

My question/concern is:   Is there a TTL equvilant?  Could I use the CMOS chips if there isn't one?
Anyone done anything like this before?

I know I would need "de-bounce" on the inputs, or a delay before I read them after they changed inputs.  But other than that.....???

Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 162
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, Oz,
I'm sure you realize that analog inputs don't get de-bounced (that's why you used quotes and mentioned a delay).

What are you planning on using for the input sensors?
The "reserve" looks like it could be digital one, like a float switch in the reservoir.

For the diy moisture sensors, I'm thinking you'r looking at something like:
http://makeprojects.com/Project/Garduino-Geek-Gardening/62/1#.UEogRqNvB8E

Instead of the 4016 or 4066 you could use a single MAX4617, which has 8 channels.
I think you should play with the sensor first, i.e. a pair of galvanized nails and a cheap voltmeter.
Perhaps a 1 Megohm (or more) resistor to ground on the "input" nail, the one not connected to the voltage source.
Then, when you're confident that a certain low enough voltage, as measured on the meter, corresponds with the dryness you want,
you can add one or two analog switches, and use a single Arduino analog input instead of the meter.

By the way, I think it's way cool, and considerate of the plants, to water each one when, and only when, IT needs water.
Most everybody makes do with a single time schedule for all the plants!
Good luck!.  Mitch
Logged

Oz
Offline Offline
God Member
*****
Karma: 3
Posts: 659
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

G'day.

Yeah, the two nails are the way I am wanting to go.

Something along the lines of what you said.  Probably a transistor with bias and the nails only to detect water level placed on the side of the pot which is sitting in a saucer.

Thanks for the chip and that.  Shall look into it.

P.S.
That link doesn't work.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 183
Posts: 11154
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, the two nails are the way I am wanting to go.

I'm using a couple of stainless steel cooking skewers about 15cm long as moisture sensors, just pushed into the soil. They're mounted in a chop block electrical connector to keep them parallel and this also gives a convenient way to attach the wires. I'm using the technique of only powering the sensor when I need to take a reading, and reversing the pulse after the measurement to avoid any ionization effects. It took me a while to figure out the resistance and timing to get a consistent reading that reflects water content within the range I'm measuring, but it seems to be working OK now.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Oz
Offline Offline
God Member
*****
Karma: 3
Posts: 659
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Fair enough.

I am torn between moisture detecting and simply monitoring the water level in the saucer below the pot.

The basic idea is that "daily" at "time x" it will look at each (one at a time) level and water for n seconds or until the water level in the saucer is high enough to touch the nails.

Although the water level and moisture content are "just numbers" to compare to fixed ones, the level detection seems easier.

For now I don't have the sensors defined or anything - because I don't have the analogue input resolved - just the turn on, cycle and turn off part.

I don't even have the RTC yet.

Alas I am having a real drama getting the solenoids.

Oh and I need a separate sensor for the main reserve of water, so if it is empty, the pump and solenoids are not turned on.

Logged

New Jersey
Online Online
Faraday Member
**
Karma: 48
Posts: 3402
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As I've suggested in similar prior threads - consider raising the reservoir so that the water is gravity fed. Then you don't need a pump and there is no need to sense the water level unless you want an alarm when it's empty.
Logged

Pages: 1 ... 4 5 [6] 7 8   Go Up
Jump to: