Uploaded March 2019 | Updated September 2026, 1 week ago
Flooded basement or yard? In this video I will show you how to build a utility pump controller that senses the presence of water and is able to turn your utility pump on and back off again when the water has been drained. This will turn your pump into an automatic utility pump!
This allows you to leave the pump unattended and will only run when water is present. This will prevent the pump from running dry and tripping the thermal protection circuit available on most modern utility pumps.
To complete this project, you will need:
-120VAC relay that can be controlled with 5VDC micro-controller logic
- At least one water level sensor that operates on 5V
- Arduino or other programmable micro controller
- 120VAC to 5VDC power adapter
- Small electronic enclosure
- Cheap (and short) 3 prong extension cord
- General utility pump
For my controller, I used two water level sensors as I found it to work more reliably this way. I also used an Arduino micro controller. Below, you can find the programming code I used for my Arduino. If you use a different programmable micro controller, you may have to write your program in a different programming language.
Code:
#define OUTLET 12 //digital pin number the relay is connected to
bool check = false; //this is the pump status. False = off
void setup() {
pinMode(A4,INPUT); //I have used analog pins 4 and 5 for water sensors
pinMode(A5,INPUT);
pinMode(OUTLET,OUTPUT);
digitalWrite(OUTLET,LOW); //ensure pump is off when program starts
}
void loop() {
//first we will read the water sensors and map the values from 0 to 100
int offValue = analogRead(A5);
int offSensor = map(offValue, 0, 1023, 0, 100);
int onValue = analogRead(A4);
int onSensor = map(onValue, 0, 1023, 0, 100);
//now lets check if the water level is sufficiently high on both sensors.
//you may have to edit these values depending on the placement of your sensors.
if (onSensor ⋗ 5 && offSensor ⋗ 50 && check == false){
digitalWrite(OUTLET,HIGH); //turn the pump on
check = true;
delay(30000); //run the pump for minimum 30 seconds
}
if (offSensor ⋖ 50 && onSensor ⋖ 5 && check == true){
digitalWrite(OUTLET,LOW); //turn the pump off
check = false;
}
}
NOTE: ⋖ and ⋗ were used in this code because YouTube does not allow for the use of normal angled brackets in the video description. When using this code, please change those symbols to the regular "greater than" and "less than" angled brackets.
****************************************************************
If you enjoy and have benefited from my content and are feeling generous I would love your support! You can "buy me a coffee" here:
► paypal.com/donate/?hosted_button_id=V2T6MEFUGP73Y ☕
By supporting my channel you are encouraging me to continue with this time consuming endeavor. A lot of time goes into design work, building my projects, filming the videos, editing the videos, etc. Plus it all costs money! Your generosity goes a long way in helping me bring you better content as often as I can!
Follow me on Instagram!
► instagram.com/embraceracing 📷
If you liked this video, perhaps you will also enjoy some channels that I personally find inspiring and interesting...
DIY and MAKER:
► The Hacksmith
youtube.com/channel/UCjgpFI5dU-D1-kh9H1muoxQ
► Adam Savage Tested
youtube.com/channel/UCiDJtJKMICpb9B1qf7qjEOA
► Thomas Sanladerer
youtube.com/user/ThomasSanladerer
Car Content:
► Mighty Car Mods
youtube.com/channel/UCgJRL30YS6XFxq9Ga8W2J3A
► Drivetribe
youtube.com/channel/UChiwLDIBJrV5SxqdixMHmQA
#Arduino #DIY #Howto
Flooded basement or yard? In this video I will show you how to build a utility pump controller that senses the presence of water and is able to turn your utility pump on and back off again when the water has been drained. This will turn your pump into an automatic utility pump!
This allows you to leave the pump unattended and will only run when water is present. This will prevent the pump from running dry and tripping the thermal protection circuit available on most modern utility pumps.
To complete this project, you will need:
-120VAC relay that can be controlled with 5VDC micro-controller logic
- At least one water level sensor that operates on 5V
- Arduino or other programmable micro controller
- 120VAC to 5VDC power adapter
- Small electronic enclosure
- Cheap (and short) 3 prong extension cord
- General utility pump
For my controller, I used two water level sensors as I found it to work more reliably this way. I also used an Arduino micro controller. Below, you can find the programming code I used for my Arduino. If you use a different programmable micro controller, you may have to write your program in a different programming language.
Code:
#define OUTLET 12 //digital pin number the relay is connected to
bool check = false; //this is the pump status. False = off
void setup() {
pinMode(A4,INPUT); //I have used analog pins 4 and 5 for water sensors
pinMode(A5,INPUT);
pinMode(OUTLET,OUTPUT);
digitalWrite(OUTLET,LOW); //ensure pump is off when program starts
}
void loop() {
//first we will read the water sensors and map the values from 0 to 100
int offValue = analogRead(A5);
int offSensor = map(offValue, 0, 1023, 0, 100);
int onValue = analogRead(A4);
int onSensor = map(onValue, 0, 1023, 0, 100);
//now lets check if the water level is sufficiently high on both sensors.
//you may have to edit these values depending on the placement of your sensors.
if (onSensor ⋗ 5 && offSensor ⋗ 50 && check == false){
digitalWrite(OUTLET,HIGH); //turn the pump on
check = true;
delay(30000); //run the pump for minimum 30 seconds
}
if (offSensor ⋖ 50 && onSensor ⋖ 5 && check == true){
digitalWrite(OUTLET,LOW); //turn the pump off
check = false;
}
}
NOTE: ⋖ and ⋗ were used in this code because YouTube does not allow for the use of normal angled brackets in the video description. When using this code, please change those symbols to the regular "greater than" and "less than" angled brackets.
****************************************************************
If you enjoy and have benefited from my content and are feeling generous I would love your support! You can "buy me a coffee" here:
► paypal.com/donate/?hosted_button_id=V2T6MEFUGP73Y ☕
By supporting my channel you are encouraging me to continue with this time consuming endeavor. A lot of time goes into design work, building my projects, filming the videos, editing the videos, etc. Plus it all costs money! Your generosity goes a long way in helping me bring you better content as often as I can!
Follow me on Instagram!
► instagram.com/embraceracing 📷
If you liked this video, perhaps you will also enjoy some channels that I personally find inspiring and interesting...
DIY and MAKER:
► The Hacksmith
youtube.com/channel/UCjgpFI5dU-D1-kh9H1muoxQ
► Adam Savage Tested
youtube.com/channel/UCiDJtJKMICpb9B1qf7qjEOA
► Thomas Sanladerer
youtube.com/user/ThomasSanladerer
Car Content:
► Mighty Car Mods
youtube.com/channel/UCgJRL30YS6XFxq9Ga8W2J3A
► Drivetribe
youtube.com/channel/UChiwLDIBJrV5SxqdixMHmQA
#Arduino #DIY #Howto










