Shop OBEX P1 Docs P2 Docs Learn Events
Power 'Pulsing' when pin set high — Parallax Forums

Power 'Pulsing' when pin set high

TantalusTantalus Posts: 6
edited 2008-01-14 22:43 in BASIC Stamp
I recently purchased the Stamp Works Experiment kit with the BSII. I've been trying to switch relays by following several online tutorials, namely using a single transistor. It seems to work, but the relay pulses on and off. The signal from the high pin off of the basic stamp seems to be pulsing. I cleared the stamp and all code except for that which sets the pin to high on boot, and in what is supposed to be a steady high state, it appears to be fluxing. Any ideas? is this normal stamp behavior and if so, is there a way to compensate for the fuxuation so as to keep the relay on?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-14 16:49
    Do you have the protective diode connected in reverse across the relay coil as described in the tutorials? How are you powering the circuit? If you're using a battery, the battery may be weak and the voltage becomes low enough for the Stamp to reset, therefore starting your program again after a brief pause for initialization. When you have questions like this, it's helpful to attach a copy of your program to your message and to attach a drawing of your circuit so we can see what you're doing. Otherwise, we just have to give general suggestions that may be irrelevant.
  • TantalusTantalus Posts: 6
    edited 2008-01-14 17:33
    10-4, I am using a diode across the relay, and I've tried it with a battery and with the 5 volts supplied on the development board. Also with several relays just to rule out a faulty one. The code is just setting pin 10 to high. Give me a few minutes and I'll try to post the schematic and code shortly.
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-01-14 17:43
    Are you using "END" "Stop" or "Sleep"? When the BS2 reads one of those, it goes into a low power state (holding its output pins) BUT 'wakes up' every 2.5 seconds or so, briefly sets all pins to INPUT, then restores them to the state they'd been set to before. This looks like a 'glitch' on the output lines.
  • TantalusTantalus Posts: 6
    edited 2008-01-14 18:09
    Well, this is pulsing about twice a second going from 5.0 v to 4.5 v (or there abouts, it isn't a consistent drop). Working on the schematic now
  • FranklinFranklin Posts: 4,747
    edited 2008-01-14 18:18
    You need to power the relay from a power source other than the stamp board. The onboard regulator can't handle the current.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • TantalusTantalus Posts: 6
    edited 2008-01-14 19:26
    O.K. my schematic drawing skills could use a bit of a touch up. The 'pulsing' power seems to be the norm on all the pins that I set to high by an average of a half a volt. I suspected that the onboard regulator might not be able to handle the relay, despite several on line references suggesting that it could, so I tried to use a battery, but the results were the same: as the pin voltage fluxuates, the transistor switches power to the relay off and on. My transistor isn't the exact same as the one used in the tutorials, so i've ordered several of the correct component from mouser, as well as a few uln2003's. They should be in by the end of the week and I'll be able to find out if that is the problem or not.

    Does anyone else notice a voltage fluctuation on a pin set to high? I'm really just curious as to whether that is normal behavior for the bs2 or not.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-01-14 20:50
    Hello,

    Without a schematic I am only guessing here, but I doubt the issue is with an output pin pulsing. More likely the BASIC Stamp on-board regulator is thermally cycling or the brownout is causing a reset. Also, what code are you using? Unless you have a STOP command or infinite loop, the pin will cycle every 2.3 seconds once the program has completed. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • TantalusTantalus Posts: 6
    edited 2008-01-14 22:12
    I'm just setting a pin to high, there's not really any code to speak of:

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    HIGH 10 'set pin 10 high

    with just that, and no circuit, pin 10 reads 5.0 volts and pulses to 4.5 volts over and over. I've used two multimeters to rule out a faulty one.

    when I connect the relay i'm using Figure 3.5 on page 179 of http://books.google.com/books?id=E0_07GfXo2wC&pg=PA178&lpg=PA178&dq=basic+stamp+relay&source=web&ots=pPNxyOxZag&sig=5SmZwwcTjaWgxg_G9_43yblAZsU#PPA179,M1
    as a schematic except that i'm using an mps2222a instead of a 2n2222a for a transistor.

    The relay cycles in time with the pulses from pin 10
  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-14 22:22
    If you have the diode connected backwards or if the relay is too large (takes too much current), you'll drain the battery or cause the regulator to shutdown due to either overcurrent or overtemperature limits. This will cause the Homework Board to reset and the whole cycle will begin again once the regulator recovers or the battery recovers.

    As Chris mentioned, you don't have a STOP or END statement after the HIGH nor do you have a GOTO to a label before the HIGH and these will cause the 2.3 second cycling he mentioned. It sounds like you're seeing something faster, so the over current / over temperature / overdrawn battery is the more likely cause.

    In any event, the Stamp doesn't normally have a voltage fluctuation on I/O pins set to HIGH. If you see it, it would be due to one of the causes mentioned already. Check your circuit. Check your power supply. Try a "HANG: GOTO HANG" after the HIGH statement to see what happens.
  • TantalusTantalus Posts: 6
    edited 2008-01-14 22:43
    it is fluctuating a lot faster than once every 2.3 seconds, but nevertheless, taking Chris and Mike's advice got rid of it. I'm not sure why it was happening so fast. With:

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    HIGH 10 'set pin 10 high
    HANG: GOTO HANG

    (using STOP also worked)

    the relay stops pulsing, and without the circuit, measured directly between the pin and ground it's a rock steady 5.01v. The relay is firing, but not actually working, which probably has more to do with shopping bulk components on ebay than anything else. Solid state relays have been ordered and are on the way. Thank you guys so much for your help. It's been years since I've messed with anything outside of a computer case and I'm finding the learning curve to be about 90 degrees.

    Thank you again for your help and patience!
Sign In or Register to comment.