Arduino - Water Sensor Pump
In this tutorial, we will learn how to use an Arduino to activate a pump for draining water when it is detected by a water sensor. In other words, we will be discovering how to create an automatic drainage system using an Arduino, a water sensor, and a pump
Or you can buy the following sensor kit:
|1||×||DIYables Sensor Kit 30 types, 69 units|
About Water Sensor and Pump
If you do not know about water sensor and pump (pinout, how it works, how to program ...), learn about them in the following tutorials:
How the Automatic Drainage System Works
Arduino periodically reads the value from the water sensor, then:
- If the value is greater than a pre-defined threshold, Arduino turns on the relay to activate the pump.
- Otherwise, Arduino turns off the pump.
This image is created using Fritzing. Click to enlarge image
- Connect Arduino to PC via USB cable
- Open Arduino IDE, select the right board and port
- Copy the above code and open with Arduino IDE
- Click Upload button on Arduino IDE to upload code to Arduino
- Embed the water sensor into the water
- See the pump's state
Read the line-by-line explanation in comment lines of source code!
We are considering to make the video tutorials. If you think the video tutorials are essential, please subscribe to our YouTube channel to give us motivation for making the videos.