Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: random robots on August 15, 2010, 03:43:55 PM

Title: wth is wrong with my comparators!?
Post by: random robots on August 15, 2010, 03:43:55 PM
ok so using the lm339 comparators and i have a problem. the led load is always on. the led is connected correctly. ive gone through 6 of these and this is the result every time. have any of you had this ever happen, and/or have a solution? datasheet: http://www.fairchildsemi.com/ds/LM/LM239A.pdf (http://www.fairchildsemi.com/ds/LM/LM239A.pdf)

thanks,
Patrick
Title: Re: wth is wrong with my comparators!?
Post by: waltr on August 15, 2010, 05:04:15 PM
Can you post a schematic of your circuit with the LM339?
Title: Re: wth is wrong with my comparators!?
Post by: msprague on August 15, 2010, 05:11:39 PM
The LM339 output is open-collector, so it works by grounding out the minus side of the load.  If you use it to try to switch the positive voltage to the LED, it will not work right.  Could that be your problem?
Title: Re: wth is wrong with my comparators!?
Post by: random robots on August 16, 2010, 05:04:08 AM
the led+resistor goes from supply to the output. this dosent work. that is the problem.

Patrick
Title: Re: wth is wrong with my comparators!?
Post by: waltr on August 16, 2010, 07:55:36 AM
There are many wrong ways the wire LM339s, I've done a few. So without a schematic of how you have them wired, what the input and reference voltages are I can't even guess at what might be wrong.
Title: Re: wth is wrong with my comparators!?
Post by: random robots on August 17, 2010, 07:03:41 AM
schematic: (http://i36.tinypic.com/2qau4b7.jpg) the pot is connected to the positive side and the fixed resistors on negative.
Title: Re: wth is wrong with my comparators!?
Post by: Razor Concepts on August 17, 2010, 08:00:00 AM
339s can only sink 16ma at best - use a PNP transistor instead of directly driving the LED
Title: Re: wth is wrong with my comparators!?
Post by: waltr on August 17, 2010, 10:30:18 AM
Ok, the schematic picture is a bit blurry and I can see how the LM339 is wired but can not read the resistor values.
Can you list these resistor values and the voltage powering the circuit?
What color is the LED? Different LEDs have different threshold voltages.

In general the schematic looks correct so here is some troubleshooting help:
Make the following measurements with a voltmeter, DVM or DMM.

What is the Voltage on the -input? Comparator reference.
What is the Voltage range of the + input? Turn the pot.
What is the output Voltage when the + input is greater then the -input? Also when the +input is less than the -input?

You could try changing the LED resistor on the output to a 10k Ohm resistor and use your voltmeter to see if the output switches when the +input goes above and below the reference (-input). This will tell you if the LM339's output is too heavily loaded by the LED as Razor suggests.

Do you have a by-pass cap across the power and ground of the LM339?
Title: Re: wth is wrong with my comparators!?
Post by: Soeren on August 17, 2010, 06:49:16 PM
Hi,

schematic:
You're kidding, right?!

If this schematic is how much time you care to spend on your circuit, why would anyone else?
Post a crisp (or at least decipherable) schematic if you truly want help.


the pot is connected to the positive side and the fixed resistors on negative.
Say what?
You mean the non-inverting and the inverting inputs perhaps?
Positive/negative side sounds like the power rails.

A simple comparator circuit is not that hard to get working - it's probably one of the most error tolerant circuits of the entire comparator/op-amp family.