Author Topic: Voltage Level Indicator  (Read 3504 times)

0 Members and 1 Guest are viewing this topic.

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 22447
  • Country: gb
  • 0999
Re: Voltage Level Indicator
« Reply #25 on: August 14, 2026, 01:12:14 pm »
@Zero999, I really like your solution, it's quite clever. :)
There is a small problem with the LM339 that has it's +ve input connected to the supply, the input common mode range is: 0V to (Vcc -1.5V), at present it would violate that. Perhaps one or two transistors could replace it.
https://www.onsemi.com/pdf/datasheet/lm339-d.pdf
It's fine. The LM339 will still give proper operation so long as one input is still within the common mode range. Refer to note 5 on page 3 of the data sheet.

Thanks for pointing that out:
5. Positive excursions of input voltage may exceed the power supply level. As long as one input voltage remains within the common mode range,
the comparator will provide a proper output state. Refer to the Maximum Ratings table for safe operating area.

But I was thinking about the negative excursion when the +ve input will be one diode drop below the LM339 ground.
Still a non-issue, because it's a Schottky diode drop, which will be less than 300mV with 6mA flowing through 1A diodes.
 
The following users thanked this post: Ian.M

Online moffy

  • Super Contributor
  • ***
  • Posts: 3045
  • Country: au
Re: Voltage Level Indicator
« Reply #26 on: August 14, 2026, 01:27:19 pm »
@Zero999, I really like your solution, it's quite clever. :)
There is a small problem with the LM339 that has it's +ve input connected to the supply, the input common mode range is: 0V to (Vcc -1.5V), at present it would violate that. Perhaps one or two transistors could replace it.
https://www.onsemi.com/pdf/datasheet/lm339-d.pdf
It's fine. The LM339 will still give proper operation so long as one input is still within the common mode range. Refer to note 5 on page 3 of the data sheet.

Thanks for pointing that out:
5. Positive excursions of input voltage may exceed the power supply level. As long as one input voltage remains within the common mode range,
the comparator will provide a proper output state. Refer to the Maximum Ratings table for safe operating area.

But I was thinking about the negative excursion when the +ve input will be one diode drop below the LM339 ground.
Still a non-issue, because it's a Schottky diode drop, which will be less than 300mV with 6mA flowing through 1A diodes.

8.2.2.1 Input Voltage Range
When choosing the input voltage range, the input common mode voltage range (VICR) must be taken in to
account. If temperature operation is below 25°C the VICR can range from 0V to VCC– 2.0V. This limits the input
voltage range to as high as VCC– 2.0V and as low as 0V. Operation outside of this range can yield incorrect
comparisons.

I used an LM339 a number of years ago and tried to drive one of the inputs slightly below 0V and the output inverted, since then I've stuck with the 0V limit. :)
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 14127
Re: Voltage Level Indicator
« Reply #27 on: August 14, 2026, 01:29:36 pm »
when using a low pincount microcontroller, use charlieplexing for the LEDs.
 3 I/O pins drive 3 * 2 = 6 LEDs
 4 I/O pins drive 4 * 3 = 12 LEDs
The only down-side of charlieplexing is brightness, due to the limited drive available from typical MCU I/O pins.  As the O.P. has the need to display (blended) yellow for AC in, it may require high efficiency R/G LEDs.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 22447
  • Country: gb
  • 0999
Re: Voltage Level Indicator
« Reply #28 on: August 14, 2026, 05:22:01 pm »
@Zero999, I really like your solution, it's quite clever. :)
There is a small problem with the LM339 that has it's +ve input connected to the supply, the input common mode range is: 0V to (Vcc -1.5V), at present it would violate that. Perhaps one or two transistors could replace it.
https://www.onsemi.com/pdf/datasheet/lm339-d.pdf
It's fine. The LM339 will still give proper operation so long as one input is still within the common mode range. Refer to note 5 on page 3 of the data sheet.

Thanks for pointing that out:
5. Positive excursions of input voltage may exceed the power supply level. As long as one input voltage remains within the common mode range,
the comparator will provide a proper output state. Refer to the Maximum Ratings table for safe operating area.

But I was thinking about the negative excursion when the +ve input will be one diode drop below the LM339 ground.
Still a non-issue, because it's a Schottky diode drop, which will be less than 300mV with 6mA flowing through 1A diodes.

