Novice, beginner project help

jjustin

Joined Mar 1, 2011
2
Use an op amp comparator circuit. The two bare wires, used as electrodes placed close together, essentially becomes a short circuit when the water rises over the wires - that unbalances the input to the comparator causing the output to switch and shut off the pump. The output of the comparator drives the pump. It's a simple circuit using an IC and a few resistors - cost about $7.
 
Last edited:

PhilTilson

Joined Nov 29, 2009
131
Whilst not wishing to denigrate the efforts of the well-intentioned, I do feel that, very often, responses in these forums tend to be either pompously dismissive of 'newbies' or alternatively, to offer very complex or sophisticated 'solutions' which are way beyond the grasp of a beginner.

I should like to offer a solution to the original problem that is neither particularly elegant nor necessarily very efficient.. It does, however, address the specific need stated, and offers a fairly easily understood circuit using standard transistors and logic. Microprocessors and ultrasonic sensors can come later!


Diagram.png


It is based around a simple bistable circuit in which a pair of transistors (TR2 and TR3) can exist in one of two states. When one transistor is on, the other is off, and vice versa. The state of the bistable is changed by pulling one or other of the transistor bases down to ground.

Let us assume a start position where the tank is half empty, indicated by level M on the diagram, so at this stage the pump is not on.

The pump is controlled by the relay, RLA and, since this is not on, TR3 must be off and TR2 must be on. As TR2 is on, point f is at near ground. This holds the base of TR3 at near ground, via the 1K resistor. Thus point g is effectively at 6V and the relay is therefore off.

There are three probes in the tank. The longest is connected to ground; a slightly shorter one is connected to the base of TR1 (point b) and the very short one is connected to the base of TR5 (point a). It is important to note that TR5 is a PNP transistor, whereas all the others are NPN.

As we are at the mid position, M, point b is effectively grounded through the water in the tank, holding TR1 off. Thus point d is high, holding TR2 on.

When the water level falls to point L, the link between the probes is broken and point b is pulled up via the 47K resistor, turning TR1 on. This pulls down point d to near ground, turning off TR2. Point f therefore rises and this voltage is passed to point e via the 1K resistor, turning on TR3. Point g is therefore pulled to ground, keeping point d low and therefore TR2 off, and turning on the relay, and therefore the pump.

The water level now begins to rise. Point b is once again taken to ground, turning off TR1. However, point d cannot rise again as it is being held low by TR3 via the 1K resistor. Thus the pump continues to run as the tank refills.

When the water level reaches level H, the short probe touches the water and pulls point a towards ground. As TR5 is a PNP transistor, this is turned on and point c rises towards 6 volts. This turns on TR4 which pulls point e to near ground.

TR3 therefore turns off, turning off the relay and the pump. Point g is now high, turning on TR2, which pulls point f down which keeps point e low. When the water level starts to fall again and the short probe becomes open circuit, the system is back to where it was when we started.

This circuit achieves the required hysteresis, so that the pump is not constantly switching on and off. It is simple and reliable and does not require any programming. Isn't this what a beginner, trying to understand electronics, actually needs?
 

Phil-S

Joined Dec 4, 2015
238
Whilst not wishing to denigrate the efforts of the well-intentioned, I do feel that, very often, responses in these forums tend to be either pompously dismissive of 'newbies' or alternatively, to offer very complex or sophisticated 'solutions' which are way beyond the grasp of a beginner.

I should like to offer a solution to the original problem that is neither particularly elegant nor necessarily very efficient.. It does, however, address the specific need stated, and offers a fairly easily understood circuit using standard transistors and logic. Microprocessors and ultrasonic sensors can come later!


View attachment 114064


It is based around a simple bistable circuit in which a pair of transistors (TR2 and TR3) can exist in one of two states. When one transistor is on, the other is off, and vice versa. The state of the bistable is changed by pulling one or other of the transistor bases down to ground.

Let us assume a start position where the tank is half empty, indicated by level M on the diagram, so at this stage the pump is not on.

The pump is controlled by the relay, RLA and, since this is not on, TR3 must be off and TR2 must be on. As TR2 is on, point f is at near ground. This holds the base of TR3 at near ground, via the 1K resistor. Thus point g is effectively at 6V and the relay is therefore off.

There are three probes in the tank. The longest is connected to ground; a slightly shorter one is connected to the base of TR1 (point b) and the very short one is connected to the base of TR5 (point a). It is important to note that TR5 is a PNP transistor, whereas all the others are NPN.

As we are at the mid position, M, point b is effectively grounded through the water in the tank, holding TR1 off. Thus point d is high, holding TR2 on.

When the water level falls to point L, the link between the probes is broken and point b is pulled up via the 47K resistor, turning TR1 on. This pulls down point d to near ground, turning off TR2. Point f therefore rises and this voltage is passed to point e via the 1K resistor, turning on TR3. Point g is therefore pulled to ground, keeping point d low and therefore TR2 off, and turning on the relay, and therefore the pump.

The water level now begins to rise. Point b is once again taken to ground, turning off TR1. However, point d cannot rise again as it is being held low by TR3 via the 1K resistor. Thus the pump continues to run as the tank refills.

