Arduino - Control Pump
In this tutorial, we are going to learn how to control a pump using Arduino. Based on this tutorial, you can make the irrigation system, aquarium, water refilling system ...
|1||×||Arduino UNO or Genuino UNO|
|1||×||USB 2.0 cable type A/B|
|1||×||12V Power Adapter|
|1||×||DC Power Jack|
|1||×||(Optional) 9V Power Adapter for Arduino|
About 12V Pump
12V Pump usually has two pins:
- Negative (-) pin (black): needs to be connected to GND of DC power supply
- Positive (+) pin (red): needs to be connected to 12V of DC power supply
How to Control Pump
If 12V pump is powered by 12V power supply, it works. To control a pump, we need to use a relay in between Arduino and pump. Arduino can control the pump via the relay. If you do not know about relay (pinout, how it works, how to program ...), learn about relay in the Arduino - Relay tutorial
This image is created using Fritzing. Click to enlarge image
The below code repeatedly turns the pump ON in five seconds and OFF in five seconds,
- 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
- See the pump's state
Read the line-by-line explanation in comment lines of 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.
- Make an automatic irrigation system using Arduino, soil moisture sensor, and pump
- Make an automatic water refilling system using Arduino, water level sensor, and pump