Relay causes picaxe to reset

MORA99

Senior Member
#1
Hi,

I have a picaxe (28x1) connected to a relay board and simplelan.

When the relays dont have any load it can turn on and off all relays without problems.
When I connect a 20Watt lamp on one of the relays, the picaxe very often resets when it turns that relay on/off.

I didnt make the rely board myself, but form what I can see, the output from picaxe is used to drive a transistor that connects 12V (unreg from ac adapter) to the relay, and a diode across the relay coil. (Theres also a resistor from 12v to a led).

I have 0.1uf on the picaxe pins but other than that, no caps are used.

Theres "many" wires around the picaxe with 230Vac when the system is running, isolated ofcause, but could cause some problems ?

Any ideas how to fix it ? :)
 

hippy

Technical Support
Staff member
#2
Sounds like standard induced interference. Add more decoupling capacitors on the board and make sure there are suitably large electrolytic reservoir caps before and after the PICAXE voltage regulator. After that it's ferrite beads, metal boxes and generally a matter of over-engineering. There should be plenty of discussion on the topic via Forum Search;.
 

premelec

Senior Member
#3
and if the additional caps don't fix it try putting the PICAXE in a ferrous can grounded to V- with in and out leads away from 230 wires runing around... could be an induced or statically coupled glitch - bypassing and shielding eventually works...
 
#4
Picaxes hate high currents nearby and it is almost certainly the reason Rev Ed say not to use them in mission critical applications. Do all the things that have been suggested. I have tried all these and eventually it is possible to get enough shielding and isolation to stop resets. One extra idea - use a picaxe to trigger a 555 monostable. At least the picaxe will be able to get the pulse off to the 555 before it resets itself and then the 555 can carry on from there.
 
#5
When/if the new forum format comes out, will we be able to have stickys?
This subject, and variations of it, crop up very regularly.

Maybe someone could post some example circuits to cover decoupling and suppression? Then people can be linked to some clear pointers.

In fact it would be nice if Rev-Ed had a nice pdf link so that people could download a page or of worked examples. {MoanBegin: And it would nice if it was written by someone who could a) Spell, and b) Know the difference between 'lose' and 'loose'. MoanEnd:}
 

MORA99

Senior Member
#6
If the forum search was a bit better it could be useful :)

I now have 0.1uf on simplelan and picaxe, 0.33 on power input at the 7805 0.1uf on the output.

That didnt work.
So I added 10uf on the power output, 0.47uf on the picaxe power pins.
Still didnt work.

I can try some shielding, but I have 14wires going to the relay board, so there is going to be some noise from them.
Would a cap on each of those do any good (8control wires (5V from picaxe), 1x+12V, 5xgnd)


I just tried with a sat reciever and it worked, but both the lamp and a floor fan causes reset, so maybe its only motors and certain adapters (The lamp converts 230Vac to ~15Vac which runs in some metal poles to the lamp.)

Edited by - MORA99 on 29/08/2007 13:04:32
 

hippy

Technical Support
Staff member
#7
Maybe I'm wrong or simply go for over-kill, but I use the largest reservoir caps I have to hand of the right voltage and fit the unit. 22,000uF is not uncommon in my power supplies before the regulator, and I'd feel I were skimping with even 470uF.
 

MORA99

Senior Member
#8
I can hear clicks in my speakers when the picaxe resets too, they are on another socket but same phase.

So its not just picaxe that can "see" the noise.
I will see what I can dig up, I think the largest I have is 1000uf
 

MORA99

Senior Member
#10
Yes, theres a diode across the relay.
I didnt make the relay board myself, otherwise I would have used 5V relays too :)

With 1000uf before the regulator, its a lot better it can turn on and off the lamp without falling over, turning on lamp and fan at the same time did reset it, but not if done one at a time.
 
#11
You could also try a 10µF capacitor on the output of the regulator as well as the 0.01 to 0.1µF caps that should already be on the input and output of a standard Reg design.
 

hippy

Technical Support
Staff member
#12
<i>With 1000uf before the regulator, its a lot better </i>

To me that would suggest going higher, or putting more in parallel. Adding smaller nF even pF caps may also help kill off some noise.

Another trick is to feed the power in through a series inductor. You might even get some joy with the power-in wire twisted round a pencil for a few turns. A couple of turns round a ferrite bead may do the job.

There are really three places interference gets in; up the incoming power lines, on control lines in or out, and superimposed on circuit wiring. It's not easy to guess the nature of any particular interference and it often simply becomes a case of laying protection on protection in a hope of minimising it.

Putting suppressors across the relay contacts, or the power lines of devices causing a problem when switched is another approach. When switching mains, zero-crossover relays can really help.
 
#13
I've only just noticed that both of your loads are VERY inductive. That includes the lamp because it not just a simple bulb but is trnasformer driven. (the fan speaks for itself as it is a motor).

Loads such as flourescent lamps that have the old-fashioned inductive ballasts will also invariably require ferrite beads on all leads connecting to the control board.

These loads will generate massive noise and you will need to protect from both angles, protection AND suppression.
Increasing input capacitance beyond 1000uF is unlikely to improve things. Adding smaller caps 100nF or 10nF MIGHT make a difference.
Even if only to protect the relay contacts, I would strongly suggest putting arc suppression across the contacts. A 1uF capacitor in series with a very low value resistor (ideally 2 to 5 ohms but no more than 20 ohms) should do it. Make sure that the capacitor can handle the voltage being used and is NOT a polarised type. Also be aware that once fitted, there will a very small &quot;leakage&quot; current so the load will no longer fully turn off. This will only be an issue if you assume isolation and touch a wire with your fingers (a silly thing to do anyway) or if the load is very light (eg mains LED lighting) which it is not.

If you are also experiencing resets when the relay switches OFF as well as when it turns on, then contact suppression is essential to eliminate the problem.
 

MORA99

Senior Member
#14
When its done it will be controlling router,switches,2 computers and maybe a table fan.

Not sure if thats better or worse than the stupid lamp.

The relay board is with soldermask so I cant really change its design, only the 14wires going to it.

The picaxe is connected directly to the transistors, maybe I could add a resistor here, although the board is done its vero so small changes can still be made.
 

premelec

Senior Member
#15
Is there a picture of your setup? I'm suspecting some sort of backfeed through the relay driver transistors - optocouplers could kill that or more resistance from the PICAXE pin to the driver transistor. If you have an oscilloscope see if you can see the glitch [though likely the scope will have artifacts from the pulses too]. Persist! Good luck...
 
#16
The loads you mention will mainly contain their own switchmode power supplies. These will actually have the opposite problems of the lamp because they are mainly capacitive.

With 'noise' problems, you should aim to replicate the real load as closely as possible. You are more likely to suffer large inrush currents which could weld your contacts closed. This can be reduced with varistors in series with the relay contacts. They are like a thermistor but are designed to carry high current. When cold, their resistance is high (a few tens of ohms), as soon as current flows, they warm up and the resistance rapidly drops to a very low value. The trickiest part about implementing them is that you must know to a reasnable accuracy what your load is so that you can spec the right ones to use.

Meanwhile, replace the tranformer coupled lamp with a 'normal' incandescent lamp and see if that has a significant improvement.
 
Top