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

Relay Problems

coopepcoopep Posts: 2
edited 2013-03-06 13:27 in BASIC Stamp
hello,

i'm trying to make a really simple project but can't understand what i do wrong...
I built a homemade spot welder from an old microwave oven and i want to make a device with wich i can presisly control the way it works.
so i had a basic stamp 2 laying around and i told myself i could use it to control the bursts and there durations.

so i buld the circuit on the breadboard and put a led light where the relay would be to execute the code and see the results.

i figured that with the use of 2 buttons i could initiate the burst sequence with one and have other sequences stored in the code and pass from one sequence to another with the second button.

so, with the led all is working well. i can put as much sequences i want and all of them are working great. even when i use the relay it is working.

the problem is when i hook up the spot welderto the relay.

then at certain moments when the relay is supposed to close for a certain period of time and then open again, the program crashes and the relay stays closed, potentially causing damage to whatever i would weld at the time.

there is the code and i am marking where the program crashes.

' {$STAMP BS2}
' {$PBASIC 2.5}
PAUSE 1000
PROG1:
FREQOUT 15, 250, 1400

DO
DEBUG HOME
DEBUG "program 1"


IF (IN5 = 1) THEN <
this part workes fine. when in5 button is pushed then the relay closes when i let it go then the relay opens
HIGH 14
ENDIF
IF (IN5 = 0) THEN
LOW 14
ENDIF
IF (IN13 = 1) THEN
GOTO PROG2
PAUSE 50
ENDIF

PAUSE 50
LOOP

PROG2:
FREQOUT 15, 250, 1400
PAUSE 100
FREQOUT 15, 250, 1400
PAUSE 100

DO
DEBUG HOME
DEBUG "program 2"


IF (IN5 = 1) THEN

HIGH 14
PAUSE 400 <
here it crashes
LOW 14
PAUSE 100


ELSEIF (IN13 = 1) THEN
GOTO PROG3
PAUSE 50
ENDIF

PAUSE 50
LOOP


PROG3:
FREQOUT 15, 250, 1400
PAUSE 100
FREQOUT 15, 250, 1400
PAUSE 100
FREQOUT 15, 250, 1400
PAUSE 100

DO
DEBUG HOME
DEBUG "program 3"


IF (IN5 = 1) THEN

HIGH 14
PAUSE 500 <
here it crashes
LOW 14
PAUSE 500
HIGH 14
PAUSE 500
LOW 14
PAUSE 500


ELSEIF (IN13 = 1) THEN
GOTO PROG1
PAUSE 50
ENDIF

PAUSE 50
LOOP





any ideas why is this happenning???? could it be electromagnetic interferances????????? if this is it, can i protect the board from it???
i will post a circuit diagram when i can.

thank you.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-03-04 09:37
    It's not the program ... it's probably either noise induced in the power supply from the microwave oven power supply or some other interference from the high power circuitry. Good pictures in addition to a schematic will help in figuring out what needs to be done. Any time you switch substantial current with a low power device like a Stamp, particularly when you switch it rapidly and repeatedly, you are going to have problems unless you're extremely careful about filtering and shielding the low power end of things.

    It's also helpful to design high power switches so they fail by opening. If the Stamp stops working or resets or hangs, you'd like a high power relay to turn off. Often this uses a "fail-safe" timer that actually drives the relay, like a 555 that has to be reset every so often or it will turn off. The Stamp is coupled to the timer's trigger pin via a capacitor so the Stamp has to be running to generate the pulses necessary to keep the 555 timer on.
  • PropNut1960PropNut1960 Posts: 23
    edited 2013-03-05 14:12
    I agree with Mike's suggestions. Another potential problem could be the amount of current going thru the dry contacts of your relay with the welder connected. It may be too much for the contacts and they are sticking. You also didn't mention if you have a diode connected across the relay coil which is probably needed. Have you tried running the entire setup with an LED connected in parallel with the relay? This would show you if the program is working or hanging.
  • coopepcoopep Posts: 2
    edited 2013-03-06 13:17
    hello again and thank you for your support.

    i tested the board 1meter away from the welder and there you go!! it worked!!
    i put it back closer to the welder and it hung again... so it must be some kind of noise or interference.

    but is there a way to sheild it agaist noise and interferences??
  • Mike GreenMike Green Posts: 23,101
    edited 2013-03-06 13:27
    Yes, there are ways to shield a circuit against noise and interference, but we can't give you any specific advice without more information about the circuit. The methods used depend on what's being shielded and what it's being protected against. Sometimes physical separation helps as you've noticed. Good luck with it.
Sign In or Register to comment.