I have a simple circuit with a PICAXE that controls a relay board, when the relay board is empty it works fine. But when I put a simple 20W lamp on one of the relays (230Vac) the chip resets very often when that relay starts/stops.
I have a 0.1uf on the power legs of the IC, how do I know what other size is needed to prevent it from resetting. I didnt make the relay board myself, but from what I can see there is no caps on the board.
The relays use 12V where the IC is using 5V. The 12V is from the powerinput, the 5V is from a 7805.
Does the reset pin need a cap? What about the extra 0V pin the chip has (Picaxe 28X1, theres a pin next to serial connection with 0V, although both 0V and VCC is on the other side too).
It would be a really good idea to provide a schematic of your circuit.The description is'nt really crystal clear :) Are you sure that the PICKAXE can supply enough current to the relay board when the lamp is connected?Measuring the current throught the lamp should help.
It is generally a good idea when working with microcontrollers to connect the two pins(Vcc and ground) that are provided on the 2 sides of the chip to each other.This helps the microcontroller to source or sink high current(high as in the maximum values specified in the datasheet)
Have you used diodes between the collector of the transistor and the relay terminal(cathode towards collector)? Otherwise the back current when the relay changes from on to off may be causing the problem.
Relays produce EMI (electro-magnetic interference) particularly when switching off the load.
This EMI can 'couple' into your circuitry and cause random resets and the like. Changing the value of the supply decoupling capacitor is fairly unlikely to do much to affect it. Long pcb traces that form large 'loops' are one of the worst offenders for EMI pickup btw.
How to design for reasonable immunity to EMI is a huge subject in its own right. You may however get some inprovement by lowering the impedance of the reset circuit.
I'd agree with Graham. The relay contact is almost certainly arcing, causing EMI that's being picked up by the microcontroller (more likely through one of the I/O pins, not the power supply), which causes the reset.
I'm hoping you're using a relay rated for 240V service -- if, not, try replacing the it. Relays that aren't made for switching higher voltages have armatures that don't move the relay contacts far enough apart. That will draw nice, juicy arcing which will cause your Picaxe all kinds of problems (and also destroy the relay in short order).
If the relay's OK, you'll have to look elsewhere to solve your problem. Ideally, you'd want to put an inductor in series with the light bulb to limit surge current. But a line rated inductor that can handle that much current can be pretty expensive.
Incandescent loads can be tough, because the turn-on surge current can easily be eight or more times the rated current. Your best bet to start with might be to get a MOV rated for your line voltage, and put that across the relay contacts.
What might also help is adding some series resistance. If you happen to have a 10 watt, 100 ohm wirewound resistor in your junkbox, you might want to put that in series with the lightbulb, too. That will limit the surge current, and also lower the voltage across the relay contact with the arc on make.
Another thing which might help is just putting some distance between the relay and your microcontroller. "The solution...to pollution...is dilution". Let the inverse square law work for you, and get that arc as far away as you can. If your Picaxe and your relay board are a couple of inches apart, you might accomplish your purpose just by moving things around a bit.
I have solved some of the problem with capacitors, its not perfect, but alot better than before.
I added
1000uf before the 7805
0.47uf on the picaxe power pins (that already have 0.1uf)
0.1uf on another mcu component power pins
0.33uf on 7805 input
0.1uf on 7805 power output
It can now switch just about everything I have tried, but a rare few times it still resets.
The boards is fairly close, as they are contained in a medium sized box rated for 230V equipment.
The board is made on vero, the one with 3holes connected, so theres lots of unused traces to pickup emi, although they arent directly connected to the picaxe.
I have 2 free ports on the picaxe, both inputs, would grounding them help anything ?
The relays are rated for 230V 10A each and the system is limited to 5A total by fuse.
Maybe picaxe is just very sentisive, because I did the same system with a SBC65EC board from modtronix and it didnt have any problems with it.
I would be guessing what your schematic is. Below are some techniques and a concept that others have not discussed.
The relay contact is not isolated from relay coil. Electrically there is still a connection (high impedance) between both. You must consider that leakage in your design.
One technique means somehow gets circuits on both sides of the relay to share a common ground. Yes, I know that may cause safety problems which is why the common grounding must be designed carefully.
Second, how does the transistor drive that relay coil? For example, if coil is connected to transistor emitter, then failure is an option. Better designs connect emitter to the power source or ground; collector to relay coil. Now the high voltage base to collector helps isolate the controller from relay wiper. Again, appreciate that the
230 volts on that wiper still connects to relay coil and controller. That circuit is not obvious - often denied by those who assume relay coil and wiper are isolated.
Because of how relays work, we often would make dry connections with other relays, then only power the connection with a special relay that make a non-bounce connection. Sometimes the connection is made via a thyristor - that can turn on DC power but cannot make the disconnect. Disconnect performed mechanically (this assumed DC power). Or even better, use thyristors that hold off their turn on until voltage is zero crossing (this assumes AC power).
Another trick is to put a snubber across energizing relay wiper contacts. A 'softer' make or break means less energy travels through that circuit that connect relay wiper to coil.
And finally, the driver transistor is driven by a buffer transistor so that any currents from emitter or collector of relay coil driver would be connected to power or ground via the buffer transistors - not enter controller via base (or gate) of buffer transistor. Sometimes that buffer transistor is an IGFET so that reverse (isolation) voltage gate to drain and gate to source is more than 20 volts. And or we add limiting resistors to the controller to base circuit to further isolate that controller from the relay coil.
Only then are we ready to add capacitors (or inductors) as high frequency filters to control circuits between controller and relay. All this because the relay wiper - especially at 230 volts - connects current to relay coil - especially higher frequency currents.
Just a few solutions that I have used previously off the top of my head.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.