What components do I need to automate electric pump at home

Hi,

I have situation at my home which is causing us a lot of headache. We get drinking water only at midnight and someone has to wake up and switch on electric pump. This electric pump will pump water from water tank present at ground floor to the water tank present on the terrace.

I want to automate this electric pump operation and I have come up with following rules for it:

  1. When water tank at ground floor is almost full then automatically turn on the pump which will push water from ground floor to the tank on the terrace.

  2. When water tank on the terrace is full then switch off motor.

I am a professional software engineer and I have vast experience in Java, Scala, REST API, Big Data and all but I am totally new to Arduino so I do not know which Arduino components I need to build the above mentioned system.

Any guidance will be deeply appreciated.

Thanks,
Chandra

Hi Chandra.

A basic Arduino will be needed, plus a relay to switch the 220V AC pump, I assume. You can buy mechanical relay modules which can be connected directly to the Arduino (they have a driver circuit built in) or a solid-state relay module. But you will need to know the power/current rating of the pump and choose a relay that is comfortably above that rating.

You will also need a float switch to fit into each tank. These can be connected directly to the Arduino. The contacts of these switches will only need to be rated for a few mA at 5V, they do not need to directly switch the pump.

Your rules do not mention time of day, but your description mentioned performing a task at midnight, so I guess you will also need a Real Time Clock (RTC) module. Modules based on ds3231 chips are better than the older ds1307, but either will be ok.

The classic starter Arduino is the Uno, but if you need to build a prototype on a breadboard, the Nano is a better choice. Nano is equivalent to Uno in almost all capabilities but is smaller, cheaper and breadboard compatible.

Knowledge of Java and Scala will make learning C/C++ pretty easy for you. Both languages can be traced back to C/C++ and much of the basic syntax is the same.

shekhar-kotekar:

  1. When water tank at ground floor is almost full then automatically turn on the pump which will push water from ground floor to the tank on the terrace.

  2. When water tank on the terrace is full then switch off motor.

Without timing you should be able to do this with 2 basic water level sensors (switch with float on arm) and some logic gates, might need a flip-flop which can be made from gates, to trigger a relay to switch the pump on and off. 10A mains power relays are pretty cheap.

any Arduino would work. but not sure if you really need a micro controller.

two float switches. or what ever way you want to use to measure the tank level.

your rules did not state a time, the only start is when the lower tank has risen above some value.

once the pump starts, it would run until the second tank level was reached, then shut off.

you do not include any condition if the upper tank is almost filled. or if it is midnight and the lower tank is only partly filled.

for hardware, you need a motor starter. you did not mention the size of the pump. small pumps may be able to be used with a relay, but larger pumps use motor starters.

you might want some way to have a flow proven signal to show that water is flowing
and a motor proven signal to show the pump is running.

software bit is easy

if the upper tank is not full // switch is open
if the lower tank is above X //switch is closed
then run the pump

once either switch changes state, the pump will turn off.
and at any time the upper switch shows a low tank level and the lower switch shows a high tank level. the pump runs

GoForSmoke:
Without timing you should be able to do this with 2 basic water level sensors (switch with float on arm) and some logic gates, might need a flip-flop which can be made from gates, to trigger a relay to switch the pump on and off. 10A mains power relays are pretty cheap.

if the upper float swich is installed so that the low water condition closes the contacts
and the lower switch is installed to that the high water closes contacts
then the motor would run.
if either switch changes state, the motor would stop.
the logic is in the installation of the switches. no electronics needed.

if you wanted to use time as a 3rd switch, then you need to add some device.
a simple timer could work. allow the pump to run from midnight to 4 AM or some large window.

also, if there are other rules, such a you are only allowed to fill your water one time per day, the Arduino could control that as well.

I think I'd want some timing limit so that in the event that the upper tank's float switch goes bad, the amount of overflow water damage would be kept to a minimum. That's about the only thing I can see in favor of an Arduino controller.

wildbill:
I think I'd want some timing limit so that in the event that the upper tank's float switch goes bad, the amount of overflow water damage would be kept to a minimum. That's about the only thing I can see in favor of an Arduino controller.

