Shop OBEX P1 Docs P2 Docs Learn Events
Driving a relay — Parallax Forums

Driving a relay

ArchiverArchiver Posts: 46,084
edited 2001-05-15 19:52 in General Discussion
I'm trying to drive a relay using the stamp, and i've got a PN2222A
transistor that i'm using due to the current limitations of the
stamp, but for some reason when i turn it on, the relay doesnt
activate.

Here's how i have it hooked up:
Use (for example) a 1K resistor between the stamp pin and the base of
a 2N2222 transistor. The emitter of the transistor goes to ground.
The light bulb goes from +V to the collector.

Transistor Emitter - VSS
Transistor Base - Pin 0
Transistor Collector - Pin 1 of Relay

Relay Pin 1 = Collector
Relay Pin 2 = Vin

I know the relay works, so shouldnt this circuit work?
Thanks

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-02-28 05:33
    a few things to think about:
    1) What's the voltage and current rating on the relay coil?
    2) Have you included a snubbing diode across the relay coil to prevent a
    voltage spike to the Stamp when the magnetic field collapses?
    3) Where did the light bulb come from?

    In a message dated 02/27/2001 9:24:04 PM, immolation@h... writes:

    >I'm trying to drive a relay using the stamp, and i've got a PN2222A
    >transistor that i'm using due to the current limitations of the
    >stamp, but for some reason when i turn it on, the relay doesnt
    >activate.
    >
    >Here's how i have it hooked up:
    >Use (for example) a 1K resistor between the stamp pin and the base of
    >a 2N2222 transistor. The emitter of the transistor goes to ground.
    >The light bulb goes from +V to the collector.
    >
    >Transistor Emitter - VSS
    >Transistor Base - Pin 0
    >Transistor Collector - Pin 1 of Relay
    >
    >Relay Pin 1 = Collector
    >Relay Pin 2 = Vin
    >
    >I know the relay works, so shouldnt this circuit work?
    >Thanks
    >


    ===========
    Larry Geib
    ljgeib@a...
    ===========
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-28 05:58
    Doh

    the lightbuilb line was copied from a faq that i was basing it on =)

    The relay is a 5v relay, that i can turn on by connectin the Vin + VSS
    directly, but i know about the current limitations so i dont wanna run it
    without a transister.

    Original Message
    From: <LJGeib@a...>
    To: <immolation@h...>; <basicstamps@yahoogroups.com>
    Sent: Tuesday, February 27, 2001 9:33 PM
    Subject: Re: [noparse][[/noparse]basicstamps] Driving a relay


    a few things to think about:
    1) What's the voltage and current rating on the relay coil?
    2) Have you included a snubbing diode across the relay coil to prevent a
    voltage spike to the Stamp when the magnetic field collapses?
    3) Where did the light bulb come from?

    In a message dated 02/27/2001 9:24:04 PM, immolation@h... writes:

    >I'm trying to drive a relay using the stamp, and i've got a PN2222A
    >transistor that i'm using due to the current limitations of the
    >stamp, but for some reason when i turn it on, the relay doesnt
    >activate.
    >
    >Here's how i have it hooked up:
    >Use (for example) a 1K resistor between the stamp pin and the base of
    >a 2N2222 transistor. The emitter of the transistor goes to ground.
    >The light bulb goes from +V to the collector.
    >
    >Transistor Emitter - VSS
    >Transistor Base - Pin 0
    >Transistor Collector - Pin 1 of Relay
    >
    >Relay Pin 1 = Collector
    >Relay Pin 2 = Vin
    >
    >I know the relay works, so shouldnt this circuit work?
    >Thanks
    >


    ===========
    Larry Geib
    ljgeib@a...
    ===========
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-28 06:15
    gees- the only other thing I can think of is that you might have the
    collector & emitter on the 2n2222 reversed

    In a message dated 02/27/2001 10:58:52 PM, immolation@h... writes:

    >Doh
    >
    >the lightbuilb line was copied from a faq that i was basing it on =)
    >
    >The relay is a 5v relay, that i can turn on by connectin the Vin + VSS
    >directly, but i know about the current limitations so i dont wanna run
    >it
    >without a transister.
    >
    >
    Original Message
    >From: <LJGeib@a...>
    >To: <immolation@h...>; <basicstamps@yahoogroups.com>
    >Sent: Tuesday, February 27, 2001 9:33 PM
    >Subject: Re: [noparse][[/noparse]basicstamps] Driving a relay
    >
    >
    >a few things to think about:
    >1) What's the voltage and current rating on the relay coil?
    >2) Have you included a snubbing diode across the relay coil to prevent
    >a
    >voltage spike to the Stamp when the magnetic field collapses?
    >3) Where did the light bulb come from?
    >
    >In a message dated 02/27/2001 9:24:04 PM, immolation@h... writes:
    >
    >>I'm trying to drive a relay using the stamp, and i've got a PN2222A
    >>transistor that i'm using due to the current limitations of the
    >>stamp, but for some reason when i turn it on, the relay doesnt
    >>activate.
    >>
    >>Here's how i have it hooked up:
    >>Use (for example) a 1K resistor between the stamp pin and the base of
    >>a 2N2222 transistor. The emitter of the transistor goes to ground.
    >>The light bulb goes from +V to the collector.
    >>
    >>Transistor Emitter - VSS
    >>Transistor Base - Pin 0
    >>Transistor Collector - Pin 1 of Relay
    >>
    >>Relay Pin 1 = Collector
    >>Relay Pin 2 = Vin
    >>
    >>I know the relay works, so shouldnt this circuit work?
    >>Thanks


    ===========
    Larry Geib
    ljgeib@a...
    ===========
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-28 06:17
    If we know the current drain of the relay, we can probably help you out.
    You could either measure it directly with a meter, or measure the resistance
    and R=5V/ohms. From that info we can tell you if the 2222 can drive it.
    With 1K in the base, the 2222 can safely drive up to about 75 ma. The
    previous diode advice is absolutely necessary, or you will smoke the
    transistor.

    Regards,
    Ray McArthur
    >
    > The relay is a 5v relay, that i can turn on by connectin the Vin + VSS
    > directly, but i know about the current limitations so i dont wanna run it
    > without a transister.
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-28 06:27
    Hmm, what kind of diode should i use, and how should i hook it up?

    My relay's:
    5 VDC DPST - N.O.
    Mfg. - GUARDIAN
    Mfg. # 1665S-2A-5D
    1-1/8" x 1/2" x 1"
    5 amp @ 30 VDC/120 VAC
    Coil resistance: 45 ohm

    Thanks for the help

    --- In basicstamps@y..., "Ray McArthur" <rjmca@u...> wrote:
    > If we know the current drain of the relay, we can probably help you
    out.
    > You could either measure it directly with a meter, or measure the
    resistance
    > and R=5V/ohms. From that info we can tell you if the 2222 can
    drive it.
    > With 1K in the base, the 2222 can safely drive up to about 75 ma.
    The
    > previous diode advice is absolutely necessary, or you will smoke the
    > transistor.
    >
    > Regards,
    > Ray McArthur
    > >
    > > The relay is a 5v relay, that i can turn on by connectin the Vin
    + VSS
    > > directly, but i know about the current limitations so i dont
    wanna run it
    > > without a transister.
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-28 06:58
    Your relay should draw ~5v/45 ohm=111ma. For good turn-on, reduce the base
    resistor to 470-510 ohms. The diode can be almost anything like a 1N914
    type sold by Radio Shack, a 1N4148, or even a higher current type you may
    have around. Connect the diode across the relay coil with the band
    (cathode) on the power supply side of the coil. If this doesn't work, try
    another 2222, since the first one may have been damaged by running without a
    diode.

    Good luck,
    Ray McArthur

    Original Message
    From: <immolation@h...>

    > Hmm, what kind of diode should i use, and how should i hook it up?
    >
    > My relay's:
    > 5 VDC DPST - N.O.
    > Mfg. - GUARDIAN
    > Mfg. # 1665S-2A-5D
    > 1-1/8" x 1/2" x 1"
    > 5 amp @ 30 VDC/120 VAC
    > Coil resistance: 45 ohm
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-28 07:02
    Gotcha, i probably cooked the first two transistors i tried then, i
    ordered 30 PN2222A online, radio shack is too expensive for lots of
    stuff =)

    thanks for help, i'll post again if i have problems

    one more question, because of the 16 port limit, i'm limited
    obviously to how many relays i can drive, is there an add on IC that
    i can control that will allow me to individually turn on/off relays
    via some method?

    Thanks again

    --- In basicstamps@y..., "Ray McArthur" <rjmca@u...> wrote:
    > Your relay should draw ~5v/45 ohm=111ma. For good turn-on, reduce
    the base
    > resistor to 470-510 ohms. The diode can be almost anything like a
    1N914
    > type sold by Radio Shack, a 1N4148, or even a higher current type
    you may
    > have around. Connect the diode across the relay coil with the band
    > (cathode) on the power supply side of the coil. If this doesn't
    work, try
    > another 2222, since the first one may have been damaged by running
    without a
    > diode.
    >
    > Good luck,
    > Ray McArthur
    >
    >
    Original Message
    > From: <immolation@h...>
    >
    > > Hmm, what kind of diode should i use, and how should i hook it up?
    > >
    > > My relay's:
    > > 5 VDC DPST - N.O.
    > > Mfg. - GUARDIAN
    > > Mfg. # 1665S-2A-5D
    > > 1-1/8" x 1/2" x 1"
    > > 5 amp @ 30 VDC/120 VAC
    > > Coil resistance: 45 ohm
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-28 14:00
    [font=arial,helvetica]Hi,
    ·········I I've found that the easiest way to drive relays is to use a relay
    driver like the ULN 2803 it only cost . 50 cents from mouser Electronics.
    Using the 2803 you would connect pin 0 to pin(1) 0f the 2803 ·and pin(18) ·to
    the coil of the relay and the other end of the coil goes to V+. When Pin(0)
    goes High Pin(18) goes Low which cause the relay to latch.
    [/font]
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-28 14:34
    A few thing relevant to this thread:

    1) Since the Basic Stamp FAQ was mentioned, I wanted to point out that just
    below the passage quoted is this text:

    -- begin quote
    Don't use this to power an AC lamp! There you'll want to use a relay (easy
    and safe) or some sort of AC switching device like an SCR. If you use a
    relay, you can wire the coil like the lamp, but be sure to put a diode
    across the coil with the banded end towards the power, and the non-banded
    end towards the collector of the transistor. This prevents fast changes in
    the coil current from generating large voltages that can fry the transistor.
    -- end quote

    Maybe I should explicitly say "If you use a relay (for AC or DC
    switching)..." On rereading this, I see where you might think it only
    applies if you are switching AC. Of course, doesn't matter what you are
    switching -- the coil operates the same way.

    2) If you want to expand the number of I/O pins on the Stamp, check out the
    PAK-III and PAK-IV. Also, the PAK-I and PAK-II do floating point math and
    have 8 or 16 extra I/O pins for your program.

    Regards,

    Al Williams
    AWC
    * Expand your Stamp I/O: http://www.al-williams.com/awce/pak3.htm


    >
    Original Message
    > From: immolation@h... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=oMjin7wOfiW0a7u7izU24Ilw31ETcu4wD-Z3jO7DzgwpJBqRz-lfzc2eMP5Ni93GiW109uKkZ2FX7XuRdQw]immolation@h...[/url
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-28 15:30
    The transistors are probably ok but just didn't have enough base drive to
    give you enough current to drive the relay. Try changing the resistor first
    and it may work.


    At 07:02 AM 2/28/01 -0000, you wrote:
    >Gotcha, i probably cooked the first two transistors i tried then, i
    >ordered 30 PN2222A online, radio shack is too expensive for lots of
    >stuff =)
    >
    >thanks for help, i'll post again if i have problems
    >
    >one more question, because of the 16 port limit, i'm limited
    >obviously to how many relays i can drive, is there an add on IC that
    >i can control that will allow me to individually turn on/off relays
    >via some method?
    >
    >Thanks again
    >
    >--- In basicstamps@y..., "Ray McArthur" <rjmca@u...> wrote:
    >> Your relay should draw ~5v/45 ohm=111ma. For good turn-on, reduce
    >the base
    >> resistor to 470-510 ohms. The diode can be almost anything like a
    >1N914
    >> type sold by Radio Shack, a 1N4148, or even a higher current type
    >you may
    >> have around. Connect the diode across the relay coil with the band
    >> (cathode) on the power supply side of the coil. If this doesn't
    >work, try
    >> another 2222, since the first one may have been damaged by running
    >without a
    >> diode.
    >>
    >> Good luck,
    >> Ray McArthur
    >>
    >>
    Original Message
    >> From: <immolation@h...>
    >>
    >> > Hmm, what kind of diode should i use, and how should i hook it up?
    >> >
    >> > My relay's:
    >> > 5 VDC DPST - N.O.
    >> > Mfg. - GUARDIAN
    >> > Mfg. # 1665S-2A-5D
    >> > 1-1/8" x 1/2" x 1"
    >> > 5 amp @ 30 VDC/120 VAC
    >> > Coil resistance: 45 ohm
    >
    >
    >
    >
    >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
    Larry G. Nelson Sr.
    mailto:L.Nelson@i...
    http://www.ultranet.com/~nr
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-28 16:07
    Ray,

    Can you help me understand how you came to the 470-510 ohm recommendation?
    For some reason transistors are so foreign to me. I can usually make the
    circuit (simple switching) work, but don't really know what values I should
    be using, now how to select an appropriate transistor for the load I wish to
    drive, etc.

    -- Mitch

    Original Message
    From: Ray McArthur [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=balX1tq3w_Gqt3tARmDJLrUS5GLY2OfpH-PvGm6iMFh0byEfUH3FANix9k-MkeuCjEZgqv9xsIbbMsU]rjmca@u...[/url
    Sent: Wednesday, February 28, 2001 12:58 AM
    To: basicstamps@yahoogroups.com
    Subject: Re: [noparse][[/noparse]basicstamps] Re: Driving a relay


    Your relay should draw ~5v/45 ohm=111ma. For good turn-on, reduce the base
    resistor to 470-510 ohms. The diode can be almost anything like a 1N914
    type sold by Radio Shack, a 1N4148, or even a higher current type you may
    have around. Connect the diode across the relay coil with the band
    (cathode) on the power supply side of the coil. If this doesn't work, try
    another 2222, since the first one may have been damaged by running without a
    diode.

    Good luck,
    Ray McArthur

    Original Message
    From: <immolation@h...>

    > Hmm, what kind of diode should i use, and how should i hook it up?
    >
    > My relay's:
    > 5 VDC DPST - N.O.
    > Mfg. - GUARDIAN
    > Mfg. # 1665S-2A-5D
    > 1-1/8" x 1/2" x 1"
    > 5 amp @ 30 VDC/120 VAC
    > Coil resistance: 45 ohm





    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-28 16:42
    On our microprocessor-based equipment at work, we always used an
    opto-isolator to separate our logic-level stuff from the AC stuff. This was
    for safety as well as legal reasons.

    Our equipment uses 110 volt relays, so we use an opto-isolator to drive a
    triac, which drives the relay coil. A similar circuit could be used for the
    Basic Stamp stuff.

    Original Message

    > A few thing relevant to this thread:
    >
    > 1) Since the Basic Stamp FAQ was mentioned, I wanted to point out that
    just
    > below the passage quoted is this text:
    >
    > -- begin quote
    > Don't use this to power an AC lamp! There you'll want to use a relay (easy
    > and safe) or some sort of AC switching device like an SCR. If you use a
    > relay, you can wire the coil like the lamp, but be sure to put a diode
    > across the coil with the banded end towards the power, and the non-banded
    > end towards the collector of the transistor. This prevents fast changes in
    > the coil current from generating large voltages that can fry the
    transistor.
    > -- end quote
    >
    > Maybe I should explicitly say "If you use a relay (for AC or DC
    > switching)..." On rereading this, I see where you might think it only
    > applies if you are switching AC. Of course, doesn't matter what you are
    > switching -- the coil operates the same way.
    >
    > 2) If you want to expand the number of I/O pins on the Stamp, check out
    the
    > PAK-III and PAK-IV. Also, the PAK-I and PAK-II do floating point math and
    > have 8 or 16 extra I/O pins for your program.
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-28 17:02
    Have a look at http://www.al-williams.com/wd5gnr/stampfaq.htm#s2.29

    Regards,

    Al Williams
    AWC
    * Floating point math for the Stamp, PIC, SX, or any microcontroller:
    http://www.al-williams.com/awce/pak1.htm

    >Can you help me understand how you came to the 470-510 ohm recommendation?
    > For some reason transistors are so foreign to me. I can usually make the
    > circuit (simple switching) work, but don't really know what
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-28 21:00
    Mitch:
    The Al Williams post is a good answer. I can summarize the way we arrived
    at ~470 ohms for the base drive. Since the relay would draw 111 ma from the
    5V supply, we know the 2N2222 collector current=111ma. Bipolar transistors
    "amplify" the current into their base. This current gain is called hfe, or
    beta. So to get 111 ma collector current, we must drive the base with
    111ma/hfe. What is hfe for the 2222? If you look at the gain curves, it
    varies from hundreds to less than 10, depending on collector volts and amps.
    For use as a switch, we want to turn it on hard so as to drop little voltage
    across the transistor, and provide full voltage to the load. This also
    keeps the 2222 cool since transistor power dissipation is collector-emitter
    volts*collector amps. The gain curves indicate a gain of 10 to 20 when the
    2222 is turned on hard, (like 0.1 Volts collector). So, 111ma/10 =11.1 ma
    needed for the base. The base-emitter looks like a diode, so it will rise
    to ~0.7 volts when the Stamp pin goes high. Stamp pin output is almost 5
    volts, so, (5v-0.7v)=4.3 volts across the base resistor. Since we need 11.1
    ma base current, Rbase=4.3v/11.1ma=387 ohms. Doing the same assuming hfe of
    20 yields 774 ohms for Rbase. The 470 to 510 ohms is an in-between range
    that should work. You can assume this "forced beta" value of 10-20 for most
    small high-gain transistors used as a switch.

    Ray McArthur

    >
    > Can you help me understand how you came to the 470-510 ohm recommendation?
    > For some reason transistors are so foreign to me. I can usually make the
    > circuit (simple switching) work, but don't really know what values I
    should
    > be using, now how to select an appropriate transistor for the load I wish
    to
    > drive, etc.
    >
    > -- Mitch
    >
    >
    > Your relay should draw ~5v/45 ohm=111ma. For good turn-on, reduce the
    base
    > resistor to 470-510 ohms. The diode can be almost anything like a 1N914
    > type sold by Radio Shack, a 1N4148, or even a higher current type you may
    > have around. Connect the diode across the relay coil with the band
    > (cathode) on the power supply side of the coil. If this doesn't work, try
    > another 2222, since the first one may have been damaged by running without
    a
    > diode.
    <<< snip >>>.
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-28 22:02
    Just to add to your analysis Ray,

    Say you have a 50 ohm load between 5V and the collector. Further, say you
    deliver 1mA into the base (as Ray described) and the Beta is 50. With 1mA
    in, and Beta=50, the collector current should be 50mA.

    So if the R is 50 and I is .05, you have a voltage drop of 2.5V. Since the
    supply is 5V, the collector voltage must also be 2.5V. If the base current
    were 500uA (.5mA) then the collector current would be 25mA and the voltage
    across the load would be (50x.025) 1.25V. Therefore, the collector must be
    at 5-1.25= 3.75V.

    However, what if you increase the base current to 2mA? Now the Ic=100mA and
    the voltage across the load has to be 5V. That means the collector must be
    at 0V. The problem is, the transistor can't get to 0V -- .1V would be good
    and .2V is probably more realistic. So before you get to this point, the
    simple model we all use for the transistor quits working. Ic <> B*Ib (in
    English, Collector current DOES NOT equal Beta times base current).

    Crank that base current up some more! 3mA, now the calculation says the
    current has to be 150mA, but it can't be and it isn't. That would require
    7.5V across the load or -2.5V on the collector. I'm assuming the emitter is
    grounded in all of these cases.

    So the reality is that once the collector reaches about .2V or so, it is all
    over and we call that point saturation. As the name implies, adding more
    (base current) when you are saturated doesn't really make any difference.

    So for switching you'd like to go into saturation, and you want some safety
    margin, but you usually don't want to overdrive it unnecessarily. So when
    you hear the term saturation, now you know what it means.

    If the analysis seems confusing check out
    http://www.al-williams.com/wd5gnr/basiccir.htm

    Good luck!

    Al Williams
    AWC
    * 8 channels of PWM: http://www.al-williams.com/awce/pak5.htm


    >
    Original Message
    > From: Ray McArthur [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=KLGTARr3UY4y3s31Y1SoDf-H0nZhD-QuyOQ4sYdtDoCX-G6eKRzFC71b2hXeOIHGbr9_GSkHoUwX5G4Y]rjmca@u...[/url
    > Sent: Wednesday, February 28, 2001 3:00 PM
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-01 02:17
    Very good, Al. That is why I used the term "forced beta", but decided to
    keep it simple.

    Regards,
    Ray McArthur

    Original Message
    From: Al Williams <alw@a...>
    To: <basicstamps@yahoogroups.com>
    Sent: Wednesday, February 28, 2001 5:02 PM
    Subject: RE: [noparse][[/noparse]basicstamps] Re: Driving a relay


    > However, what if you increase the base current to 2mA? Now the Ic=100mA
    and
    > the voltage across the load has to be 5V. That means the collector must be
    > at 0V. The problem is, the transistor can't get to 0V -- .1V would be good
    > and .2V is probably more realistic. So before you get to this point, the
    > simple model we all use for the transistor quits working. Ic <> B*Ib (in
    > English, Collector current DOES NOT equal Beta times base current).
    >
    >
    > So for switching you'd like to go into saturation, and you want some
    safety
    > margin, but you usually don't want to overdrive it unnecessarily. So when
    > you hear the term saturation, now you know what it means.
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-01 15:09
    So ... the next question is where to find these specs? I know you can find
    specs. from many manufacturers, but where do I go to find specs on a
    run-of-the-mill 2n2222? I don't want to spend $8 just to get a $0.10
    transistor that has specs.<g> Using known resistances, and voltages, can
    you effectively measure beta? Ie: If I use the example Al gave (his Voltage
    amplifier example), can I measure the Vce, knowing Ib, Rb and Rc and do some
    calculations to approximate beta (sufficiently enough for basic switching
    usage ... most of what I do is switching ... at least for now).

    Thanks,
    Mitch


    Original Message
    From: Ray McArthur [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=ZDDN87X3wy1VCNv-QXsn3ABEXupQ-1ybC8Fqe-0rOFu9QHelDTpyOGikbDgHUXq-QuTwxVaHhCDu6NgfOQ]rjmca@u...[/url
    Sent: Wednesday, February 28, 2001 8:18 PM
    To: basicstamps@yahoogroups.com
    Subject: Re: [noparse][[/noparse]basicstamps] Re: Driving a relay


    Very good, Al. That is why I used the term "forced beta", but decided to
    keep it simple.

    Regards,
    Ray McArthur

    Original Message
    From: Al Williams <alw@a...>
    To: <basicstamps@yahoogroups.com>
    Sent: Wednesday, February 28, 2001 5:02 PM
    Subject: RE: [noparse][[/noparse]basicstamps] Re: Driving a relay


    > However, what if you increase the base current to 2mA? Now the Ic=100mA
    and
    > the voltage across the load has to be 5V. That means the collector must be
    > at 0V. The problem is, the transistor can't get to 0V -- .1V would be good
    > and .2V is probably more realistic. So before you get to this point, the
    > simple model we all use for the transistor quits working. Ic <> B*Ib (in
    > English, Collector current DOES NOT equal Beta times base current).
    >
    >
    > So for switching you'd like to go into saturation, and you want some
    safety
    > margin, but you usually don't want to overdrive it unnecessarily. So when
    > you hear the term saturation, now you know what it means.
    >





    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-01 15:25
    Nearly all of the major guys make JEDEC parts and will have data sheets for
    them (that 2N2222 is a JEDEC number which stands for something, but I don't
    know what).

    However, let me point out yet one more thing. Beta is a bad design
    parameter. That's one reason you want a margin on your saturation. Beta
    varies wildly based on process variation (manufacturing), temperature, and
    other factors.

    For example, if you decided you wanted to build an audio amplifier, the
    right way to do it would NOT be to just use the circuit we've been talking
    about and use the Beta calculations. Instead, you provide biasing so that --
    as long as Beta is over some low number -- your gain is set by resistors.
    This results in less gain, but greater stability. Thermal runaway is
    particularly nasty since higher temperatures increase beta, which increases
    gain, which increases temperature, which increases beta.... that's why the
    call it runaway.

    Now none of this has to do with switching, so you are fine. I just didn't
    want to give anyone the wrong idea.

    I could go on about how to design a normal amplifier, but I won't -- it is
    sort of OT. Maybe an article for my site if I can find the time.

    Here's the Phillips data for a 2N2222A:
    http://www-us6.semiconductors.com/pip/2N2222_CNV_2

    Regards,

    Al Williams
    AWC
    * Floating point math for the Stamp, PIC, SX, or any microcontroller:
    http://www.al-williams.com/awce/pak1.htm


    >
    Original Message
    > From: M. D. Miller [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=YeoWMRXdNFb7wzvHxpPVWWr1r8nfeCSLbutvLMXcp1-c8CjL86ZUBlAv1fijMQfZTrK4wnwExvk]mdmiller2@h...[/url
    > Sent: Thursday, March 01, 2001 9:09 AM
    > To: basicstamps@yahoogroups.com
    > Subject: RE: [noparse][[/noparse]basicstamps] Re: Driving a relay
    >
    >
    > So ... the next question is where to find these specs? I know
    > you can find
    > specs. from many manufacturers, but where do I go to find specs on a
    > run-of-the-mill 2n2222? I don't want to spend $8 just to get a $0.10
    > transistor that has specs.<g> Using known resistances, and voltages, can
    > you effectively measure beta? Ie: If I use the example Al gave
    > (his Voltage
    > amplifier example), can I measure the Vce, knowing Ib, Rb and Rc
    > and do some
    > calculations to approximate beta (sufficiently enough for basic switching
    > usage ... most of what I do is switching ... at least for now).
    >
    > Thanks,
    > Mitch
    >
    >
    >
    Original Message
    > From: Ray McArthur [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=nn3vqMgFFdzFK8wXxeUwTLr-lF23g3zSmJnleUeklEj4Si2wR8VL_3AJkHYW8tfTbTQxBfgnd1ZQlKC8c2dD]rjmca@u...[/url
    > Sent: Wednesday, February 28, 2001 8:18 PM
    > To: basicstamps@yahoogroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] Re: Driving a relay
    >
    >
    > Very good, Al. That is why I used the term "forced beta", but decided to
    > keep it simple.
    >
    > Regards,
    > Ray McArthur
    >
    >
    Original Message
    > From: Al Williams <alw@a...>
    > To: <basicstamps@yahoogroups.com>
    > Sent: Wednesday, February 28, 2001 5:02 PM
    > Subject: RE: [noparse][[/noparse]basicstamps] Re: Driving a relay
    >
    >
    > > However, what if you increase the base current to 2mA? Now the Ic=100mA
    > and
    > > the voltage across the load has to be 5V. That means the
    > collector must be
    > > at 0V. The problem is, the transistor can't get to 0V -- .1V
    > would be good
    > > and .2V is probably more realistic. So before you get to this point, the
    > > simple model we all use for the transistor quits working. Ic <>
    > B*Ib (in
    > > English, Collector current DOES NOT equal Beta times base current).
    > >
    > >
    > > So for switching you'd like to go into saturation, and you want some
    > safety
    > > margin, but you usually don't want to overdrive it
    > unnecessarily. So when
    > > you hear the term saturation, now you know what it means.
    > >
    >
    >
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-01 16:52
    > I could go on about how to design a normal amplifier, but I won't -- it is
    > sort of OT. Maybe an article for my site if I can find the time.

    I'll plan on finishing up my recently-purchased copy of The Art of
    Electronics to get these details (when I need them).

    Thanks for all your help, Al.

    -- Mitch
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-02 05:39
    [font=arial,helvetica]In a message dated 3/1/01 10:01:28 AM US Mountain Standard Time,
    nr@ma.ultranet.com writes:


    The transistors are probably ok but just didn't have enough base drive to
    give you enough current to drive the relay. Try changing the resistor first
    and it may work.



    try the circuit again but ·use a 390 resistor for RB..... let me know how it
    works out
    [/font]

  • ArchiverArchiver Posts: 46,084
    edited 2001-05-14 13:58
    I know this has been asked more times than anyone wants to answer it,
    but a quick search through the back logs of this forum haven't
    revealed an answer. I know that to drive a relay with a stamp I need
    to run it to a transistor. I am assuming the circuit is the same as
    the one in the parallax catalog for running a motor. I have also
    heard that a diode is needed in the circuit somewhere. I went out
    and bought some 1A rectifier diodes (I am beginning to think that is
    the wrong kind) so I could run my 600ma motor. My biggest question
    is where do I put the diode? The people I have talked to just say
    you need a diode, but not what to connect it to. Thanks for your
    time, and if you are going to reply, please do it off-list because I
    don't check here often.
  • ArchiverArchiver Posts: 46,084
    edited 2001-05-15 19:48
    PTT:
    The PTT is forced low and will drive most transmitter PTT circuits. If your
    transmitter has a relay make sure it has a diode in parallel with the coil.
    This prevents reverse voltage spikes from entering the microprocessor. (Fig
    1)

    About reverse voltage spikes :
    Reverse voltage spikes are created when the magnetic field in a coil
    collapses. This can be avoided by adding a diode in parallel with all
    associated relays as in (fig2). Reverse voltage spikes will cause the
    micro-controller to reset and loose its brain. This can damage the IC's in
    any electronics application. This is easily avoided so please follow the
    simple schematic included.

    Both paragraphs taken from RC1P.TXT, and I don't remember where I got them,
    and the author didn't sign it.

    Jason

    Original Message
    From: <yanroy@u...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, May 14, 2001 8:58 AM
    Subject: [noparse][[/noparse]basicstamps] Driving A Relay


    > I know this has been asked more times than anyone wants to answer it,
    > but a quick search through the back logs of this forum haven't
    > revealed an answer. I know that to drive a relay with a stamp I need
    > to run it to a transistor. I am assuming the circuit is the same as
    > the one in the parallax catalog for running a motor. I have also
    > heard that a diode is needed in the circuit somewhere. I went out
    > and bought some 1A rectifier diodes (I am beginning to think that is
    > the wrong kind) so I could run my 600ma motor. My biggest question
    > is where do I put the diode? The people I have talked to just say
    > you need a diode, but not what to connect it to. Thanks for your
    > time, and if you are going to reply, please do it off-list because I
    > don't check here often.
    >
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-05-15 19:52
    They came from N0YOX.
    Sorry, Roger.

    Jason

    Original Message
    From: "n1iic Jason Greene" <n1iic@q...>
    To: <basicstamps@yahoogroups.com>; <yanroy@u...>
    Sent: Tuesday, May 15, 2001 2:48 PM
    Subject: Re: [noparse][[/noparse]basicstamps] Driving A Relay


    > PTT:
    > The PTT is forced low and will drive most transmitter PTT circuits. If
    your
    > transmitter has a relay make sure it has a diode in parallel with the
    coil.
    > This prevents reverse voltage spikes from entering the microprocessor.
    (Fig
    > 1)
    >
    > About reverse voltage spikes :
    > Reverse voltage spikes are created when the magnetic field in a coil
    > collapses. This can be avoided by adding a diode in parallel with all
    > associated relays as in (fig2). Reverse voltage spikes will cause the
    > micro-controller to reset and loose its brain. This can damage the IC's in
    > any electronics application. This is easily avoided so please follow the
    > simple schematic included.
    >
    > Both paragraphs taken from RC1P.TXT, and I don't remember where I got
    them,
    > and the author didn't sign it.
    >
    > Jason
    >
    >
    Original Message
    > From: <yanroy@u...>
    > To: <basicstamps@yahoogroups.com>
    > Sent: Monday, May 14, 2001 8:58 AM
    > Subject: [noparse][[/noparse]basicstamps] Driving A Relay
    >
    >
    > > I know this has been asked more times than anyone wants to answer it,
    > > but a quick search through the back logs of this forum haven't
    > > revealed an answer. I know that to drive a relay with a stamp I need
    > > to run it to a transistor. I am assuming the circuit is the same as
    > > the one in the parallax catalog for running a motor. I have also
    > > heard that a diode is needed in the circuit somewhere. I went out
    > > and bought some 1A rectifier diodes (I am beginning to think that is
    > > the wrong kind) so I could run my 600ma motor. My biggest question
    > > is where do I put the diode? The people I have talked to just say
    > > you need a diode, but not what to connect it to. Thanks for your
    > > time, and if you are going to reply, please do it off-list because I
    > > don't check here often.
    > >
    > >
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
    > >
    > >
    >
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
Sign In or Register to comment.