When the water level reaches level H, the short probe touches the water and pulls point a towards ground. As TR5 is a PNP transistor, this is turned on and point c rises towards 6 volts. This turns on TR4 which pulls point e to near ground.

TR3 therefore turns off, turning off the relay and the pump. Point g is now high, turning on TR2, which pulls point f down which keeps point e low. When the water level starts to fall again and the short probe becomes open circuit, the system is back to where it was when we started.

This circuit achieves the required hysteresis, so that the pump is not constantly switching on and off. It is simple and reliable and does not require any programming. Isn't this what a beginner, trying to understand electronics, actually needs?
This is a nice forum compared to some.
In this case, the questioner can see that there are many solutions for what on first sight seems like a simple problem to solve and can take their choice. Apart from the tilt float approach, introducing hysteresis is going to involve some latch and release method which can be difficult for "pros" to get their head round. Somewhere along the line, the questioner with their background in programming, might want to explore a different approach like MCUs
 

PhilTilson

Joined Nov 29, 2009
131
You need a resistor in series with TR5 base to limit the maximum current - 1k would do.
I am assuming the medium to be pumped will be water, in which case there should be no need to limit the base current of TR5 as the resistance of water is actually quite high. However, it would do no harm to put a 1K resistor in there!
 

hp1729

Joined Nov 23, 2015
2,304
Water doesn't conduct electricity. Well clean water shouldn't. Perhaps a membrane switch that senses the pressure of the water?
 

PhilTilson

Joined Nov 29, 2009
131
Water doesn't conduct electricity. Well clean water shouldn't. Perhaps a membrane switch that senses the pressure of the water?
Really? Well, YOU can get in a bath of water with an electric heater if you like - count me out!

To be serious, you are correct that pure, distilled water is not a conductor. However, any normal drinking water, or the kind of water likely to be used in a project such as this, most certainly does conduct to a certain extent, due to the presence of dissolved salts, impurities etc. It is definitely enough to provide sufficient bias on the base of a transistor to turn it on.

There is certainly resistance, however - which explains my reply to the point made above about needing a resistor in the base of TR5. It's not necessary (in my opinion) because the water has sufficient resistance to limit the base current.
 

boydage

Joined Oct 7, 2016
92
Hey Levedee. Mate I apologize for the guys here who are obviously trying to make themselves look like NASA scientists rather than just plain electronics people trained in electronics.

The toilet joke was probably the worst of the lot and then I read on to find that most of the replies you got were just plain arrogance. These will be the guys who go to change the oil on their cars to fill the new oil only to find they didn't put the plug back in. Or tried to hang a door in their house only to have to pay a tradesman to fix the mess.

Mate there are many ways you can work out a simple on/off circuit with a low voltage sensor and couple that with a relay to activate a pump or on/off solenoid or..... Really there is no need for programming unless you are looking to put in timers or delays etc.

I would do a search if I was you and find a simple circuit which will accept an on/off input from a water level sensor and activate whatever you need to make work. I didn't read too much into this thread because of the rubbish you received.

One really cool way to introduce yourself into electronics is Arduino starter kit. I would recommend that. A beginners kit will show you all you need and more, including programming a chip. Very cheap option to learning instead of trying to get information from here. In fact I think I will cancel my subscription just because of the crap I just saw you receive <snip> Sorry man.

Regards
Boyd

Mod edit: language snipped but I agree with the basic sentiment.
JohnInTX
 
Last edited by a moderator:

PhilTilson

Joined Nov 29, 2009
131
Hey Levedee. Mate I apologise for the guys here who are obviously trying to make themselves look like NASA scientists rather than just plain electronics people trained in electronics.
<snip>


Regards
Boyd
I hope you weren't including my post in that sweeping statement! Not that I don't agree with much of what you said - I said something similar, if a little more politely(!) but be careful you don't throw the baby out with the bath water...
 
Last edited by a moderator:

boydage

Joined Oct 7, 2016
92
I hope you weren't including my post in that sweeping statement! Not that I don't agree with much of what you said - I said something similar, if a little more politely(!) but be careful you don't throw the baby out with the bath water...
Hi Phil. Yes I saw. No it was not meant to be a sweeping statement but i was very annoyed. And I stopped reading the whole thread because of the appalling answers this young guy/girl got for asking how to begin a hobby/employment by making up a simple circuit or even include programming a board to make a more intricate project work.

The people I have the most respect for in my whole life are the teachers and givers of information.
 

JohnInTX

Joined Jun 26, 2012
4,787
In response to some reports on this thread, I can say that this really isn't one of our best efforts. TS asked a simple question and got some good replies but also a lot of hyperbolic, overly complex postulations as well. The greatness of AAC lies in the ability of our senior members to drill down through the noob-speak and help solve the stated problem, not dabble in what-ifs or shoot off into electric toilet territory. How 'bout it?
Thanks for your understanding.
 

WBahn

Joined Mar 31, 2012
30,062
I was looking for a simple solution. I looked at and recreated a simple water level detector using only two wires. The water level rises and completes the circuit once the two wire tips are below the level of water(as you described). Can I use this completion of circuit as a switch to turn off the flow of current to the pump?

