0
\$\begingroup\$

I want to make a water level indicator but, instead of all LEDs lighting at 100% (for example) I want the top one only to light and the rest turn off

  • at 0% all LEDs off
  • at 25% the first LED on
  • at 50% the first LED of and the second on
  • at 75% the second and first LED s off and the third on
  • at 100% only the fourth LED on.

I tried this circuit but it did not work with water.

enter image description here

\$\endgroup\$
10
  • \$\begingroup\$ (1) Please post a better quality image with the grid turned off. (2) "I tried this circuit but it did not work with water." Did it work when you closed the switches? If not, what did it do and what did it not do? (3) What kind of water? Distilled, de-ionised, tap water, salt water? Please use the edit link to clarify. \$\endgroup\$
    – Transistor
    Commented Mar 20, 2021 at 17:54
  • \$\begingroup\$ I do not how to post a new image, how can I do it? \$\endgroup\$
    – Seif_1999
    Commented Mar 20, 2021 at 17:58
  • \$\begingroup\$ Where did you get the image? If you drew it yourself then take a higher resolution screengrab. If not then you probably can't improve it but you need to add a credit and link to the original author. (This is site policy.) \$\endgroup\$
    – Transistor
    Commented Mar 20, 2021 at 18:03
  • 1
    \$\begingroup\$ "Did not work with water." Are you using float switches, or water conductivity sensors, or something else? What do the switches really represent? \$\endgroup\$
    – JRE
    Commented Mar 20, 2021 at 18:14
  • 1
    \$\begingroup\$ @Seif_1999 If you plan on using BJTs for water level detection then you will need a high impedance input. This can be done with two BJTs and MOhm resistors. But I've designed units for detecting water around toilets before and this isn't a matter of just sticking a BJT base into water. That much I know for sure. And please say something about the water (salty, etc) and about the container (shape) and how you imagine building up the sensor. Also, you have % given, but we'd need ranges not exact numbers. \$\endgroup\$
    – jonk
    Commented Mar 20, 2021 at 18:52

6 Answers 6

0
\$\begingroup\$

An optical prism water sensor is 'on' by default (dry) and 'off' when immersed. Sounds like exactly what you're looking for, and you avoid the hassle of passing electricity through water.

More about those here: https://www.electroschematics.com/optical-liquid-level-sensor/

You could literally just wire LEDs to the phototransistors and get the effect you want.

\$\endgroup\$
0
0
\$\begingroup\$

The basic problem with the original circuit (besides a schematic that is difficult to decipher) is that water resistance is too high. The schematic doesn't say what the operating voltage is, but the water resistance could be a few hundred K ohms. This will not allow enough current through to saturate two transistors with collector currents in the 10's of mA.

One possible solution is to change all of the transistors to small-signal n-channel MOSFETs. Add a 1 M resistor from each gate to GND. While you're at it, I think you can replace three of the transistors with 6 diodes.

\$\endgroup\$
3
  • \$\begingroup\$ Using the conductivity of water will not be reliable. Moisture and droplets could trigger the signal. You definitely need mechanical switches. \$\endgroup\$
    – Fredled
    Commented Mar 25 at 23:30
  • \$\begingroup\$ @Fredled Mechanical switches—such as float switches—can fail due to fouling, especially with hard water, in just a few months. \$\endgroup\$ Commented Mar 26 at 16:46
  • \$\begingroup\$ @AndrewMorton Yes, there is no safe solution and various solutions exist. It really depends on the type of water and the type of tanks and on the environment. But using water conductivity is a no go if you ask me. \$\endgroup\$
    – Fredled
    Commented Mar 26 at 21:39
0
\$\begingroup\$

Here is a first draft of a solution using N-MOSFETS. Each one turning off the previous one. SW1 to 4 are float switches. Only the float switches are in the water.

Capacitors should be between 0.1uF and 1uF (test before deciding). Capacitor voltage no less than 25V.

Schottky Diodes prevent current dropped by the LED's to reach the previous MOSFET gate. (update)

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
4
  • \$\begingroup\$ Beat me by 3 minutes. I went and measured the water resistance in a glass before hitting "Add". \$\endgroup\$
    – AnalogKid
    Commented Mar 25 at 21:50
  • \$\begingroup\$ This circuit has a logic issue. When SW4 closes, M4 turns off M3, which allows M1 to come back on. The same thing happens with SW5. Diodes. \$\endgroup\$
    – AnalogKid
    Commented Mar 25 at 21:53
  • \$\begingroup\$ Also, with 10 K LED resistors, current is only around 1 mA. \$\endgroup\$
    – AnalogKid
    Commented Mar 25 at 21:55
  • \$\begingroup\$ @AnalogKid Indeed. I added some diodes. I think it will solve this issue. Of course Led resistors can be reduced to increase intensity. \$\endgroup\$
    – Fredled
    Commented Mar 25 at 23:04
0
\$\begingroup\$

