Shop OBEX P1 Docs P2 Docs Learn Events
Shutdown when using a relay to switch AC — Parallax Forums

Shutdown when using a relay to switch AC

hkymstrhkymstr Posts: 3
edited 2004-08-01 02:34 in General Discussion
I am using the SX28 I have written a program to energize a relay connected to the SX when a button is pressed. The relay energizes a solenoid conneceted to a water facet. The whole system works fine when nothing is connected through the relay, when the button is pressed you can hear the relay close, and when the button is released the relay open. This whole operation can also be visualized in the debug command of the sx-key software. Now when I connected AC power to the relay to energize and denergize the relay and operate the circuit the whole thing locks up. But if I just connect 5V through the relay to turn on an off a LED the whole thing works flawlessly. Am I introducing to much noise into the circuit to mess with the SX28, I can't seem to figure it out?

Any help is appreciated.

Rick

Comments

  • KenMKenM Posts: 657
    edited 2004-08-01 00:22
    Rick,

    Help me to understand......for the end result you want the relay to switch AC power?

    Everyting seems to work ok if you use the relay to switch dc......lighting an LED?

    Although the circuit works with DC, do you have a diode connected (reverse polarity) across the relay coil?

    Although a realy should electrically isolate the switch portion from the control portion it may not be in your case. Not seeing the circuit however it is hard to say.

    An option you may consider trying is to use an opto isolator, and in doing so the only coupling between your SX and the external circuit is light.

    Ken
  • hkymstrhkymstr Posts: 3
    edited 2004-08-01 00:55
    Ken,

    Yes for the end result I would like to switch AC power to a solenoid.

    Everything works okay when switch 5v connected to an LED.

    I do have a diode connected (reverse polarity) across the relay coil.

    As for the circuit I have port (output) RB0 connected to the relay (positive terminal) and the other side grounded, with a diode across the terminals.

    When you say opto isolator do you mean a solid state relay? Is there any other solution to isolate the relay without purchase of an opto isolator.

    Thanks,

    Rick
  • mojorizingmojorizing Posts: 249
    edited 2004-08-01 01:48
    Here's a pic of a transistor doing what you should be using to drive a relay from a output pin.

    IO-PIC16F84-RELAY.gif

    an opto could be used as suggested by Ken. I don't know where I got the GIF, i can't take credit for it, but it was on my harddrive.

    later, Kevin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 kinds of people in the world.... those that know binary, and those that don't.

    Post Edited (mojorizing) : 8/1/2004 1:51:38 AM GMT
  • KenMKenM Posts: 657
    edited 2004-08-01 02:18
    Kevin,

    When I mention opto, I am not speaking of a solid state relay. What I had in mind is a 4N35.

    http://www.fairchildsemi.com/ds/4N/4N35.pdf

    The 4n35 control side is basically a "sealed" LED and the output is typically hooked up as an open collector NPN.

    I would hook it up as follows:

    Connect 330 ohm resistor from + 5 to pin number 1, pin 2 to the SX.

    Pin 6 left open (if not concerned with turn off speed) or pin 6 to ground through a 1k resistor.

    Pin 4 to ground of the SEPERATE power supply

    Pin 5 to the minus side of the relay coil.

    A logic 0 from the SX causes current flow through pins 1 to 2. That in turn turns on the NPN, bringing pin 5 to ground, which in turn turns on your relay.

    I cannot understand however why the relay alone does not work.....it should unless some EMI from the AC is interfering with the SX.

    A breadboard version of an SX based·duty cycle meter I built would stop working when a two way radio in our test car way keyed to talk on the radio, so you might have a similar effect going on with your AC circuit upsetting the SX.

    Might want to look through www.sxlist.com and see if there is any info there in interfacing the SX with AC powered circuits.

    Ken
  • hkymstrhkymstr Posts: 3
    edited 2004-08-01 02:34
    I have narrowed the problem down to this. When pressing a button hooked to the SX to energize a solenoid through the relay it works, the solenoid gets power. When I release the button to denergize and open the relay is when the SX locks up. I can see it visually in the debugger right when the command to set the port connected to the relay goes low the circuit stops working. The circuit works fine if AC is hooked up through the relay in a wait mode. I will try the transistor and the opto isolator.

    thanks,

    rick
Sign In or Register to comment.