Connect with us

Driving relay with transistor question

Discussion in 'Electronic Basics' started by [email protected], Dec 15, 2005.

Scroll to continue with content
  1. Guest

    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?
  2. John Fields

    John Fields Guest

    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
    No, since that would require the LED to carry the relay's coil
    No, since that would require the LED to carry the relay's coil
    current as well as the transistor's base current.
    No, since if it was wired in on the stamp side of the base resistor
    the transistor would never turn on, and if it was wired in on the
    transistor side of the base resistor the LED would never turn on.
    Oh well...

    | | |
    |K | [R]
    [DIODE] [COIL] |
    | | [LED]
    | | |K
    DRIVE>--[R]---B NPN
  3. Jeff Dege

    Jeff Dege Guest

    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.


    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
  4. Bob Monsen

    Bob Monsen Guest

    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.

    Bob Monsen

    PATRICIA PAIWONSKI gave Ben Caxton the all-out kiss of brotherhood
    before he knew what hit him.
  5. Rich Grise

    Rich Grise Guest

    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.

  6. Jasen Betts

    Jasen Betts Guest

    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...

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day