Shop OBEX P1 Docs P2 Docs Learn Events
bs2 control relay please help — Parallax Forums

bs2 control relay please help

Jose MorenoJose Moreno Posts: 9
edited 2005-02-06 15:42 in BASIC Stamp
smhair.gif
Hi I need help. i'm making this project where a bs2 has to control a 12v· 270 ohms coiled relay
can a 2n2222 transistor drive this relay? and if so
what value resister should I put between the bs2 pin and the transister?

please help

if you need more info please e-mail me personally

Thanks

Jose
confused.gif·

Comments

  • NewzedNewzed Posts: 2,503
    edited 2005-02-02 19:00
    jose, use a TIP120 to drive your relay.· Connect the base of the TIP to a Stamp I/O line via a 1K resistor.· Ground the emitter.· Connect 12VDC to the positive side of the relay coil and the other side of the relay coil to the TIP collector.· Your coil will draw about 45 ma which is a breeze for the TIP.

    The TIP120 is a Darlington transistor and has a built in diode to protect it against kickbacks when the relay opns.· To close the relay, take you Stamp line high - to open it take your Stamp line low.

    That's it.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester?

    http://hometown.aol.com/newzed/index.html
    ·
  • Beau SchwabeBeau Schwabe Posts: 6,557
    edited 2005-02-02 19:07
    Jose,

    There are usually three initial factors that I look for in a datasheet for a transistor.
    1) The 'hfe' or DC Current Gain
    2) The Vceo or Collector Emitter Voltage
    3) The Ic or Collector Current

    http://www.fairchildsemi.com/ds/PN/PN2222A.pdf
    Looking at the datasheet, the hfe varies between 35 and 300 depending on current
    the Vceo is 40V, and the Ic is 1 Amp

    You say 12v with 270 Ohms..... that’s only 44mA (12v/270Ohms = 44mA) so an Ic of 1Amp is plenty and a
    Vceo of 40V is fine as well.

    Assuming an hfe of 35, the minimum amount of current at the Base of the transistor to drive 44mA would be 1.3mA
    (44mA / 35 = 1.3mA)

    As a rule of thumb, I like to double this value to provide adequate transistor saturation, so 2.6mA of Base current

    So to determine the Resistor value to deliver 2.6mA

    Rvalue = (Vsource - V_B-Ediode)/(Base_Current) = ( 5V - 0.6V ) / 2.6mA = 1692 Ohms

    The closest standard value is a 1.5K resistor.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe - Mask Designer III

    National Semiconductor Corporation
    (Communication Interface Division)
    500 Pinnacle Court, Suite 525
    Mail Stop GA1
    Norcross,GA 30071
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-02-06 15:42
    Also you should put a Diode in reverse across the Relay coil pins.· This will protect your transistor from voltage spikes cause when the relay de-energizes.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --==<{Chris}>==--
Sign In or Register to comment.