I would want a upper tank sensor and a lower tank sensor on both tanks
what if the lower tank ran dry ?
running a dry pump can ruin a motor.
but, here again, the lower tank float switch could be set so that the hysteresis inherent in the switch was enough.
Although we often assume a pump is a motor, they are two separate parts.
I would want a flow proven sensor on the pump to verify it was pumping to show pump failure
and a motor sensor to show the motor on the pump is working.

lastly.... turning the page past required, we come to the options....
data logging
alarms
economizing
level monitoring over time

You could do this with a timer and a couple of relays , which would probably be easier and more robust .

Timer in series with lower float turns pump on via relay , Top tank float switch turns pump off via relay when tank full .
( use secondary contact of lower float relay to turn pump off if level too low in lower tank)

If overflowing the tank will cause damage then put in a second level switch just above the main one that the Arduino uses. This should have an independent path to the pump shut-off that does not depend on the software in the Arduino.

Same for the switch protecting the pump from running dry.

Safety first!

If the upper tank is full the pump should not run.
If the lower tank is empty the pump should not run.
Otherwise it can run.

So you run the pump if lower tank is not empty AND upper tank is not full.

By arranging switches you can make your own logic circuits. Some of us were doing that when our scientific calculators were slide rules.

Switches in series makes AND gate, in parallel makes OR gate, and then you can get tricky.
Yes you can program in wire (some say solder). Software only gets close to the metal at best.

Thank you everyone for your helpful answers.

I have some questions about your answers but since I am new in this Arduino forum (or maybe I have become old), I am not able to find a way to reply to your answers.

I hope I will find a way to reply to answers quickly.

Thanks,
Chandra

You can use the "Quote" link bellow a post, if you wish to ask a question. But please do not quote the entire post. Delete all but the small part you wish to ask about. Like this:

shekhar-kotekar:
I am not able to find a way to reply to your answers.

Please post your questions here on the forum the same way you just did, that worked.
Posting on the forum, will help others who have a similar project and it will also allow people to add their special knowledge.

A question I have is about the way you know if the tank is almost full now. Do you have to go look ? Is there some sensor you use ? or, do you just turn on the pump and hope for the best?

Are you allowed to add a sensor to the tank ?

The most common sensors we use for a water tank are an ultrasonic. non-contact sensor. This has to see the water.
A float sensor that is inserted in the tank with a float and tells you when it is above a level.
A pressure sensor, you insert into the tank and it sits on the bottom. The depth of water is measured by water pressure.
If the tank is something you can move, you can put a load cel under one leg and weigh the tank.
If the tank is plastic, you may be able to put a sensor on the side and the sensor will know if the water has risen above that point.

Of course, if you have a light or meter in your terrace, you can use that as your sensor.
All of these would work with either tank. if cost is a concern, the float and ultra-sonic are the lowest cost.

Hi Paul,

Thanks for your answer, it is really helpful. I looked around for some of the components you mentioned. I have selected this starter kit so far https://www.amazon.co.uk/gp/product/B01DGD2GAO/ref=ox_sc_act_title_2?smid=A1780XYQ9DFQM6&psc=1

and this ultrasonic sensor might help perhaps : HC-SR04 Ultrasonic Distance Rangefinder/Obstacle Detection Module Blue : Amazon.co.uk: Business, Industry & Science

I couldn't find relay switch you mentioned. May I know where can I find this type of switches?

Please learn how to post links on the forum. I hate having to copy & paste web page addresses all the time!

Like this.

In my opinion that is a dumb kit. An Uno and a breadboard is a poor combination. If the kit included one or more shields, then an Uno would be best. But with a breadboard, Nano is a much better choice, and with the money saved, a larger breadboard could be included.

Link to your ultrasonic sensor. No, that is not suitable. It is not waterproof and will soon corrode and fail in the damp environment of a water tank. Unless you need to know the exact water level, an ultrasonic sensor is unessessary. Float switches are more reliable.

do you have full access to the main tank ?
are you allowed to insert things into it ?
can you drill a hole in the side (optional)

same questions for your upper tank.

the motor drives the selection of relays. you need to know how much power your pump needs.
if, your switch is low voltage, like a door bell, then a simple relay might work.

I would offer that some PVC pipe and a vertical float switch float
would work.

you can screw them on a cap and insert the pipe. if you want 2 heights, a full and half. you can use 2 pipes or a tee and a second drop.

all the wire is inside the pipe and the devices are easily cleaned.

