I sort of new to all this electronics stuff, but learning fast
So i got this project that ive been working on for a while now and basically i want my Arduino rev3 UNO to water my plants!
I plan to do this by with a digital pin wired to a transistor (2n2222) that will switch a 5v relay powering up a submersible pump.
Thats all fine and dandy, but, submersible pumps are notorious for dying if the water level gets too low. So... i need a water level sensor.
My first idea was just sticking 2 wires into a cup of water. One is connected to ground while the other is connected to an analog pin.
i wrote the following code to get a reading:
int waterpin = 5;
water = analogRead(waterpin);
if(water < 100.00)
Serial.println("water level OK");
The values im getting from this "sensor" are a bit erratic, i put a 1K resistor in line with the positive side of the circuit and that seems to have calmed it down a bit.
When the two wires are submerged in water the reading is close to 0, so i put that if the reading is below 100 the water level is OK, if the wires are out of the water the reading jumps to 1023, meaning that the water level is not OK.
Most of the time its pretty good, but there are still fluctuations in the reading, it just randomly drops down, sometimes to 0 and then goes back again, messing with my plans
Any ideas what i could do to make this more reliable?
Any help is most welcome!