Connect with us

Filtering relay noise

Discussion in 'Electronic Basics' started by Jeff Dege, Feb 12, 2006.

Scroll to continue with content
  1. Jeff Dege

    Jeff Dege Guest

    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
  2. Pooh Bear

    Pooh Bear Guest


    ElectroMagnetic Interference.
    Depends on the type of load and whether you're switching ac or dc etc.....

    Details ?

  3. Chris

    Chris Guest

    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

    Good luck
  4. Jeff Dege wrote:
    The contact arching is producing lots of high frequency energy that is
    getting back into the microprocessor, especially into the master clear
    pin, evidently. You can attack this at both ends. You can try to
    make the microprocessor circuits more robust and you can add filters
    to the relay contacts, to reduce their high frequency generation.
    Probably the simplest in this case is a series RC connected directly
    across the contact. If the load is a low voltage door bell, try
    something like 22 ohms and a .47 uF 100 volt mylar capacitor.

    As far as making the micro more robust, you have to look at what
    opportunities you have created for energy in the contact wiring to
    couple back to the relay coil wiring and back to other microprocessor
    lines and components.

    Is the contact wiring well separated from the driver side wiring? Id
    the micro enclosed in a grounded metal box?

    Is there some grounded capacitance on the reset pin?

    Is the coil of the relay bypassed with a diode to cut the coil spike
    when the coil is de energized?

    Is there a bypass capacitor across the coil and driver transistor?
  5. Jeff Dege

    Jeff Dege Guest

    As isolated as it can be, given the physical constraints.
    The reset pin is pulled high, internally. I'm not using it, so I've
    not connected anything to it.
    No. Where should this be, and what would its value be?

    A complex system that works is invariably found to have evolved from a
    simple system that worked ...A complex system designed from scratch never
    works and cannot be patched up to make it work. You have to start over,
    beginning with a working simple system.
    -- Grady Booch
  6. Jeff Dege

    Jeff Dege Guest

    "Across the contacts" means across the switch terminals (i.e., not across
    the coil terminals)?
    By "visible spark", you mean in a lighted room? Or should I turn off the
    My multi-meter says the doorbell is 20VAC. I've had other people tell me
    it's spec'ed at 16VAC - which would be consistent if my meter was
    returning peak-to-peak and the spec was RMS.

    But there can't be many all that many amps through the thing - bell wire
    is 18 gauge.
    The V24ZA50 is a non-stock item in Digikey's catalog, with a minimum order
    of 1500 units. But I'm sure they stock something equivalent.
    I'll give it a try.
    It's been a lot of help - not just in giving me approaches to solving the
    problem, but in explaining the issues well enough that I can do a web
    search and find more detail about what's going on.

    (I'm a software type playing around with circuits as a hobby, and while
    the digital stuff is simple enough, when it comes to the analog issues, I
    often don't know what questions to ask.)
  7. Jeff Dege

    Jeff Dege Guest

    The load is a standard household doorbell - 16VAC driving a solenoid.

    Liberty, at bottom, is a simple thing, whatever its outward forms.
    It is common faith in man, common good will, common tolerance and charity,
    common decency, no less and no more. Translated into political terms, it
    is the doctrine that the normal citizen of a civilized state is actually
    normal - that the decency which belongs naturally to homo sapiens, as an
    animal above the brutes, is really in him. It holds that this normal
    citizen may be trusted, one day with another, to do the decent thing.
    It relies upon his natural impulses, and assumes them to be sound.
    Finally, it is the doctrine that if these assumptions are false, then
    nothing can be done about it - and if human beings are actually so bad,
    then none is good enough to police the rest.
    - H. L. Mencken
  8. A .1 to .47 uF film or ceramic should connect the emitter (or source)
    or the driver transistor to the supply connection of the coil, acting
    as a local power source for the edges of the power pulse applied to
    the coil.
  9. Are you absolutely sure that, in this mode, the pin is immune to
    noise? Is it worth doing the experiment of connecting the pin to
    ground with a .1 uF ceramic cap, to see if this alters the result?
  10. Pooh Bear

    Pooh Bear Guest

    Very much agreed. I suspect it may not have been intended to leave it

  11. Chris

    Chris Guest

    Hi, Jeff. You've got a 16VAC system rather than a 10VAC system, but
    most things are kind of the same. Let's see...

    Before anything else, I'm assuming you have a diode across your relay
    coil already. If not, that definitely could cause your processor to
    reset. Lenz' Law will rear its angry head, and put a voltage spile on
    the switching side of the coil that will feed into your processor
    output pin or power supply, if it doesn't kill the switching
    transistor. Put a 1N400X diode directly across the coil as shown
    _now_. That should have been first.

    1) "Across the contacts" means directly next to, and in parallel with,
    your switch contacts. It should look like this (view in fixed font or
    M$ Notepad):

    | VCCVCC .----- o --------o-----------------.
    | + + | | | |
    | | | | |6.8 ohms | |
    | | | RY1 | .-. | .-.
    | - C| o | | .-. | |
    | ^ C| - - - - \ | | | | MOV | |
    | | C| \ '-' | |(optional) '-' Load
    | | | o \ | R-C | | | (Doorbell)
    | '--o | |Snubber | | |
    | | | | '-' C|
    | | | --- | C|
    | |/ | --- | C|
    | -| | |2.2uF | |
    | |> | | | |
    | | '------o---------o-----------------'
    | |
    | ===
    | GND
    (created by AACircuit v1.28.6 beta 04/19/05

    2) It helps to turn down the lights, but all you really need to do is
    keep it out of sunlight, and put a cardboard box cover over your stuff
    so there's no shop light shining directly on it. You don't have to be
    picky about this -- it's "rule of thumb" here. If you want technical
    rigour, look toward s.e.d. ;-)

    You assume you've got a 1 amp load with doorbells and chimes -- it
    could be less, and could be a little more. Most bell transformers are
    rated for about an amp. We're trying to be non-technical with this, so
    I just made some assumptions.

    By the way, since you've got a 16VAC system (you're reading 20VAC
    unloaded), the choice for MOV isn't correct. Try the Littelfuse V47Z20
    (Mouser P/N 576-V47ZA20, in stock, $0.42 ea. in single qty). For caps,
    you might want to look first at what you have in your junkbox. This
    all presupposes you can substitute the caps in the snubber for optimum.
    But if not, you might want to look at

    and find a good cap. In order to complete things, if you don't happen
    to have a well-stocked junkbox, here's your shopping list from Mouser:

    1N4002 diode (625-1N4002)
    6.2 ohm, 3 watt wirewound resistor (72-RWM410-8R2-5)
    1.0uF 100V Metallized Poly Film cap ( 581-BN154E0105K)
    30vRMS, 20mm MOV (576-V47ZA20)

    Use these together, make an effort to get the relay physically farther
    away from your PIC, and you should be OK.

    Good luck
  12. John Fields

    John Fields Guest

  13. Guest

    Are you assuming that I'm driving the relay coil with a PNP transistor?

    I'm sinking the relay coil with an NPN transistor:

    | \
    .------_ o o---
    | )|
    - )|
    ^ _)'-----.
    ___ |/
    (created by AACircuit v1.28.6 beta 04/19/05
  14. Bob Monsen

    Bob Monsen Guest

    The PIC datasheets I've read generally want some kind of cap + resistor.
    Apparently, on some devices, the reset (MCLR) pin is prone to latchup if
    it sees spikes. The circuit I usually use is this, stolen from some PIC

    --- 10nF

    However, if he has MCLR disabled in the config word, he probably is not
    going to see any issues with it. He is probably seeing some kind of power
    droop. There is a brown-out detection in many PIC devices which he might
    be able to use to see if that is the problem. ISTR that it sets a bit
    someplace if the device reset due to brown-out. Or, he could just use a
    couple of 0.1uF caps between Vss and Vdd.

    Bob Monsen

    I feel that you are justified in looking into the future with true
    assurance, because you have a mode of living in which we find the joy
    of life and the joy of work harmoniously combined. Added to this is
    the spirit of ambition which pervades your very being, and seems to
    make the day's work like a happy child at play.
    Albert Einstein (1879 - 1955), (referring to America)
  15. Jeff Dege

    Jeff Dege Guest

    I don't know why everybody keeps talking as if I was using a PIC. I
    stated in the original post that I was using a Basic Stamp 2.

    Yes, the Basic Stamp includes a PIC, but it includes a great deal of
    supporting circuitry, as well. The reset pin is pulled high. It's not
    the reset pin that is causing the Stamp to reset, it's the brownout

    Everyone knows that dragons don't exist. But while this simplistic
    formulation may satisfy the layman, it does not suffice for the scientific
    mind. The School of Higher Neantical Nillity is in fact wholly unconcerned
    with what does exist. Indeed, the banality of existence has been so
    amply demonstrated, there is no need for us to discuss it any further
    here. The brilliant Cerebron, attacking the problem analytically,
    discovered three distinct kinds of dragon: the mythical, the chimerical,
    and the purely hypothetical. They were all, one might say, nonexistent,
    but each nonexisted in an entirely different way....
    - Stanislaw Lem, "Cyberiad"
  16. Bob Monsen

    Bob Monsen Guest

    Add a small resistor, 10 ohms, in series with the Vdd pin. Use a 10uF
    electrolytic and a 0.1uF ceramic cap between the Vdd and Vss pins, very
    close to the stamp. Add a 10nF cap from /RES to gnd.

    Bob Monsen

    The most beautiful experience we can have is the mysterious. It's the
    fundamental emotion which stands at the cradle of true art and
    science. Whoever does not know it can no longer wander, no longer
    marvel, is as good as dead, and his eyes are dimmed.
    Albert Einstein (1879 - 1955)
  17. The BASIC Stamp usually uses a PIC. There is a configuration word bit
    that re-assigns the /MCLR (reset) pin to become a Schmitt trigger input
    pin. Hopefully the OP doesn't have it floating.
  18. Er, because it uses a PIC.
    Well, if you knew that the brown out detect was causing the reset, why
    didn't you say so? That means that your power supply must be sagging.
    Are you using the same power supply in all of your testing, or are you
    making changes (including using longer wiring)? BTW, how do you "know"
    that the BOD is triggering the reset?
  19. Yes, hope exists until shattered by reality.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day