Relay Problems
coopep
Posts: 2
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.
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
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.
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??