I am looking to build a float sensor for a tank and automating the motor based on sensor input. I am looking to execute this without using a microcontroller.

Below is my intended sensor setup in the tank. This is a magnetic float sensor which acts like a simple switch which closes when the water reaches its level in the tank.

enter image description here

The circuit uses two float sensors. One should be fixed at the top of tank (top float sensor or TFS) to detect when the tank is full to signal the motor OFF and another sensor (bottom float sensor or BFS) at the bottom of tank to signal the motor ON when the water level goes to the lowest point of tank.

There are 4 scenarios this circuit needs to meet:

  1. When water level is full activating TFS, the BFS will be in activated state as well. In this case motor should be turned OFF.
  2. Water consumed it drops down but still over the BFS, in this case the motor should be still in OFF state
  3. Water gets consumed further and it drops down below BFS, in this case motor should be turned ON to fill the tank
  4. Water fills up the tank and it crosses the BFS level but still below TFS, in this case the motor should continue to run and fill the water until it reaches the TFS.

From the above scenarios I have plotted a small logic table that needs to be achieved.

enter image description here

enter image description here

I have designed a circuit using D Flip Flop and 3 input NOR gate. This circuit meets the need for first 3 scenarios or meets the first three logic in the above table however I cannot figure how to meet the 4 scenario. I am stuck with this for a day now, any help or tip is highly appreciated.

  • 1
    \$\begingroup\$ I don't understand your table: the left two columns are inputs, but your second and fourth lines are duplicates with different output? Please fix that! \$\endgroup\$ Commented Mar 6, 2020 at 10:41
  • \$\begingroup\$ Perhaps you need a flip-flop? \$\endgroup\$ Commented Mar 6, 2020 at 11:15
  • \$\begingroup\$ you have to have a state machine and not just truth table to present the problem. System needs to know, whether ti came from full tank to half tank or empty tank to half tank in order to decide on the motor condition. MCU would have been really easier. but do not give up.. \$\endgroup\$
    – User323693
    Commented Mar 6, 2020 at 11:27

1 Answer 1


In principle your truth table is correct. The 4th condition cannot be met straight away because it involves the use of memory, which should only be triggered at some specific point.

I created a small simulation using a SR flip flop as memory, which is only triggered when the upper sensor is active (tank filled) and the tank begins to empty. I considered that the sensors are normally open, and conduct once the corresponding water level is reached.

The circuit emulates the water level with the aid of a voltage source ramping up to 1V and down to 0V. The top and bottom busses represent the sensors which are active above 90% and 10% of the total water level respectively. Circuit

The red waveform shows the motor driver, which is only enabled during the ramp up of the water, and not always when the condition T_TOP = 0 and T_BOTTOM = 1. The SR Flip Flop is activated and latched once the upper sensor is active, holding this state until the lower sensor is activated (turns off the latching mechanism).


Theoretically you could also use only the SR flip-flop as shown in the following picture, but you could run into a problem with the motor shortly turning on, even though the tank is full.

enter image description here

Keep in mind that I did not account for any forbidden conditions, so some additional check must be done.

I hope it helps.

  • \$\begingroup\$ Thank you very much for such a detailed answer. You have given me exactly what am looking for. As you said it satisfies all the conditions which I can think of when using this. But I will take your word of caution and see if there any unforseen conditions. \$\endgroup\$ Commented Mar 7, 2020 at 18:07
  • \$\begingroup\$ I am glad to hear that. If you think this answered your question, please mark it as accepted. If you need, I can send you the simulation file. \$\endgroup\$
    – vtolentino
    Commented Mar 7, 2020 at 18:38
  • \$\begingroup\$ Thought I already accepted the answer sorry about that. Yes I would love to have the simulation file. Also I do have another question, when I attempt to design circuit for above scenarios I wrote the logic table of needed output in sequence and tried with every logic gate and digital chip I know to see if it can satisfy the conditions. How do you come with this circuit do you have any shortcut to design such circuits or it's just comes with experience? Would really like have some advice on this. \$\endgroup\$ Commented Mar 8, 2020 at 2:00
  • \$\begingroup\$ I also used the karnaugh map for checking the basic logic (upper part), but as I mentioned, one of your conditions could not be achieved straight away. Since your circuit was not so complicated, it was possible to figure out that a SR latch would suffice, however, if it was a bit more complicated you would need to draw some Finate State Machine diagram in order to cover all cases. Of course, experience also helps a bit :-). Let me know how I can send you the file. \$\endgroup\$
    – vtolentino
    Commented Mar 8, 2020 at 9:24
  • \$\begingroup\$ Thank you very much. Your help is much appreciated :) My email is [email protected] kindly send me the file through this \$\endgroup\$ Commented Mar 9, 2020 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.