Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

HELP WITH LOGIC CIRCUIT

NCFC1950

New Member
Hi, pretty much a beginner with logic circuits and have had a crack at it but can only fullfill 3 of 4 conditions. I’ve attached a diagram so hoping someone can help me.

Basically I have 2 float switches at top and bottom of a container and need to switch a pump on when the level reaches the top switch and keep it on until the level falls below the bottom switch then turn the pump off. TIA.
 

Attachments

  • IMG_1676.jpeg
    IMG_1676.jpeg
    1.9 MB · Views: 33
Assuming you are implementing this using a controller, draw a State diagram. States are Empty, Filling, Full.
Initial state is Pump Off.
Empty to Filling event is B going to 1, nothing happens. State is now Filling.
Full State entered from Filling State when A=1, turn Pump On.
Empty State entered again when A=B=0, turn Pump Off.

See https://github.com/jrullan/StateMachine for a typical libray to build this with.

Inside the code where you monitor the switches, you need to track what state the system is in. Change state depending on condition of switches relative to the State.

Gerrit
 
Your case 2 and case 4 are the same. You are just describing them differently. If each switch (sensor) only has two states (on/off) and you have two switches (sensors), the most states you can have is 2 squared = 4.
 
I only listed 3 states, Empty, Filling and Full. I should have worded the first sentence as just initially pump is off.

Initially Pump is off, State is Empty.
When Switch B goes to 1, set State to Filling
When Switch A also goes to 1, set State to Full, turn on Pump.
When Switch A goes to 0, do nothing.
When Switch B also goes to 0, set State to Empty and turn off Pump. (code would be something like If State=Full and A=B=0, then set State to Empty, turn off Pump.)

gerrit
 
Hi, pretty much a beginner with logic circuits and have had a crack at it but can only fullfill 3 of 4 conditions. I’ve attached a diagram so hoping someone can help me.

Basically I have 2 float switches at top and bottom of a container and need to switch a pump on when the level reaches the top switch and keep it on until the level falls below the bottom switch then turn the pump off. TIA.

It seems you need to add storage to this problem which could be a flip flop for example, or a relay as other posts show. It does not look like it can be done with single level logic which appears to be what you are trying to do. That leads to conflicting states as you can tell from your first attempt at a solution. You can't have something both on and off at the same time with the same two states unless you add something to store one of the states.

To solve this you could draw a state diagram. That's just a bunch of circles connected with directed lines where each circle represents a different state of the circuit.
For this problem, A would bring you to state 1, then B brings you to state 2 or back to start. Note that you do not have to AND A and B to turn 'on', because if A is in state 1 then B must be in state 1 as well. When A goes to 0 however, then B must take over.

The simplest in pure logic would be A sets the SET input of an SR flip flop, the Q output turns the pump on, and NOT B sets the RESET input of the flip flop. Thus when A goes high the pump turns on and stays on, then when B goes low the pump turns off. If B goes high again nothing happens unless A goes high again later.
Depending on the type of switches (NO or NC) it may get simpler not needing an inverter just a flip flop, and of course something to drive the pump like a relay or triac.
 
float switch
Most float switches are for emptying the tank. Some are for filling the tank. There are some switches that have both functions. Watch the video.
I use one float switch to do what you are doing.
In the picture, the float is down, and the pump just turned off. If the float was in the red area the pump turns on.
If the gloat is in the middle the pump will stay on or off as it last was.
1727827649120.png

Clamp the cable in the center of the working range. Increasing the length of the cable increases the on to off range.
 
To the OP:

1. What power sources are available for the control system?

2. This can be done with a small microcontroller, or an electronic circuit using logic IC's, or only transistors. It also can be done with nothing but relays. What is your skill set for building this?

ak
 
eTech, relay only circuit, seems fine.
I agree.
If I were building the circuit I would add START and STOP buttons for manual control.

Manual control is desirable to allow interventions with the normal automatic operation, and to stop the thing when something goes wrong.

JimB
 

Latest threads

New Articles From Microcontroller Tips

Back
Top