I know this thread is three years old, but it has some recent activity, so . . . here.

As a public service for future generations, here is the OP schematic redrawn for clarity. The structure of the circuit is fine. It is not clear why the LED resistors are split into two resistors with the bypass transistor connected in the middle. The circuit would work fine and have much less power dissipation if the bypass transistor were connected directly to the LED anode, and the two resistors combined into a single 300 ohm part.

Operation is straightforward. Each switch closes successively as the water level rises. As each switch closes, one transistor lights its own LED and another transistor bypasses the previous stage's LED, turning it off.

enter image description here

Each switch represents two probe wires maybe 1/2" apart. When water rises to their level, it appears as a resistance between the probe wires. The only real problem with this circuit is that water resistance is too high to drive a bipolar transistor, let alone two in parallel. To barely saturate both transistors would require a water resistance of 18K or less, while real water could be several hundred K.

Using a second transistor to inhibit the previous stage LED rather than the previous stage driver works well, and is in fact less complex that using steering diodes.


As above, the only real problem is the inadequate drive current caused by the high resistance water. A solution is to change the transistors to small-signal n-channel MOSFETs. Here is a reworked schematic with FETs. This version also replaces the bypass transistors with diodes. A diode is able to bypass an LED because while the LED's forward voltage (Vf) is around 2 V or more, a signal diode Vf is around 0.7 V. The diode clamps the LED's anode at a voltage too low for it to conduct and illuminate.

With this approach, even a water resistance of 1 M would still present a gate voltage of 6 V, more than enough to "saturate" (fully enhance) the FET.

enter image description here

\$\endgroup\$
2
  • \$\begingroup\$ Is it possible to use AC across the level sensors to reduce corrosion of the contacts? It seems likely that the indicator LEDs do not need to be on at 100% duty cycle. \$\endgroup\$ Commented Mar 26 at 16:48
  • 1
    \$\begingroup\$ Certainly possible, but that is a much more complex design. The original question was about why his circuit did not work correctly. \$\endgroup\$
    – AnalogKid
    Commented Mar 26 at 17:23
-2
\$\begingroup\$

This can be achieved fairly easily with the help of a microcontroller and a bit of code.

You can use an Arduino which is quite easy to start with.

Connect each Led to a pin of the Arduino and use what is called a PWM to vary their frequency.

Connect your sensors likewise to other input pins.

There are tons of example on Google on how to achieve that, they keyword is LED PWM control Arduino.

\$\endgroup\$
4
  • \$\begingroup\$ I intended to do it without a microcontroller, but thank you any way \$\endgroup\$
    – Seif_1999
    Commented Mar 24, 2021 at 8:06
  • \$\begingroup\$ @Seif_1999 any reason why not using a microcontroller? \$\endgroup\$
    – Damien
    Commented Mar 24, 2021 at 8:20
  • \$\begingroup\$ @Damien Why would you want to use an Arduino and PWM for a project as simple as this? Makes no sens to me. \$\endgroup\$
    – Fredled
    Commented Mar 25 at 23:27
  • \$\begingroup\$ At first glance, perhaps, but when you start to add all the necessary protection circuit to have a reliable circuit, you start to have a tons of components, and is very unlikely op will get something working. There are not even 1 good example that would work on the answers proposed, both circuit above have unprotected gates and will die. Whilst this can be easily accomplished with a MCU and a few passive using by different methods, it also offers the opportunity to learn about MCUs which will enable OP to do more projects. This circuit in any mass product of our days would integrate an MCU. \$\endgroup\$
    – Damien
    Commented Apr 7 at 11:00
-3
\$\begingroup\$

The best way you can do it is by a digital circuit. Create the truth table , do the K-maps required and find the boolean expression of the circuit and use digital logic gates.

It so much easier to do it using digital circuits than analog circuit because in the end if you try to do it with a analog circuit you will end up building digital logic gates , dont reinvent the wheel!

\$\endgroup\$
12
  • \$\begingroup\$ so it is not possible to do it with just transistors? \$\endgroup\$
    – Seif_1999
    Commented Mar 20, 2021 at 17:59
  • \$\begingroup\$ If you try build it with transistors you can do it but it will take much more time and as I said you will end up building the logic gates from transistors which isn't worth the effort. \$\endgroup\$
    – Miss Mulan
    Commented Mar 20, 2021 at 18:00
  • 2
    \$\begingroup\$ Well, that's important. See, I expected water conductivity sensors to be used rather than pressure sensors. Maybe someone else expects float switches. \$\endgroup\$
    – JRE
    Commented Mar 20, 2021 at 18:10
  • 1
    \$\begingroup\$ It is also possible to solve this using comparators - fully analog. \$\endgroup\$
    – JRE
    Commented Mar 20, 2021 at 18:12
  • 3
    \$\begingroup\$ What about the inputs of a comparator? Are you going to say those are digital, too? A comparator is analog. \$\endgroup\$ Commented Mar 20, 2021 at 18:42

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