0
\$\begingroup\$

After reviewing the eevblog video on OpAmps and various other videos on the LM339, as well as copying a circuit which works, I am still genuinely confused on the math / logic behind this, which makes it hard to move on to more complicated and customized circuits.

To the best of my understanding, a circuit like this comparing voltages from two sets of voltage dividers should result the same even if the input voltage changes, because the difference between the two remains the same.

Here is the circuit in question:

schematic

simulate this circuit – Schematic created using CircuitLab

Note: This circuit was copied from this instructables article I actually changed some of the resistor values in real life just to see if it would change the voltage range in which the LEDs would light up, and it did.

Since the V1 voltage source, which in practice is a Lipo battery, can be anywhere from 3.2v - 4.2v, I tested it in the CircuitLab simulator. According to the simulator, there should be voltage on all LEDs all the time, which makes sense to me since VCC is changing for both sets of voltage dividers, so the difference should remain the same, thus LEDs will either be on all the time, or all off when the voltage is too low.

In real life (and in the article) however, it doesn't work that way! The LEDs ACTUALLY light up at different voltage levels depending on what voltage is input at V1!

How is this possible?

Ideally, I would like to be able to do the math myself to figure out what resistors I need for what desired outcomes.

Thank you for any input!

\$\endgroup\$
2
\$\begingroup\$

D1 acts as a cheezy shunt voltage regulator. LED's tend to hold their terminal voltages fairly constant over a wide range of input current (although they do get brighter or dimmer). So the voltage divider consisting of R5 through R8 is the reference.

If you really want this to work well, spend the money and use a real shunt reference instead of D1.

\$\endgroup\$
  • \$\begingroup\$ That's the first I've heard of shunt voltage regulators, thank you for the reply! But if that's the case, why does the output in the CircuitLab simulation not turn on and off the leds at different voltages? Is it beyond the software's capabilities? \$\endgroup\$ – PyFire Sep 5 at 0:30
  • \$\begingroup\$ I'm not familiar with that simulator. Did you look at the voltage on the anode of D1 as the battery voltage varies? It should be around 1.5V if it's a typical red LED -- if the instructables article called out a specific LED then you should use that one (different LEDs have different forward voltages). \$\endgroup\$ – TimWescott Sep 5 at 5:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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