Shop OBEX P1 Docs P2 Docs Learn Events
relay not steady — Parallax Forums

relay not steady

Jayguy5000Jayguy5000 Posts: 139
edited 2007-08-11 18:32 in BASIC Stamp
ok I am controlling a relay with the bs2 high out command. The I/O pin is connected to a transistor and resistor then goes to the relay coil to turn it on and off. I am getting the relay to work but about every 3 seconds the test light I am using flickers off real quick then its back on. why is this happening and how do I make the relay stay steadily on?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Actually I think Im going to add the whiskers to my tank and let it roam, just need to figure out where.

Comments

  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-08-11 16:02
    It sounds like you are simply doing a HIGH pin in your program with no loop. Without looping, the BASIC Stamp will 'cycle' every 2.3 seconds. Use a loop to keep your code running.

    HIGH 5

    DO
    LOOP

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters- Close out on Adapters!
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • Jayguy5000Jayguy5000 Posts: 139
    edited 2007-08-11 16:08
    ok i did a simple

    DO
    high 0
    LOOP

    and now the relay is stuck in the on position, I turned off the bs2 and disconected the batteries to the coil of the relay. I also tried a LOW 0 command. also did a

    DO
    HIGH 0
    PAUSE 1000
    LOW 0
    PAUSE 1000
    LOOP

    and still the light is on. what should I do?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Actually I think Im going to add the whiskers to my tank and let it roam, just need to figure out where.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-08-11 16:17
    Your last posting with the high/pause/low/pause in a loop should turn the relay on for 1 second, then off for 1 second, then repeat. Your description of the wiring ... I/O pin to resistor to transistor base, transistor emitter to ground, transistor collector to relay, relay to relay power source. This sounds correct except that you should have a reverse connected diode across the relay coil terminals (cathode to + power, anode to transistor collector). If it's still not working, perhaps you should give us more information ... like what resistor value, what transistor, what relay? What are your power sources? If you can, post a schematic
  • Jayguy5000Jayguy5000 Posts: 139
    edited 2007-08-11 16:25
    well I really cant post a schematic, but I can tell you I havn't changed the wiring. It was working with the simple HIGH 0 but it was flickering, it would turn on and off every second or two depending on the code. Then I did the DO LOOP and it got stuck in the on position. the resistor is a 470 ohm. the relay is a spst Reed Relay. RAted at 0.5A at 125VAC. requires 5vdc to operate the coil (am using 4AA batteries for that) coil resistance is 250 ohms and the nominal current is 20Ma. the transistor is from top to bottom. N636 2N 5961 or 59G1. and the power source is an extension cord with the positive line cut and connected to both sides of the relay common out.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Actually I think Im going to add the whiskers to my tank and let it roam, just need to figure out where.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-08-11 16:52
    Jay -

    What is the goal here, that seems to be missing?

    If your program falls through to an END statement, you will get the symptoms you are seeing. You can avoid that by ending your program with the STOP command.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Jayguy5000Jayguy5000 Posts: 139
    edited 2007-08-11 16:59
    the goal is to simply control this relay with the bs2. it was working fine until I did the do loop. now its stuck on, I know im being repetitve but im trying to get this relay to turn off some how.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Actually I think Im going to add the whiskers to my tank and let it roam, just need to figure out where.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-08-11 17:25
    Jay -

    As you can probably see by now HIGH will turn it ON and LOW will turn it off. If you put in in a LOOP, it will go ON-OFF, ON-OFF, ON-OFF. If that's not what you want, remove the DO and LOOP commands.

    Please note my comments about using the END statement above. Please also note the comments that Mike Green made above as well.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Jayguy5000Jayguy5000 Posts: 139
    edited 2007-08-11 17:33
    ok I dont suppose I made it clear enough so I will try again. While the stamp is disconected, the battery pack to the relay is disconected. The relay remains ON. no matter what code I send to the bs2 (while connected) the relay remains on. It is stuck in the on posistion. The stamp isn't stopping it. I have done everything you say and the relay remains on without any power to the coil to hold it on. I need to unstuck the relay so it closes.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Actually I think Im going to add the whiskers to my tank and let it roam, just need to figure out where.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-08-11 17:53
    Ah. You've probably damaged the relay and the contacts are welded together. That happens when the load you're trying to control draws a lot more current than the relay is designed to control. Sometimes there's a surge effect where the load draws a lot of current instantaneously and the current requirement drops after a little bit of time (milliseconds). That's still enough energy to weld relay contacts shut. That's partly why I asked about the relay you're using. What kind of load are you switching?

    The relay probably is not fixable. If it's an open relay (rather than sealed in a box) and it's large enough, you can sometimes pry the contacts apart and it'll work again, but not "good as new". Often the contacts are plated or clad with some material to help conductivity and that is melted or vaporized in a small, critical spot.
  • ProfessorwizProfessorwiz Posts: 153
    edited 2007-08-11 17:56
    Sooo, Perhaps the relay went bad, if it remains closed without power to it sounds like it's bad. Has nothing to do with the stamp at that point. If it won't close when the stamp is hooked up, perhaps you toasted the stamp by not having the reverse diode on it? Just a couple thoughts.

    Russ

    Looks like you beat me to the punch, Mike, we must have been typing at the same time.

    Post Edited (Professorwiz) : 8/12/2007 12:25:56 AM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-08-11 17:56
    If the Relay seems to be on with no power then perhaps you’re connected to the NC contacts instead of the NO contacts?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-08-11 18:24
    Also, with reed relays I've seen it happen where load current will produce enough magnetism to hold the reeds closed. This happens more when DC is being used for the load.

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters- Close out on Adapters!
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-08-11 18:28
    Hi jayguy, it might be best to start your design from scratch giving it a little more thought. Before you go anywhere near your Stamp make sure you have the following characteristics of your components

    First establish if the relay works or not using just the recommended power supply, if connecting and disconnecting does not seem to have any effect change the relay out for a new one.

    When you have a relay that works measure the steady ON state current. Replace your transistor with one that has a max collector current rated at·least 4 or·5 times greater than the the value of your relays steady ON state.

    Here a Parallax link to aid you with choosing resistance values and connecting protection diodes, your relay will take the place of the motor in the image.
    http://forums.parallax.com/attachment.php?attachmentid=37701

    Additional information a link to the data sheet for·your existing·transistor
    http://www.fairchildsemi.com/ds/2N/2N5961.pdf

    Jeff T.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-08-11 18:32
    You could use the attached schematic.· Remember, when you're having hardware issues, without a schematic of your setup it's almost impossible to know what could be wrong.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    320 x 240 - 6K
Sign In or Register to comment.