Shop OBEX P1 Docs P2 Docs Learn Events
Problems with drive a 12V DC relay with stamp and switching transistor — Parallax Forums

Problems with drive a 12V DC relay with stamp and switching transistor

ArchiverArchiver Posts: 46,084
edited 2002-10-03 17:14 in General Discussion
Hi,

I'm using 12 volt power supply that is powering my stamp 2 and also
powering a 12 volt relay.

I am using a standard NPN switching transistor(sorry don't have the
specs on it here). I have it set up so the +12v passes through the
solenoid of the relay first then to the collector on the transistor
and finally to ground. When 5 volts (via series resistor) is sent to
the base of the transistor the relay turns on fine with no problems.
This is on a breadboard.

When this circuit is hooked up to the stamp and I send a high signal
through one of the pins. The solenoid turns on but then after a
second or two clicks off momentarily, and continues to do this.

I've monitored the current and normally when the solenoid is active
I'm drawing about 100mA. But when the solenoid clicks off
momentarily, I see the current dip just a little. Also, if I remove
the solenoid and place a resistor in place. I still see the little
dip in current at regular intervals.

Is there something wrong with hooking up the stamp and solenoid to
the same power supply or perhaps with the transistor?

Thanks for any suggestions.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-10-03 17:05
    The Stamp is completing what you told it to do and is going to sleep. In
    other words your code probably sets the pin high and then ends -- so when
    the Stamp reaches the end of your code and runs out of things to do, it goes
    to sleep and all the output pins blip every 2 seconds or so. Put this
    statement at the end of your code:

    END: GOTO END

    This will keep the Stamp running and the relay should stay closed.


    Original Message
    >
    > I'm using 12 volt power supply that is powering my stamp 2 and also
    > powering a 12 volt relay.
    >
    > I am using a standard NPN switching transistor(sorry don't have the
    > specs on it here). I have it set up so the +12v passes through the
    > solenoid of the relay first then to the collector on the transistor
    > and finally to ground. When 5 volts (via series resistor) is sent to
    > the base of the transistor the relay turns on fine with no problems.
    > This is on a breadboard.
    >
    > When this circuit is hooked up to the stamp and I send a high signal
    > through one of the pins. The solenoid turns on but then after a
    > second or two clicks off momentarily, and continues to do this.
    >
    > I've monitored the current and normally when the solenoid is active
    > I'm drawing about 100mA. But when the solenoid clicks off
    > momentarily, I see the current dip just a little. Also, if I remove
    > the solenoid and place a resistor in place. I still see the little
    > dip in current at regular intervals.
    >
    > Is there something wrong with hooking up the stamp and solenoid to
    > the same power supply or perhaps with the transistor?
  • ArchiverArchiver Posts: 46,084
    edited 2002-10-03 17:14
    Are you using the "sleep" command anywhere in your program?

    You most definitely want to use a diode in reverse bias across
    your relay and/or your transistor. I would suggest both.

    Also you should use a resistor between the BASE of the transistor
    and the Stamp I/O. In order to keep the current from the STAMP I/O
    20mA or less you need to at least use a 220 Ohm or higher resistor
    value.

    Note: Use 1.2 instead of .6 if you are using a Darlington transistor

    V_I/O = 5V from Stamp

    ( V_I/O - .6V ) / 20mA = 220 Ohms = R_BASE

    To determine if your transistor is adequate, measure the resistance
    of your relay coil (out of circuit) to determine the amount current
    the relay should demand at 12V

    I = (V_source -.6) / Coil_resistance

    i.e.

    I = (12V - .6) / 50 Ohms

    I = 11.4V / 50 Ohms

    I = 228 mA = Coil_Current

    In this case, your transistor should be rated to dissipate 137mW
    (P = I*V = 228mA * .6) and have a hfe rating of at least 12. Divide
    Coil_Current by BASE_Current (228mA / 20mA = 11.4). Both of these
    values are pretty small.... Typically you would see a hfe of 50 to
    several thousand... in which case lower your BASE_Current to a more
    suitable level. The Idea is, is that you want to saturate your
    transistor as much as possible,


    o--->|---o
    | |
    R_BASE C
    o--COIL--o-->+12V
    I/O >----/\/\--o
    B |
    | E--o o---|<---o
    | | |
    o--/\/\--o
    o-->GND
    100K

    >Hi,
    >
    >I'm using 12 volt power supply that is powering my stamp 2 and also
    >powering a 12 volt relay.
    >
    >I am using a standard NPN switching transistor(sorry don't have the
    >specs on it here). I have it set up so the +12v passes through the
    >solenoid of the relay first then to the collector on the transistor
    >and finally to ground. When 5 volts (via series resistor) is sent to
    >the base of the transistor the relay turns on fine with no problems.
    >This is on a breadboard.
    >
    >When this circuit is hooked up to the stamp and I send a high signal
    >through one of the pins. The solenoid turns on but then after a
    >second or two clicks off momentarily, and continues to do this.
    >
    >I've monitored the current and normally when the solenoid is active
    >I'm drawing about 100mA. But when the solenoid clicks off
    >momentarily, I see the current dip just a little. Also, if I remove
    >the solenoid and place a resistor in place. I still see the little
    >dip in current at regular intervals.
    >
    >Is there something wrong with hooking up the stamp and solenoid to
    >the same power supply or perhaps with the transistor?
    >
    >Thanks for any suggestions.

    Beau Schwabe Mask Designer II - ATL
    National Semiconductor Enterprise Networking Business Unit
    500 Pinnacle Court, Suite 525 Wired Communications Division
    Mail Stop GA1 Norcross, GA 30071
Sign In or Register to comment.