As we know that storing water into a storage tank is a way to save energy and the pump’s life than the pump turn on every time when we open the water tap.

In this project we show how to use simple way to switch on the pump automatically to fill the water tank when the water in the tank reaches the minimum limit, then the pump will turn off automatically when the water in the tank reaches the maximum limit.

The similar thing you can see on https://arduinoproyek.wordpress.com/2019/05/15/water-level-controlled-by-ip67-sensor/

or better thing on https://arduinoproyek.wordpress.com/auto-switch-water-pump-by-sensor-mpx5010dp/

Water pump auto switch

#define led 11 //this pin for drive relay

void setup() {


pinMode(led, OUTPUT);


void loop() {

int sensorValue0 = analogRead(A0);

int sensorValue1 = analogRead(A1);

if (sensorValue0 <= 500) {

digitalWrite(led, LOW);//this output go to relay IN


if (sensorValue1 >= 500) {

digitalWrite(led, HIGH);



Serial.print(” “);




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s