Driving relay with transistor question

What I think I understand:

Picture trying to drive a relay with a Basic Stamp microcontroller.

The output pin on the Stamp won't sink or source enough current to power the coil on the relay. So we add an NPN transistor.

We wire a diode parallel to one of the relay coil terminals, to truncate the analog junk that the coils will generate. We wire the other coil terminal to the collector of the NPN transistor. The emitter of the transistor is wired to ground, and the output pin of the Stamp is wired to the base. When the output pin goes high, it saturates the transistor, current flows through the relay coils, and the relay throws.

But what if I want to add an LED indicating that the relay is thrown?

Driving an LED from an output pin is easy - LED + current-limiting resistor in series between the pin and ground.

But driving an LED and a relay from the same pin?

Where do I put the LED?

In series between the output pin and the base of the transistor?

In series with the relay coil?

In series between the emitter of the transistor and ground?

Between the output pin and ground, parallel with the transistor?

Seems to me that any of these would work.

What's the most usual practice?

And why?

Reply to
jdege
Loading thread data ...

--
No, since that would force you to push the current to operate the
LED into the base of the transistor from the output pin of the BS
Reply to
John Fields

In parallel to the coil?

Set R so that the LED gets only the current it needs. Depending upon +V and the internal resistance of the coil, might also need a resister in series with the coil to ensure it draws no more than it should.

Seems simple enough.

Thanks.

--
Law and its instrument, government, are necessary to the peace and safety
of all of us, but all of us, unless we live the lives of mud turtles,
frequently find them arrayed against us.  Worse, we are very apt to
discover, facing their sudden inhibition of our desires, that their
reputed impersonality and impartiality are myths - that the government
whose mandates we almost instinctively evade is not the transcendental and
passionless thing it pretends to be, but simply a gang of very ordinary
men, and that the judge who orders us to obey them is another of the
same kind...
		- H. L. Mencken
Reply to
Jeff Dege

A PIC will source 20mA or more from out output. That will really saturate the NPN. You can probably cut that back to less than 10mA using a resistor between output and base, and still maintain saturation. If you do this, you can just put the LED in series here.

--
Regards,
  Bob Monsen

PATRICIA PAIWONSKI gave Ben Caxton the all-out kiss of brotherhood
before he knew what hit him.
Reply to
Bob Monsen

That's the one. :-)

No, you buy a relay that has a coil rated for +V volts. The resistance of the coil (and the applied voltage) is what determines its current.

Yup!

Cheers! Rich

Reply to
Rich Grise

may reduce the drive takes drive current to the base of the transistor, will work if that's not critical.

will be passing all the relays coil current, could destroy the led,

will be passing all the relays current, may reduce VBE

may reduce the drive available to the transistor,

in series with a resistor, both parallel with the relay coil

it's least likely to make a critical difference.

putting it before the transistor limits the avalailable current or voltage putting it in series with the relay (or emitter) limits you to relays with low current coils.

in parallel with the relay it makes little difference as the relay is probably consuming more current than the LED etc...

Bye. Jasen

Reply to
Jasen Betts

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.