I would like to control a water pump so that if the water level in my bucket reaches a specified level, the pump starts sucking the water out of the bucket, and it keeps doing it until the water level reaches the bottom of the sensor. Then the pump should turn off. (Loop)
My water pump is an external (non-arduino) 5V component.
Using a couple of simple float liquid level sensors I have controlled the water level in a tank with an Arduino - switching pump on when lower sensor indicates no water switching pump off when upper sensor indicates water present
Would it be possible you think? I have found a Video on how to programmatically detect the water level with the sensor. However I have no idea how to turn on or off the pump inside the if - statements and where to plug in the pump.
I'm a bit concerned that this sensor will reliably signal "off" when the water level has fallen below it. Any drops of water, or a film of water, sticking to it might continue to be detected as "wet", don't you think?
The type used by @horace looks far more reliable to me.
Show us the code that you've got. Open it up in the Arduino IDE, press Ctrl+T to auto-format it, then use the menu: Edit | Copy for Forum. Paste it into your message.
In principle all you do is set one of the Arduino pins to an output, and connect a relay board to it (the type with a driver transistor for each relay). Then connect the pump via the relay contacts to a separate power supply (but with common grounds).
I would like to control a water pump so that if the water level in my bucket reaches a specified level, the pump starts sucking the water out of the bucket, and it keeps doing it until the water level reaches the bottom of the sensor. Then the pump should turn off. (Loop)
"I think @waminox did imply that in his first post. "
OP: until the water level reaches the bottom of the sensor. Then the pump should turn off.
The sensor is for measuring collected rainfall which is done in shallow "Buckets".......
we've had DIY rainfall projects here.
A bog standard industrial method is a couple of float switches and a couple of relays.
The relays are wired in what's called a "hold-on" configuration.
You can do the same with CMOS logic chips or simply do the equivalent in code for the Arduino with some states and digital inputs.