This is what I am trying to accomplish. I want the output from a LM339
voltage comparator to activate a 12 volt relay.
I have tried using a transistor switch off the output, but can't get it to
work.
Here are my current system specs.
Relay 12V, 200 ohm coil.
2N2222 transistor (600mA collector I max)
LM339 Quad voltage comparator.
How can i set this up to use the LM339's output to control the relay? All
help greatly appreciated. Don't care if low or high output turns on relay.
Thanks!
Your relay's coil draws 60mA when energized; too much for an LM339 output
to sink directly. The 2N2222 is easily capable of sinking 60mA, and should
be able to do so at a beta of 30 or more, I should think.
Put a 24K pullup resistor between the LM339's output and the +12V supply
(this is assuming the negative terminal of the 12V supply is connected
to your circuit's `ground'). Connect this pulled-up output to the base
of your 2N2222, and ground its emitter. Connect the relay coil between
the +12V supply and the 2N2222's collector, and add a jellybean diode in
parallel with the relay coil (cathode to +12V, anode to 2N2222 collector).
When the voltage at the LM339's noninverting terminal (+) is higher
than voltage at its inverting terminal (-), the LM339's output sink
will be OFF, and not diverting the (approximately) 2mA of current
allowed by the pullup resistor to ground. That current will then
flow through the base-emitter of the 2N2222, which should be enough
to cause its collector to switch pretty much down to ground, thus
energizing the relay's coil.
-Brian Rhodefer
(not officially representing Tektronix, Inc)
If the current requirements of the relay is small enough, you could drive
it from the 339 output by putting the relay coil between the output pin
and the positive supply. But even if there is enough current, you'd need
to ensure that the relay would not damage the 339.
If you connect a resistor from the 339 output pin to the positive supply,
then you will see a low when the output stage is low, and a positive
voltage at other times.
If you are driving an NPN transistor, and the 2N2222 is, then you will
need such a pull-up resistor in order to drive the 2N2222. NPN
transistors need a positive voltage to turn on.
Michael
On Mon, 30 Nov 1998, Dan McCauley wrote:
> I desperately need some help!
>
> This is what I am trying to accomplish. I want the output from a LM339
> voltage comparator to activate a 12 volt relay.
> I have tried using a transistor switch off the output, but can't get it to
> work.
> Here are my current system specs.
>
> Relay 12V, 200 ohm coil.
>
> 2N2222 transistor (600mA collector I max)
> LM339 Quad voltage comparator.
>
Also, don't forget to limit the base current.
Also, these are very high gain devices - don't leave any unused inputs
floating, even on comparators you are not using.
Dan McCauley wrote in message <73vit8$2eh$1...@news1.fast.net>...
> I desperately need some help!
>
> This is what I am trying to accomplish. I want the output from a LM339
> voltage comparator to activate a 12 volt relay.
> I have tried using a transistor switch off the output, but can't get it to
> work.
> Here are my current system specs.
>
> Relay 12V, 200 ohm coil.
>
> 2N2222 transistor (600mA collector I max)
> LM339 Quad voltage comparator.
>
> How can i set this up to use the LM339's output to control the relay? All
> help greatly appreciated. Don't care if low or high output turns on relay.
The output of a LM339 (and many other comparators) is an "open
collector" output - NOT the same as an op-amp output. It cannot
"swing" to V+.
An "open collector" output is simply a transistor with its
collector "open" and the emitter connected to the "gnd" pin. You
can think of the output transistor as a switch that connects the
load to ground when the output is "true". If you want to turn
something "on", you connect it between the output pin and V+.
However, the LM339's output "switch" has a current limit of about
15mA - not enough to drive your relay.
However - you can have it drive your transistor, which will then
drive your relay.
Connect the base of the 2N2222 to the output. Then place a 10K
"pullup" resistor between the output pin and V+. Ground the
2N2222's emitter. Then connect the relay between the 2N2222
collector and V+.
IMPORTANT: You must have a diode across the relay coil to stop
turn-off spikes. WIthout it you will damage the 2N2222 and the
LM339. Connect the diode *directly* across the relay coil
terminals (as close as possible) with the cathode (striped) end
connected to the V+ side of the coil.
You should look at the datasheet for the LM339. There is a
circuit for a "limit comparator" that drives a light bulb. Just
replace the light-bulb with the relay/diode combination. Ignore
the second comparator in the circuit - you only need one.
http://www.national.com/ds/LM/LM139.pdf
Also take a look at AN-74. It is a good tutorial on comparators.
http://www.national.com/an/AN/AN-74.pdf
Good Luck!
Cheers,
Paul Grohe
--
---------------------------------------------------------------
Paul Grohe National Semiconductor Corp.
Assoc. Analog Apps Engineer 2900 Semiconductor Drive
Standard Analog Apps Group Mail Stop C2693
mailto:gr...@galaxy.nsc.com Santa Clara, CA. 95052-8090 USA
Usenet Disclaimer: Any opinions expressed are mine, not NSC's
----------------------------------------------------------------