Using LM393 Comparator to detect the voltage when 120Vdc drop down to 40 Vdc light up a Led.

BobTPH

Joined Jun 5, 2013
8,967
PLEASE confirm which it is. This makes a HUGE and FUNDAMENTAL difference in how this problem is tackled.
Yep, we started with an inverter that outputs 120VDC, then it changed to a battery that ramps down from 120V to 0V, neither of which can be an accurate description of the source.
 

Thread Starter

andrew74

Joined Jul 25, 2022
102
What I and others have been trying to get at is whether that 120 V is really, truly, 120 V DC or whether, as is likely if it is the output of an inverter, it is 120 V AC.

PLEASE confirm which it is. This makes a HUGE and FUNDAMENTAL difference in how this problem is tackled.



You are close, but once again you are trying to apply 40 V to the input of the LM393, which is not only well above the 36 V absolute maximum rating for the part, but astronomically above the recommended operating maximum of 1.5 V below the positive supply rail, which is a mere 10.5 V. You are almost certainly going to destroy this part.

The goal is to divide the supply voltage down so that, when the supply voltage is 40 V (not when it is 120 V, but when it is at the point where you want to turn on the LED), the output of the divider matches the 3.3 V reference. This requires a divider whose gain is 3.3 V / 40 V = 0.0825, which in turn requires the top resistor to be about 11 times as large as the bottom resistor. So something like 10 kΩ on the bottom and 110 kΩ on the top. This divider also ensures that when the supply voltage is at it's full 120 V level, that the voltage at the output is only about 9.9 V, so below the 10.5 V recommended max (albeit not by a lot).
I confirm 120V DC

Thank you very much! I understand much better how it works

I still have some technical doubts about some parameters:

1) When you mentioned "astronomically above the recommended operating maximum of 1.5V below the positive supply rail" ... did you find the 1.5V value from the LM393 datasheet? (I think it should be located in page 4 .. but I don't know what parameter is).
If there's not on datasheet .. is it a general raccomandation?


2) I have some difficulty in understanding the Output Sink Current of the comparator:

- being open collector ... it should absorb current (at the output), not generate it. Right?
-if I am correct, then when studying the output of the comparator (which in this case is simply an LED and its resistor but could be something else) I must consider a current being absorbed, therefore entering the output of the comparator.
- if so, the current I am talking about is the Output Sink Current?
 

WBahn

Joined Mar 31, 2012
30,062
1) When you mentioned "astronomically above the recommended operating maximum of 1.5V below the positive supply rail" ... did you find the 1.5V value from the LM393 datasheet? (I think it should be located in page 4 .. but I don't know what parameter is).
If there's not on datasheet .. is it a general raccomandation?
1664394545872.png

The TI datasheet I was using only had Vcc-1.5 V over the entire temp range, this one is 2 V. But if you are running it near room temperature, using 1.5 V should be adequate, provided your 12 V supply is pretty accurate and stable. If it's +/-10%, it could actually be below 11 V.

2) I have some difficulty in understanding the Output Sink Current of the comparator:

- being open collector ... it should absorb current (at the output), not generate it. Right?
-if I am correct, then when studying the output of the comparator (which in this case is simply an LED and its resistor but could be something else) I must consider a current being absorbed, therefore entering the output of the comparator.
- if so, the current I am talking about is the Output Sink Current?
That's correct. When the LED is on, the current is coming from the 12 V, going through the LED/resistor combo, and then getting absorbed (sunk) by the output, which is holding the output pin to as low a voltage as it can, which is a fraction of a voltage above its negative supply. Notice that while the part can typically sink 16 mA (while keeping the output pin no higher than 1.5 V), it is only guaranteed to be able to sink 6 mA while doing so. So it's best to design to the 6 mA figure. If you keep the current below 4 mA (and operate near room temp), then the output voltage should be more than 0.4 V.
 
Mains inverters typically have a boost-converter to make 170VDC then a fullbridge to convert that to AC. 120VAC is 170Vpk, so OP isn't making sense with a 120VDC inverter. That would be an oddball DC bus voltage.
I'm lazy and would consider using a TL431 and transistor to invert the low voltage detect for the LED, running from the 12V side. Use a trimpot to adjust the threshold.
 

Thread Starter

andrew74

Joined Jul 25, 2022
102
View attachment 277276

The TI datasheet I was using only had Vcc-1.5 V over the entire temp range, this one is 2 V. But if you are running it near room temperature, using 1.5 V should be adequate, provided your 12 V supply is pretty accurate and stable. If it's +/-10%, it could actually be below 11 V.



