Shop OBEX P1 Docs P2 Docs Learn Events
Relay Circuit — Parallax Forums

Relay Circuit

D. AbramD. Abram Posts: 20
edited 2007-01-20 16:57 in BASIC Stamp
I'm trying to control a solenoid valve·with a bs2 on the homework board.· The connections are detailed in the attached gif.

The relay (radio shack 275-240) has the following specs:

coil - 5vdc/89.3mA/56ohms
contact - 1A at 120vac/24vdc

The solenoid is 6-24vdc/19ohms.

My code is as follows:

' {$STAMP BS2}
' {$PBASIC 2.5}
HIGH 1
PAUSE 1000
LOW 1
END

I'm using a seperate 9v battery to power the solenoid.

When the solenoid is not connected everything works OK.· I can hear the relay click on and off.

When I connect the solenoid, the program continually cycles without ending.· There is a brief blink of the power indicator on the stamp board and it repeats the code.·

Any help would be greatly apprecited!
600 x 500 - 5K

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-20 05:21
    1) Download and look a the What's a Microcontroller? tutorial from Parallax's website for the section on controlling solenoids and motors. Partly you need a diode across the relay winding.
    2) Some cross connection is causing the power to the Stamp to fluctuate and the Stamp is resetting. Check your circuit for shorts. If the solenoid is physically close to the relay, it may be inducing a current in the relay coil that is feeding into the +5V supply
  • D. AbramD. Abram Posts: 20
    edited 2007-01-20 05:39
    Mike, Thanks for the quick response!

    I added a 1N4005 across the coil·and put 24" leads on the solenoid to move it further away from the board.

    Just about have the pages worn out on the text you suggested [noparse]:)[/noparse]·

    Still having the problem.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-20 05:45
    Do check for shorts between the circuits
  • D. AbramD. Abram Posts: 20
    edited 2007-01-20 11:27
    Totally rewired to make sure that all connections we're good.·

    Spaced the components further apart on the board.·

    Replaced the resistor, diode, transistor, and relay one at a time in case there was a bad component.

    Still not working when the solenoid is connected.

    Next I tried moved the connection to pin 1 and ran it through a pushbutton to Vdd.· Relay worked as expected with solenoid attached.

    Any clue why I cannot get this to operate when suppling the 5v for the transistor through pin1 but it works fine when connected directly to 5v at Vdd through a push button?
  • D. AbramD. Abram Posts: 20
    edited 2007-01-20 12:09
    Moved on to plan B·using a ULN2003 to try and get the relay to work (see diagram).

    Same result with this setup.

    Tried turning the relay on and off with the following code

    HIGH 1
    PAUSE 1000
    LOW 1
    PAUSE 1000
    HIGH 1
    PAUSE 1000
    LOW 1
    PAUSE 1000
    HIGH 1
    PAUSE 1000
    LOW 1
    PAUSE 1000
    END

    The relay turns on, then off and then the stamp appears to freeze and a low voume high pitch tone can just barely be heard.

    Tried connecting pin 1 of the ULN2003 to Vdd through a push button and·the relay and solenoid worked as expected when the button was pushed.

    I'm stumped confused.gif
    906 x 572 - 9K
  • UnstableUnstable Posts: 7
    edited 2007-01-20 16:39
    check the voltage on the stamp battery while the relay is active. the coil on the relay might be drawing the battery voltage downand hanging/reseting the stamp.

    edit:
    you can try something like this (edit from original in red) (look at my cool MS paint skills tongue.gif )

    Post Edited (Unstable) : 1/20/2007 4:45:17 PM GMT
    600 x 500 - 5K
  • D. AbramD. Abram Posts: 20
    edited 2007-01-20 16:57
    That did it!!! I connected another battery to power the coil and it worked!!!!

    I've worked on this for the last 18 hours with about 2 hours sleep.· You have no idea how much I appreciate the help· smilewinkgrin.gif
Sign In or Register to comment.