8.2.2.1 Input Voltage Range
When choosing the input voltage range, the input common mode voltage range (VICR) must be taken in to
account. If temperature operation is below 25°C the VICR can range from 0V to VCC– 2.0V. This limits the input
voltage range to as high as VCC– 2.0V and as low as 0V. Operation outside of this range can yield incorrect
comparisons.

I used an LM339 a number of years ago and tried to drive one of the inputs slightly below 0V and the output inverted, since then I've stuck with the 0V limit. :)
Less than 300mV or so below the 0V rail is no problem at all. Phase inversion is only an issue when an input is taken close to a diode drop below the negative rail. Refer to Page 19 "6.9.2 Phase Reversal or Inversion" on the application note linked below.
https://www.ti.com/lit/an/snoaa35f/snoaa35f.pdf


It measures the input voltage level and direction that is forward and reverse bias.
Users do not know which of the 3 voltage levels is and the current direction.
It is part of another device and is meant to avoid the need to connect a DMM.
If 5 V LED 1 turns on, if 10 V LED 2 turns on and if 15 V LED 3 turn on.

If the OP really wants a DOT display instead of a bar, here is a solution using a 74LVC138 CMOS DECODER to drive 6 LEDS.

( IP bridge not shown which feeds into one decoder select pin, to choose RED or GREEN sides.)
This keeps a low voltage startup, the 5V band DOT hits 1mA at 2.12V  and fully regulates above ~ 3.5V
The 74LVC138 is powered from the TL431 current base clamp which runs appx 3.1V
Voltage set points here are very precise.
That's quite complicated.

If separate dividers are used then diodes can be connected to the higher voltage comparators to disable the lower voltage outputs.




 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 3367
  • Country: au
Re: Voltage Level Indicator
« Reply #29 on: August 14, 2026, 07:23:56 pm »
Now add the 3 other LEDS, and power the Vref.  8)
 

Offline Aleksei_SU

  • Newbie
  • Posts: 8
  • Country: fr
Re: Voltage Level Indicator
« Reply #30 on: August 15, 2026, 07:48:34 am »
Hello Community

Bipolar voltage level indicator
Consider 3 to 5 levels with LED.
Tried zener diodes, but higher voltage produces too much current for lower ones.
If resistance is increased, lower voltage level LED appears dim.

Any suggestions?

Have you considered that the problem isn't the thresholds but the drive? Two separate fixes:

Quick fix for your existing zener circuit: keep the zeners as threshold elements but stop letting them set the LED current. Zener → small NPN as a switch, and put a constant-current source in the LED leg instead of a resistor — a CRD (J503, ~5 mA) or a two-transistor current limiter. Brightness then stays flat across the whole input range and the lower LEDs don't overheat.

Better fix: drop the zeners. Below ~6 V their knee is soft (hundreds of mV), tempco is up to ±0.1 %/°C, and batch spread is ±5 %, so your thresholds are vague and drift. Two cleaner options:

TL431 per level with a divider. Threshold = 2.495 V × (1 + R1/R2), ±0.5 %, ~30 ppm/°C. Channels are independent, errors don't stack. Needs ≥1 mA cathode current and ≥2.5 V across the cathode.
LM339 quad comparator + one 2.5 V reference (TL431 or LM4040). Input through a resistor ladder to the non-inverting inputs, reference to all inverting inputs. Open-collector outputs sink the LEDs directly. Add 100 k–1 M from output back to the non-inverting input for hysteresis, otherwise the LED will chatter at the threshold.

For the bipolar part: run the comparators on a split supply and mirror the chain with a −2.5 V reference for the negative half. Or, if you don't need both polarities lit at once, use a precision absolute-value stage on one op-amp, one LED chain, and a bicolour LED driven from a comparator against ground for the sign.

If you'd rather not build a discrete ladder, an LM3914 does all of this in one chip — 10 levels, dot or bar mode, and a built-in current source so brightness is constant by design. Add the abs-value front end for bipolar input.
 

Offline spostma

  • Regular Contributor
  • *
  • Posts: 189
  • Country: nl
Re: Voltage Level Indicator
« Reply #31 on: August 15, 2026, 07:41:10 pm »
If I remember well, I should have laying around a tube of unused LM3914 chips in PLCC20 case.
Will I try to dig them up for you (no guarantee of course)?
If I do find them I am happy to send them to you in a small IC box.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->