That's correct. When the LED is on, the current is coming from the 12 V, going through the LED/resistor combo, and then getting absorbed (sunk) by the output, which is holding the output pin to as low a voltage as it can, which is a fraction of a voltage above its negative supply. Notice that while the part can typically sink 16 mA (while keeping the output pin no higher than 1.5 V), it is only guaranteed to be able to sink 6 mA while doing so. So it's best to design to the 6 mA figure. If you keep the current below 4 mA (and operate near room temp), then the output voltage should be more than 0.4 V.
[/CITAZIONE]


To sum up, the circuit should look like this:
lm393.png

So I should size the output with 6mA?
If yes, I did the calculations by fixing 0.7V on the LED and 6mA ... will they be able to light the LED? Isn't 6mA too little?

Thank you very much for the clarifications!
 

WBahn

Joined Mar 31, 2012
30,062
The forward voltage of the LED depends on its color, but it is always significantly more than the 0.7 V of a silicon diode. You can expect 1.8 V to 2.5 V for most LEDs and 3 V to 3.5 V for a blue LED. Whether 6 mA is enough to visibly light the LED depends on the specific LED. If you are buying one, be sure to look at the recommend forward current. If it is significantly above 6 mA, pick a different one. If it is something like 10 mA, you should be okay. If the LED you want to use needs significantly more than 6 mA, you will likely be able to get that 16 mA from the comparator, you just can't count on it. We can also add a transistor and resistor to drive the LED at whatever current you desire.
 

Thread Starter

andrew74

Joined Jul 25, 2022
102
The forward voltage of the LED depends on its color, but it is always significantly more than the 0.7 V of a silicon diode. You can expect 1.8 V to 2.5 V for most LEDs and 3 V to 3.5 V for a blue LED. Whether 6 mA is enough to visibly light the LED depends on the specific LED. If you are buying one, be sure to look at the recommend forward current. If it is significantly above 6 mA, pick a different one. If it is something like 10 mA, you should be okay. If the LED you want to use needs significantly more than 6 mA, you will likely be able to get that 16 mA from the comparator, you just can't count on it. We can also add a transistor and resistor to drive the LED at whatever current you desire.
What happens if my 120V DC input drops to 0 very quickly?
Are there any parameters in the comparator (lm393) datasheet concerning the speed of the input signal?
For example I found the Response Time parameter but I don't think it has anything to do with this.

Let me give an example: in this circuit .. which would be the difference between V input dropping to 0V in 3 seconds compared to one that takes only 3 microseconds?
 

WBahn

Joined Mar 31, 2012
30,062
What happens if my 120V DC input drops to 0 very quickly?
Are there any parameters in the comparator (lm393) datasheet concerning the speed of the input signal?
For example I found the Response Time parameter but I don't think it has anything to do with this.

Let me give an example: in this circuit .. which would be the difference between V input dropping to 0V in 3 seconds compared to one that takes only 3 microseconds?
It's unlikely that a power supply would drop from 120 V to 0 V in 3 µs. That's a slew rate of 40 V/µs, which is pretty respectable even for many opamps (the TL082 is only half that).

But let's assume that it does.

Which circuit is "this circuit"? If it's the one powered by the 12 VDC source using the LM393, then you want to look at the response time and propagation delay parameters, all of which or on the 1 µs scale or faster.

The big thing you need to ask yourself is why it would matter? This is for a visual indication for a human to see, right? Would it make any difference at all if it took 100 ms, or even a full second, for the LED to turn on?
 

Thread Starter

andrew74

Joined Jul 25, 2022
102
È improbabile che un alimentatore scenda da 120 V a 0 V in 3 µs. Questo è uno slew rate di 40 V/µs, che è abbastanza rispettabile anche per molti operazionali (il TL082 è solo la metà).

Ma supponiamo che sia così.

Quale circuito è "questo circuito"? Se è quello alimentato dalla sorgente a 12 V CC che utilizza l'LM393, allora si desidera esaminare i parametri del tempo di risposta e del ritardo di propagazione, tutti o sulla scala di 1 µs o più veloce.

La cosa importante che devi chiederti è perché dovrebbe importare? Questo è per un'indicazione visiva che un essere umano può vedere, giusto? Farebbe qualche differenza se ci volessero 100 ms, o anche un intero secondo, per accendere il LED?
[/CITAZIONE]
Excuse me for writing this post so long after my last one in this discussion.

If I could choose/buy any comparator .. which one would you recommend?
Which one would be most suitable for this application? (given the comments above)
I had mentioned the lm393 because I had this, but I am interested to know if there is a better one for this type of application.

I simply filtered for 12V power supply on DigiKey because I have that type of power supply available.
Of the few results I came up with, I think I should choose a comparator with Isink>20mA (see attached photo)
Correct?
Other things?

SmartSelect_20221120_213252_Samsung Notes.jpg

@WBahn
@ericgibbs
 
Top