LM393A Comparator Issue

Thread Starter

dbirky

Joined Jan 21, 2011
3
upload_2016-5-24_17-36-36.png
No matter how I wire this I keep getting 0VDC at pin 1. I am needing it to be 5v. This drawing was how I wired it last time. I have pin 4 at ground and pin 8 at +5V. The sketch shows how I was testing it. What I really need is to have pin2 at 0v and have pin 3 connected to a speaker lead from a radio. When there is audio on the pin 3 I need pin 1 to be 5V. Also when I had pin 2 at GND I had a + speaker lead on pin 3. Then I played a tone on pin 3 and was hoping pin 1 would go to 5V. It remained at 0. Any help would be appreciated.
 

crutschow

Joined Mar 14, 2008
38,504
You made a common omission in using these comparators.
The output of that comparator is an open collector transistor so you need to add a pull-up resistor from the output to the +5V (or other positive voltage), so the output can go to a plus voltage when the (+) input exceeds the (-) input voltage.
 

GopherT

Joined Nov 23, 2012
8,009
View attachment 106723
No matter how I wire this I keep getting 0VDC at pin 1. I am needing it to be 5v. This drawing was how I wired it last time. I have pin 4 at ground and pin 8 at +5V. The sketch shows how I was testing it. What I really need is to have pin2 at 0v and have pin 3 connected to a speaker lead from a radio. When there is audio on the pin 3 I need pin 1 to be 5V. Also when I had pin 2 at GND I had a + speaker lead on pin 3. Then I played a tone on pin 3 and was hoping pin 1 would go to 5V. It remained at 0. Any help would be appreciated.
Just to add onto @crutschow 's post. I attached the schematic of the guts of the LM393 below. Look how the transistor is connected to the output pin. There is no connection to Vcc (positive power). Most comparitors require the user to add this resistor for their application.


image.jpg
 

Thread Starter

dbirky

Joined Jan 21, 2011
3
You made a common omission in using these comparators.
The output of that comparator is an open collector transistor so you need to add a pull-up resistor from the output to the +5V (or other positive voltage), so the output can go to a plus voltage when the (+) input exceeds the (-) input voltage.
Thanks for the response. Doesn't putting a resistor from Vout to Vcc put 5V to Vout whether or not the + input exceeds the - input?
 

GopherT

Joined Nov 23, 2012
8,009
Thanks for the response. Doesn't putting a resistor from Vout to Vcc put 5V to Vout whether or not the + input exceeds the - input?
No, that is the whole point of a transistor. When no current is flowing through the transistor, both ends of the resistor are at the same voltage (Vcc). When the current flows into he base of the transistor, the Emitter-Collector path becomes conductive and current can flow. The voltage across the resistor becomes Vcc minus about 0.2V (the voltage drop of a staturated transistor (Vce)). So, the output is LOW when the transistor conducts and High when the transistor does not conduct current.
 

Thread Starter

dbirky

Joined Jan 21, 2011
3
No, that is the whole point of a transistor. When no current is flowing through the transistor, both ends of the resistor are at the same voltage (Vcc). When the current flows into he base of the transistor, the Emitter-Collector path becomes conductive and current can flow. The voltage across the resistor becomes Vcc minus about 0.2V (the voltage drop of a staturated transistor (Vce)). So, the output is LOW when the transistor conducts and High when the transistor does not conduct current.
Sorry for being thick. I've set the circuit up on a breadboard but get 5V on Vout anytime the pull-up resistor is connected. Here is the schematic:
upload_2016-5-26_11-1-26.png

would this be correct?

Thanks again!
 

crutschow

Joined Mar 14, 2008
38,504
Due to the input offset voltage of the comparator you may need a few mV less than 0V to cause zero at the output ( or add a few plus mV to the (-) input .
 

wayneh

Joined Sep 9, 2010
18,104
Yes, comparator can be unpredictable right at the power rail. It's better to set a specific reference voltage - not at either of the power rails - to give the output switch at the Vin voltage you need.
 
Top