28X + projectboard freezes up ?!

bonaur

New Member
Hi all.
I need some hints/tips/tricks/help !?
The simple program below runs for approx. 10-15 min. and the it totally freezes up, not even the interrupt works. ?!
Origianlly the projectboard is connected with the AXE033 LCD, but all that code is removed in the program, but that didn't help.
------Program------
'The analouge input on channel 3 are coming
'from an O2 transmitter that gives 0-10VDC (0-20,9% O2)
'the voltage is divided via. to equal resistors and a trim-pot.

'The output 4 is connected to a 5VDC relay with a back emf
'suppression diode across the relay coil.
'The contactor of the relay controls a 230VAC motor.

'The input on pin1 is an other relay (230VAC) the contacts
'shorts the +V and pin1

'The input on pin2 is an normal switch.
------Program------
init:
setint %00000100,%00000100 'Set interrupt pin 2 (Start motor, override)


main:

readadc 3,b10 'read analog channel 3 into b10
if pin1 = 1 then O2eval 'If pin1 id high goto O2 evaualtion
goto main


O2eval:
if b10 > 120 then O2_Too_high 'O2% way too high
if b10 > 105 then O2_High 'O2% high
if b10 > 85 then O2_OK 'O2% OK
if b10 <= 85 then O2_Low 'O2% low
goto main 'Loop


O2_Too_high:
high 4 'start motor
pause 10000 'wait 10 sec.
low 4 'stop motor
pause 5000 'vent 5 sec.
goto main 'Loop


O2_High:
high 4 'start motor
pause 5000 'wait 5 sec.
low 4 'stop sneglemotor
pause 3000 'wait 3 sec.
goto main 'Loop


O2_OK:
high 4 'start motor
if pin1 = 1 then O2_OK 'keep output 4 high as log as input 1 is high
low 4 'stop motor
goto main 'Loop


O2_Low:
pause 3000 'Block motor for 3 sec.
goto main 'Loop


Interrupt:
high 4 'start motor
if pin2 = 1 then Interrupt 'keep output 4 high as long as pin 2 is high
low 4 'stop motor
setint %00000100,%00000100 'reset interrupt pin 2
return 'Return from interrupt
 

moxhamj

New Member
I can't see anything wrong with the code.
My experience with picaxes and 240V is that the switched 240V has to be quite some distance away from the picaxe - 30cm at least.
Solution I finally found was to put the 240V relay/supression diode in one box, and the picaxe in another box 30cm away, with the only connection between the two being the two relay controlling wires. I wraapped these two wires through a toroid a couple of times for good measure.
Two other tricks if that doesn't work - ground all unused pins on the picaxe with 10k resistors and put the picaxe in a metal box and any wire going into or out of that box is wrapped round a small toroid.
But I found physically separating the high and low power parts seems to work. I've also had the hanging problem when switching high amps - eg 60W 12V.
 

BeanieBots

Moderator
Everything that Dr_Acula suggests and check that you have reset pulled high and serin pulled low.
I've also found that fitting ferrite beads on any incomming signal lines helps enormously to prevent fast noise spikes from resetting the PICAXE.
 

bonaur

New Member
Thanks.
Now I've got something to go on.
Would it help if I used a TRIAC instead of a relay for switching 240VAC ?
The 230VAC output is for a motor, and I guess it can give some high spikes when it's turned off. Could a BT139 do the trick (800V/25A) it's well within my needs, but can it handle the spikes ?
The duty-cycle is approx. 2Hz

How about the 230VAC input relay ? Should I re-think that also, to avoid the relay ?

Thanks, again.
Bo Naur.
 

BeanieBots

Moderator
A zero crossing solid state relay would help a great deal but they can be quite expensive. Just switching to a triac will also help because it will not turn off until the current is near zero but it might still give spikes at turn on.
 

premelec

Senior Member
zero crossing opto isolators are not expensive and can be used with a TRIAC - the usual commercial relay expense is in protecting against all kinds of spikes etc I think....
 

steirny

Member
Triacs are fine with motors, but be careful with inductive loads, even with zero crossing. Pay attention to whats called a "snubber circuit". This consists of a series R/C across the triac to suppress spikes and control DV/DT (change in voltage with time).

Without the snuubber you could get all sorts of spurious surges, typically motor at full speed when off is desired.

I once had to fault find a rather berzerk treadmill with an intermittent snubber. Broke a 1" diameter drive shaft before we figured it out. It made an interesting execise protocol for patients as well. I had visions of a patient hurled through the wall into the next room. But we were lucky.
 

BrendanP

Senior Member
Ihad a similar problem with a project. Would run fine for a while and then stop. Iwas told to put decoupling capacitors on the power in lines on the picaxe. 100n ceramic. It fixed the problem.
BTW, I just bought ferrite beads mounted on axial leads from Mouser. Nice and easy to mount on pcb or bread board.
 
Top