if your switch is low power, you can use a simple to use RELAY BOARD


this has screw terminals for all wires.
THE LABELS IN THE PIC ARE WRONG !!!
it does not use square pins as connectors, so it makes use more permanent.
if you want to solder your wires, you can get the type with square pins and not use the pins, just solder the wires

I suggest you put the relay into an electrical box of some sort. the ones you use for a light switch are often low cost, come in plastic and you can easily get a cover.

I prefer the NANO for permanent installations because you can use this shield

shekhar-kotekar:
Hi Paul,

Thanks for your answer, it is really helpful. I looked around for some of the components you mentioned. I have selected this starter kit so far ELEGOO UNO Project Basic Starter Kit with Tutorial and UNO R3 Board Compatible with Arduino IDE for Beginner - ELEGOO

and this ultrasonic sensor might help perhaps : HC-SR04 Ultrasonic Distance Rangefinder/Obstacle Detection Module Blue : Amazon.co.uk: Business, Industry & Science

I couldn't find relay switch you mentioned. May I know where can I find this type of switches?

if you feel the need for ultrasonic to get an actual tank level. then you should get a WATERPROOF ONE.
I like this because the sensor can fit into a PVC pipe and is tight. you can use PVC pipe to hold it in place.
the sensor has to be at least 10-20CM above the highest water level. there is a dead zone for the first 10-20 cm distance.

If the upper tank is full the pump should not run.
If the lower tank is empty the pump should not run.
Otherwise it can run.

rephrase:
upper tank not full says run the pump
lower tank not empty says run the pump
if both upper AND lower tank switches are ON the pump runs.
if either switch is OFF the pump don't run.

5V ----------/ upper tank sw -----------/ lower tank sw --------motor relay----- GND

The long wires should not carry the motor power, can be thin.

You do not need a controller. Just wire your switches to open on the right conditions.
The job itself is simple, logic in wire as a single AND gate made of 2 switches in series.
Only when both are on does the pump run .. but you could add a manual on/off in parallel.

Series and parallel wiring will come up when/if you learn circuitry to connect pins to.

Float switches -- upper tank gets the short string and needs to turn OFF when weight comes off.
Lower tank needs a long string and needs to turn OFF when weight comes on.

If the float hangs from a spring conducting one side of the switch so it lowers if the weight of the float is held by the string, water is lower. Another spring conducting the other side of the switch set crosswise to the float spring can be placed above to be ON when the float floats and OFF when it hangs or placed below to work the opposite way. Springs will work for a long time but will need some cleaning now and then, make the switch a removable unit if possible and use a drop of vinegar to knock any corrosion off or a pencil eraser will do, works great on fingerboards and pins.

I agree with GoForSmoke

If you use a float switch as shown in post #15
or better yet, the type that mounts horizontal, but you have NO or NC depending if the float rises or falls to open the contacts. you just spin it 180 degrees.


Some PVC pipe some Tee fittings and some elbo fittings, and some end caps.
you can mount the switch on the end cap

mounted pointing up and it has the switch closed, or NC
pointed down and the switch is open or NO

in the lower tank. the switch is pointed down. the switch is open until the water is high enough to float the switch.

so there is no signal from the lower tank unless the water is high enough.

in the upper tank, you would mount the switch and point it up.
it would always close the circuit, unless there was water.

these connect to the relay and a power source.

when the lower tank is empty, the float is down and does not pass power. the relay is not energized.
when the upper tank is full,the float is up, and does not pass power, the relay is not energized.
when the lower tank water level floats the switch, the switch passes power to the float on the upper tank.

when the upper tank is empty, the float is down and it does pass the signal.

therefore, with the lower tank full and the upper tank empty, the signal will pass.
the relay will be activated and the pump will run.

When either switch changes state and opens the circuit, the relay will de-energize and the pump will stop.

the relay can be 12 volts or 5 volts and you will only need resistors to make the circuit part to activate the optocouplers on the relay board.

The beauty of this is that the unit does not draw any power unless the system is calling for the pump to run.
There is not need for any special power supply either. and you can add an LED into the unit.

this will run, day or night, anytime that the lower tank is full and the upper tank is not.

The whole rig can be run by a simple house timer to be active at chosen times.

And no code anywhere in sight!

There are situations that organize themselves.