A simple 555 monostable setup to accommodate a specific fill rate should fix any issues of trigger resolution.
Yes,you can use the completion of one circuit to open another circuit. There are several ways to do it. I'm envisioning you creating a circuit on a table in order to play with and learn as opposed to trying to make a circuit to use in a real application. As such, we can relax a lot of "best practices" because the goal is to learn.

Your basic problem here is that you need to "invert" the signal. Keeping things basic (at least to begin with) get some small relays (like they might sell at Radio Shack or whatever is filling that niche where you are). You want relays that have both "normally open" (N.O.) and "normally closed" (N.C.) contacts (so that you can use these relays in lots of little learner projects). With the common relay I have in mind you have one (or two) SPDT (single-pole, double through) switches and which one side is closed is determined by whether enough current is flowing in the coil to pull the contact bar away from the N.C. contact and toward the N.O. one. Then, to solve the immediate problem, you power the pump through the N.C. path of the relay and when the water closed the coil path it opens that set of contacts.

But, as others have noted, solving the autofill problem isn't as simple as that. Others have mentioned "hysteresis" but I haven't seen where it was explained exactly what this is, so let's make that clear.

Let's put two level sensing wires in the tank, one at a high level and one at a low level. The behavior we are looking for is that as the tank empties and reaches the low mark we want the pump to turn on and fill the tank until the high mark is reached. So, if the water level is between the two marks, should the pump be on or off? You don't know, based just on this piece of data. If the tank has recently been filled and now it is being allowed to empty toward the low water mark, then it should be off. But if the tank has recently reached the low mark and is now being refilled, the pump should be on. So whether the pump should be on or off depends on the recent history of the system -- hence the notion of "hysteresis" -- which means that, somehow, the relevant piece of information about that history has to be captured and stored. There are lots of ways to do this and, in today's world of cheap digital electronics, a digital approach would be a very common one. But let's stick with relays for a bit.

I'll describe the behavior we need and let you tinker for a while figuring out how to implement it.

First, imagine a relay that has two ways to supply current to the coil. The first is just a simple switch. But the second is through the N.O. contacts of the relay. If the coil is not energized, then the path through the N.O. contacts is open and no current can flow. But if we close the switch, now current does flow through this path and now the relay will remain energized even after we open the switch. The relay is effectively remembering that the switch was recently closed. It will continue to remember this until a second switch (installed in the path going through the N.O. contacts) is opened. So the relay is actually remember which of the two switches was last operated. We call this a "latch" circuit.

What you want is something very similar. When the low water mark is reached, you want the opening of that circuit path to be inverted and energize the coil on the latch relay and you want the pump to be on as long as this coil is latched. Once latched, the low water mark circuit can stop asserting a low water condition as the tank fills because the needed information has been latched (remembered) -- the low water switch can only turn the relay on, it can't turn it off. As the water fills to the high water mark, the closed switch there (the wires) get inverted and used to interrupt the latching current so that the latching relay de-energizes and the pump stops. This switch can only turn off the relay, so as the water level falls below it the pump won't turn back on.

Think about this for a while and see what you can do.
 

Phil-S

Joined Dec 4, 2015
238
WBahn
You have described the "hold-on" relay technique which is widely used in industrial pumping systems. It has the advantage of no electronic components being used and once you get your head around the fact that you are swapping pump control by using high and low level sensors, it is brilliantly simple.
Another analogy might be the two way lighting wiring where two switches control one lamp.
The non-electronic approach uses float switches, the electronic approach would use probes or some other active device. Personally, I have used this many times because it is something that a plant electrician can understand without having to delve into a user manual.
The toilet description wasn't so bad as it is an example of high and low level control and hysteresis, but did need a bit more padding out.
The mechanical float shuts the water off when the level reaches the high point and a bit of slack in the mechanics provides the hysteresis before the float starts to open fully - newer "equilibrium" valves do the same job but with a snap action.
What may not have been described is that hysteresis is needed to prevent a pump or whatever from "hunting" - this is the constant rapid switching on and off if one switch controlled the pump, shut off when when the high level was reached, then immediately start again when the level dropped a couple of millimeters - this puts unnecessary wear and tear on the pump - hyteresis allows a certain amount of slack in the system. You could introduce a timer to produce the slack.
It is also worth mentioning that the sump pump set up is the emptying mode, by reversing the logic or using another set of relay contacts, you get the filling mode.
Because it is essentially an exercise in logic (not trying to be pompous), this is why the CMOS logic chips are so suitable. Where the MCU comes into it's own is that all the features you need are in one package. The big brother of MCUs are the Programmable Logic Controllers (PLCs) which are widely used in industrial plant control. Interestingly, Microchip have just introduced what they call a pocket PLC which bridges the gap between MCU and PLC, but with many more built-in features, ideal for home automation.
 

PhilTilson

Joined Nov 29, 2009
131
I think, in view of the last several posts, that it might now be interesting to hear from the OP! Has any of the recent discussion helped you in your quest? Or did you get so hacked off that you´re not monitoring this thread any more! :(
 
Top