PDA

View Full Version : Relay Circuit



D. Abram
01-20-2007, 12:11 PM
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!

Mike Green
01-20-2007, 12:21 PM
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. Abram
01-20-2007, 12:39 PM
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 :)·

Still having the problem.

Mike Green
01-20-2007, 12:45 PM
Do check for shorts between the circuits

D. Abram
01-20-2007, 06:27 PM
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. Abram
01-20-2007, 07:09 PM
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 http://forums.parallax.com/images/smilies/confused.gif

Unstable
01-20-2007, 11:39 PM
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 http://forums.parallax.com/images/smilies/tongue.gif )

Post Edited (Unstable) : 1/20/2007 4:45:17 PM GMT

D. Abram
01-20-2007, 11:57 PM
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· http://forums.parallax.com/images/smilies/smilewinkgrin.gif