Doorbell wire - induced current?

Discussion in 'The Projects Forum' started by John Croucher, Dec 22, 2015.

  1. John Croucher

    Thread Starter New Member

    Dec 20, 2015
    9
    1
    I have a very simple setup using an Arduino connected to a doorbell button.
    I have a pull down resistor on the input pin, and trigger the code when the pin goes high.
    The other side of the doorbell wire is connected to the 5v rail.
    When the doorbell is activated it triggers some relays.

    The issue is that it randomly goes off a few times a day for no apparent reason.
    I have found that using the igniter on the gas stove can trigger it, and I think the washing machine can randomly also.

    I tried it in reverse ( go low to trigger ), this was also randomly triggering.

    Does anyone have any ideas of what is going on?
     
  2. ebeowulf17

    Active Member

    Aug 12, 2014
    678
    79
    What length of wire, and is it twisted-pair and/or shielded? Do the wires run in parallel with other, higher power wires for any significant length?

    What value of pull-down resistor?
     
  3. crutschow

    Expert

    Mar 14, 2008
    12,977
    3,220
    You might try a RC filter at the Arduino to suppress any transients.
     
    ebeowulf17 likes this.
  4. ebeowulf17

    Active Member

    Aug 12, 2014
    678
    79
    I have a question on this - could you simply connect a capacitor from the input pin to ground, relying on the input impedance of the Arduino for the resistive part of the RC filter?
     
  5. BReeves

    Member

    Nov 24, 2012
    412
    64
    I use 12volts and an optoisolator for switched inputs, low impedance eliminates false triggers.
     
    #12 likes this.
  6. John Croucher

    Thread Starter New Member

    Dec 20, 2015
    9
    1
    10k pull down.
    The wire is just two core doorbell wire. It is not shielded and runs about 15 meters.
    It runs near 240v wires for about 2 meters as it goes into my network cabinet.

    Thanks for that idea, I will look up some examples.

    That is an interesting solution.
     
  7. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Stove igniters tend to be much faster events than a person pressing a button. Your debounce routine should have caught this. If not, just increase it's sample delay some.

    You do have a debounce routine, right?
     
  8. crutschow

    Expert

    Mar 14, 2008
    12,977
    3,220
    No.
    You need a resistor in series with signal line and then a capacitor to ground at the Arduino input.
    The Arduino input impedance has negligible effect on the circuit.
     
    ebeowulf17 likes this.
  9. crutschow

    Expert

    Mar 14, 2008
    12,977
    3,220
    A debounce circuit normally cancels out subsequent signals after the first and thus has no effect on the initial pulse, so it would do nothing to eliminate a fast signal, such as from a stove igniter.
    But you certainly could add a delay circuit so that it responds only to a signal longer than a given duration (such as 100ms or more) to insure that it's from the push button.
     
  10. #12

    Expert

    Nov 30, 2010
    16,248
    6,744
    I'm with BReeves in post #5. Lower impedance reduces false triggers. Change the 10K to 1K (to ground). Keep the doorbell switch operating with the 5V supply.

    (Simply because it's a simple way to do this.)
     
  11. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Mine do. I would beg to say most do the same as they are the digital equivalent of a low pass filter.
     
  12. Sensacell

    Well-Known Member

    Jun 19, 2012
    1,124
    266
    Getting a clean "contact closure" signal over long, unshielded cables requires a bit of thinking.

    The wiring becomes a big antenna, coupling all kinds of nasty into the system, a high impedance (10K) makes things really sensitive.

    Reduce the value of the pull-down to 220 ohms, follow that with an RC filter, 10K and 0.1 uf to the input pin.
    This network will also help protect the input from getting damaged by induced voltages.
    If you look at the input circuitry for a wired burglar alarm, you would be surprised to see how much circuitry they hang onto the inputs.

    Some types of switch contacts can become oxidized, a few milliamps of current flow helps keep the contacts in good order as well.
     
    #12 likes this.
  13. #12

    Expert

    Nov 30, 2010
    16,248
    6,744
    That's taking it a bit farther. I thought about dropping the first resistor to 220 ohms, but worried about the 22 ma load on the +5V supply. If the power supply can handle it, that's the last of my worries on that front.:)
     
  14. ebeowulf17

    Active Member

    Aug 12, 2014
    678
    79
    Thanks for setting me straight on that! Re-read a few tutorials on passive filters and I see where I went wrong now.
     
  15. crutschow

    Expert

    Mar 14, 2008
    12,977
    3,220
    Perhaps that's how it's done in software, but not usually in hardware, since normally digital circuits want a fast risetime signal, so you let the initial fast rise signal through and then suppress the subsequent bounces.
    That's particularly true if you want a fast response to the push button signal.
     
  16. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    An RC filter is a low pass, which is how you are suggesting to use in the hardware.

    The same result, with an imperceptible delay to the user, may be achieved in software, which has a production cost of zero.

    The only time I would add any parts in the button interface would be if I was protecting against over or undervoltage spikes.
     
  17. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,790
    827
    Debouncing that pushbutton, either in hardware or software, is necessary for your sketch to operate reliably. The Arduino site has an example of how to debounce a circuit in software. Check this link http://playground.arduino.cc/Learning/SoftwareDebounce
    Debounce can be done either by polling or using an interrupt pin on the Arduino. I have a function that debounces an arcade button (any NO pushbutton switch really), which detects either a short or long push.
     
  18. crutschow

    Expert

    Mar 14, 2008
    12,977
    3,220
    No.
    I'm specifically saying that's not how it's done in hardware if you want fast response.
    This is typical for that:
    [​IMG]

    It's a fast attack and slow discharge type of circuit.
    But certainly that's unnecessary if you do it in software.
     
  19. DickCappels

    Moderator

    Aug 21, 2008
    2,647
    632
    Not intending to derail this fruitful discussion of analog low pass filters, it should be noticed that a debounce routine such as used with mechanical buttons would probably be able to filter out the glitches with zero added parts.

    Now to return to the thread in progress...
     
    ErnieM likes this.
  20. John Croucher

    Thread Starter New Member

    Dec 20, 2015
    9
    1
    *looks up debouncing,, updates my code.*
    Yeah it debounces, now.. :)

    That fixed it! Rookie mistake, I hate to see it.

    Thanks everyone for the help and suggestions.
     
    ErnieM likes this.
Loading...