Jeff said:
I've been working on a project that involves switching some relays with a
Basic Stamp microcontroller, with the idea that the relays would be wired
into my house's doorbell circuits. For the microcontroller to close
relay1 would be the same as pushing the front doorbell, to close relay2
would be the same as pushing the back.
Everything works fine. The microcontroller's output pins drive a couple
of switching transistors, which sink the relay coils.
Except that when I actually connect the relays to the doorbell circuits,
when the microcontroller closes the relay, it immediately resets.
This doesn't happen when the relay is connected to nothing, or when it's
connected to LEDs or lightbulbs, so I'm pretty sure it's a matter of
needing to add some filtering caps.
I've had similar problems, driving small electric motors, and I just stuck
whatever capacitors I had lying around whereever they would fit.
I'm hoping that someone can give me some more precise ideas as to what
type and size of capacitors to use, and where exactly they should be
placed.
Hi, Jeff. Sorry for your troubles. You're switching a high-current,
low voltage inductive AC load, and you're getting sparking at the relay
contacts. The EMI Graham mentioned is coming from the sparking at the
relay contacts. That is very probably what's causing your uC to reset.
Here's the drill. First, remember Sesame Street -- "The Solution ...
To Pollution ... Is Dilution!" Speaking seriously, though, the
intensity of the electro-magnetic interference will decrease
dramatically with distance. Ideally, you might want to have the relays
located several feet or more away from your PIC. That can often be
done by putting them on another board and connecting them with a ribbon
cable. However, the arcing of the relay contacts will also lead to
reduced relay life, with pitting on the contacts eventually causing
them to stick. That leads to the second solution, which is snubbing
the relay contact.
When you're switching line volltage, you want to use a resistor in
series with a cap as a snubber across the contacts. A good
non-technical method of intuitively finding appropriate values of R and
C goes as follows:
1) Find the maximum switching current of the relay (often printed on
the side of the relay). Choose a resistor such that the Current across
the resistor would be about 1/2 of that maximum with the switching
voltage applied.
2) Remove the cover from the relay. Place a snubber across the
contacts with a given capacitance. Switch the relay, and see if there
is a visible contact spark. If there is, increase the capacitance and
try again. Find the capacitor value at which the relay contact just
stops visibly sparking, and you're set.
This is actually somewhat easier to do with 120/240VAC switching than
10VAC switching, because your doorbell coil probably draws an amp or
so, more current than many AC loads. Let's assume you have a relay
that can switch three amps, you have a 1 amp load, and you're switching
10VAC. That would mean you'd start with a 6.8 ohm, 2 watt resistor
(10V/1.5A), and find a fairly big AC rated cap that can handle at least
twice the peak voltage (10 * 1.4 * 2 = 28V non-polarized). For a 1 amp
inductive load, I'd assume your ideal would be somewhere between 1uF
and 22uF.
A somewhat easier way to do this is to get a low-voltage MOV surge
suppressor, which can clip the maximum voltage excursion until the
relay contacts are far enough apart to stop the arc. This can be very
effective, because most of the energy from the switching event is
absorbed by the MOV. Littelfuse makes MOVs which will help you here --
I'd like the V24ZA50, which is rated for 14Vrms/18VDC, and isd rated to
take a 100 joule hit. Possibly overkill, but bigger is better here.
Better still is to put the R-C suppressor in parallel with the MOV.
That ensures the maximum voltage across the cap won't exceed the cap's
rated voltage, and also will allow you to reduce cap size (do the above
experiment with the MOV and see for yourself).
I hope this has been helpful. Dilution through distance, and snubbing
are two good first choices. Feel free to post again if you have any
questions.
Good luck
Chris