Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Debouncing technique

  1. Oct 11, 2007 #1
    Hi I am curious about the best way to debounce a trigger switch in hardware.

    These switches will be used in extreme conditions(-40 to 85, very strict EMI restrictions, etc.)

    My initial idea is to just put a simple low pass filter (RC circuit) on the input from the switch to the microcontroller pin. I'd do some research to figure out what is a good time constant for the application.

    Is this acceptable, or do I need to do something more active like schmitt triggers? I'd like to throw in a resistor/cap and call it a day, but I must do a very effective design.

    I've no experience, so anyone that can tell me some advice would be appreciated.
  2. jcsd
  3. Oct 11, 2007 #2
    also, I should say that I'd like to avoid software debouncing code as much as possible if the hardware solution is cheap and easy enough.
  4. Oct 11, 2007 #3


    User Avatar

    Staff: Mentor

    The traditional switch debounce in hardware uses a SPDT switch and cross-coupled NAND gates. Have you seen this circuit? I have to run, but I can google it if you can't find it. (It's also shown in Horowitz and Hill's Art of Electronics in figure 8.42 [1st edition]).
  5. Oct 12, 2007 #4
  6. Oct 12, 2007 #5


    User Avatar

    Staff: Mentor

    SPDT = Single Pole, Double Throw

    Switches are often classified in terms of the number of "poles" and the number of "throws". Check out the table at the start of this wikipedia article about switches:


    And here's a diagram of how to use a SPDT switch and cross-coupled NAND gates to debounce the switch (see Figure 3):

  7. Oct 13, 2007 #6
    Schmitt trigger might be what you need.
  8. Oct 13, 2007 #7


    User Avatar
    Science Advisor
    Homework Helper

    That would help with an RC network, but in general no.
  9. Oct 14, 2007 #8
    I would use an RC filter + schmitt trigger.

    RC alone will fall the rise/down time of the signals and digital circuits need a minimum rise/down time to work properly.
  10. Oct 18, 2007 #9
    thank you very much for the help. it looks like the CPU i'm using has a KP module interface with debouncing internal, but I was still curious as to the best way to do it in hardware. Thanks.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook