Hi.
I have built a very simple programmable switch.
The device uses an 08A, and a relay.
The circuit employs a push button to set off the timer, or to initiate a change in state.
In this case, I programmed the 08 using the TOGGLE command, so that with every press of the trigger button, the relay would change state.
This worked wonderfully, but after being in the "ON" state for around 6 hours or so, the relay drops out, and I can't see how the program could be letting it do this.
:-(
Here is my code:
---------------------------
'Relay controller/Picaxe switch.
'Version 1.0
'This code simply switches a relay on then off with one momentary push-button switch.
'The chip is programmed for the type of switch you want: timer, momentary, toggle, etc.
low 0
low 1
low 2
low 4
start:
if pin3=0 then deb 'Wait for pwr switch to be pressed
goto start
deb:
pause 500 'Debounce the switch contacts
if pin3 = 0 then relay 'Once contacts settle, if still pressed, then goto relay
goto start
relay:
toggle 2 'Toggle state of pin2
wait 2 'Allow relay to operate, and switch to be released
goto start
-------------------------------------
I have used on-board 78L05 regulation, with decoupling and filtering. I have used darlington trasnsistor to switch the relay, with back-EMF protecting diode.
The DC input is 12v, and there is a 2200uF cap across this 12v input for the purposes of acting as a resevior cap and preventing any slight drop in the 12v supply rail causing the relay to drop out. Perhaps I should put a suitable cap across the relay coil aswell?
For the moment, I have bypassed this module, with a simply mechanical toggle switch, but I am curious as to how this could happen.
The input pin used to look for the button, is connected as per the diagram in the manual, with the 10k and 1k resistors.
Any questions?
Please ask.
G.
Edited by - Grogster on 11/17/2005 11:37:20 PM
Edited by - Grogster on 11/17/2005 11:40:57 PM
I have built a very simple programmable switch.
The device uses an 08A, and a relay.
The circuit employs a push button to set off the timer, or to initiate a change in state.
In this case, I programmed the 08 using the TOGGLE command, so that with every press of the trigger button, the relay would change state.
This worked wonderfully, but after being in the "ON" state for around 6 hours or so, the relay drops out, and I can't see how the program could be letting it do this.
:-(
Here is my code:
---------------------------
'Relay controller/Picaxe switch.
'Version 1.0
'This code simply switches a relay on then off with one momentary push-button switch.
'The chip is programmed for the type of switch you want: timer, momentary, toggle, etc.
low 0
low 1
low 2
low 4
start:
if pin3=0 then deb 'Wait for pwr switch to be pressed
goto start
deb:
pause 500 'Debounce the switch contacts
if pin3 = 0 then relay 'Once contacts settle, if still pressed, then goto relay
goto start
relay:
toggle 2 'Toggle state of pin2
wait 2 'Allow relay to operate, and switch to be released
goto start
-------------------------------------
I have used on-board 78L05 regulation, with decoupling and filtering. I have used darlington trasnsistor to switch the relay, with back-EMF protecting diode.
The DC input is 12v, and there is a 2200uF cap across this 12v input for the purposes of acting as a resevior cap and preventing any slight drop in the 12v supply rail causing the relay to drop out. Perhaps I should put a suitable cap across the relay coil aswell?
For the moment, I have bypassed this module, with a simply mechanical toggle switch, but I am curious as to how this could happen.
The input pin used to look for the button, is connected as per the diagram in the manual, with the 10k and 1k resistors.
Any questions?
Please ask.
G.
Edited by - Grogster on 11/17/2005 11:37:20 PM
Edited by - Grogster on 11/17/2005 11:40:57 PM