# Hardware debounce a switch (2 types)

**URL:** <https://forum.arduino.cc/t/hardware-debounce-a-switch-2-types/1317188>\
**Category:** General Electronics\
**Created:** [October 31, 2024, 3:16pm UTC](https://forum.arduino.cc/t/hardware-debounce-a-switch-2-types/1317188 "2024-10-31T15:16:13Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterjacknife](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/peterjacknife/32/1098590_2.png) [@peterjacknife](https://forum.arduino.cc/u/peterjacknife)\
**Post date:** [October 31, 2024, 3:16pm UTC](https://forum.arduino.cc/t/hardware-debounce-a-switch-2-types/1317188/1 "2024-10-31T15:16:13Z")

</div>

Hi Everyone  
I was wondering if some of you could offer some advice on debouncing a switch with hardware. From what I have read online there seems to be a couple ways that are very similar.  
1.) Button goes to LOW when pressed  
2.) Button goes to HIGH when pressed.  
I was wondering which is preferred, and if there are pros and cons to each way.

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/6/4/e/64e4e13deaff2c3cd8e03691f16a567109d9b843.jpeg)

Thanks Pete

---

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [October 31, 2024, 4:18pm UTC](https://forum.arduino.cc/t/hardware-debounce-a-switch-2-types/1317188/3 "2024-10-31T16:18:56Z")

</div>

Wiring the button for active-HIGH or active-LOW doesn't have anything to do with debouncing.

The discussion linked below about how to program a button is good. The main opinions are that having a lot of accessible+5V nodes in the system makes it easier to short out and damage things, and that the PULLUP\_INTERNAL is simpler to wire while also being more protective.

> [@Best first 5 topics to read to reach Trust Level 1?](https://forum.arduino.cc/t/best-first-5-topics-to-read-to-reach-trust-level-1/1287592/1):
>
> - [How to get the best out of this forum](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966) by @PerryBebbington -- to learn how to post productive questions.
> - [How to Wire and Program a Button](https://forum.arduino.cc/t/how-to-wire-and-program-a-button/1196000) -- A discussion of the [official Arduino "How to Wire and Program a Button" tutorial](https://docs.arduino.cc/built-in-examples/digital/Button/) that goes with the Arduino IDE's built-in [File/Examples/02Digital/Button.ino](https://github.com/arduino/arduino-examples/blob/main/examples/02.Digital/Button/Button.ino) example. This thread shows some concerns about the tutorial and advice about how to wire up a button safer and easier.

---

<div class="post-metadata">

**Author:** ![gilshultz](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gilshultz](https://forum.arduino.cc/u/gilshultz)\
**Post date:** [October 31, 2024, 4:53pm UTC](https://forum.arduino.cc/t/hardware-debounce-a-switch-2-types/1317188/4 "2024-10-31T16:53:55Z")

</div>

Nice picture, but I’m having trouble following it. I usually use a low-pass filter for buttons and a Schmitt trigger gate, like a 74HC14, as the input interface. You can use this circuit without the extra IC if you prefer—it will work almost as well. **R2** and **C1** are the primary debounce components.

I always switch on the low side if the switch isn’t in the same enclosure as the processor. Ground tends to pick up less noise, and I size the pull-up resistor to push about 1 mA through the switch.

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/6/e/b/6eb0292a6abf34eb115eb84298abe4b8be37e85f.png)

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [October 31, 2024, 6:30pm UTC](https://forum.arduino.cc/t/hardware-debounce-a-switch-2-types/1317188/5 "2024-10-31T18:30:43Z")

</div>

> [@gilshultz](#):
>
> Nice picture

... and a very nice presentation!

---

<div class="post-metadata">

**Author:** ![LarryD](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/larryd/32/215550_2.png) [@LarryD](https://forum.arduino.cc/u/LarryD)\
**Post date:** [November 1, 2024, 1:13am UTC](https://forum.arduino.cc/t/hardware-debounce-a-switch-2-types/1317188/6 "2024-11-01T01:13:49Z")

</div>

- Sample your switches every 50ms looking for a change in switch state and respond accordingly, no hardware de-bouncing is necessary.

FYI

 ![SwitchesAndLEDs](https://europe1.discourse-cdn.com/arduino/original/4X/7/e/0/7e0ee1e51f1df32e30893550c85f0dd33244fb0e.jpeg)

---

<div class="post-metadata">

**Author:** ![cncnotes](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/cncnotes/32/1098836_2.png) [@cncnotes](https://forum.arduino.cc/u/cncnotes)\
**Post date:** [November 1, 2024, 2:35am UTC](https://forum.arduino.cc/t/hardware-debounce-a-switch-2-types/1317188/7 "2024-11-01T02:35:08Z")

</div>

You may wish to check this video: hardware switch debouncing

[![](https://europe1.discourse-cdn.com/arduino/original/4X/1/7/1/17111375b826980b56b9de2d4be419fe186dda85.jpeg "Easily De-bounce your Switches") ](https://www.youtube.com/watch?v=n0U2TavFD0Q)

---

<div class="post-metadata">

**Author:** ![peterjacknife](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/peterjacknife/32/1098590_2.png) [@peterjacknife](https://forum.arduino.cc/u/peterjacknife)\
**Post date:** [November 1, 2024, 12:25pm UTC](https://forum.arduino.cc/t/hardware-debounce-a-switch-2-types/1317188/8 "2024-11-01T12:25:42Z")

</div>

Thanks everyone for the comments. As someone who is new to Arduino and programing, it's great to hear the different ways that can be used to accomplish as task.

I have used a resistor and capacitor with and without the Schmitt trigger, however I did not notice any difference when with regards to bounce. Perhaps that is due to the fact that my projects are pretty basic compared to some of the projects I have seen on here.  
Thanks Pete

---

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [November 1, 2024, 12:36pm UTC](https://forum.arduino.cc/t/hardware-debounce-a-switch-2-types/1317188/9 "2024-11-01T12:36:51Z")

</div>

> [@peterjacknife](#):
>
> with and without the Schmitt trigger,

Schmitt triggers are built into the AVR IO circuitry:

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/7/0/0/700dbdfccecc29ed87282ce35edafd13719a2d5f.png)

---

<div class="post-metadata">

**Author:** ![stitech](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stitech/32/1016377_2.png) [@stitech](https://forum.arduino.cc/u/stitech)\
**Post date:** [November 1, 2024, 1:47pm UTC](https://forum.arduino.cc/t/hardware-debounce-a-switch-2-types/1317188/10 "2024-11-01T13:47:23Z")

</div>

Usually only one edge is relevant. In this figure the input goes low when pressing the button. When the button is released the capacitor will be charged. If bouncing occurs when the capacitor hasn’t reached the threshold voltage, it will be discharged, but it’s invisible for the input. The RC-time (resistance multiplied by the capacitance) needs to be chosen to accommodate the bounce time of the switch.  
The internal pullup in the UNO is approximately 35kΩ. A capacitor of 1μF will result in a debounce time of 35milliseconds.

 ![Debounce](https://europe1.discourse-cdn.com/arduino/original/4X/b/b/5/bb5decd3fd722b3bc27246c262250fe9aa964086.png)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [April 30, 2025, 1:47pm UTC](https://forum.arduino.cc/t/hardware-debounce-a-switch-2-types/1317188/11 "2025-04-30T13:47:43Z")

</div>

Closed on April 30, 2025, 1:47pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
