element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
DIY Test Equipment
  • Challenges & Projects
  • Project14
  • DIY Test Equipment
  • More
  • Cancel
DIY Test Equipment
Blog Vintage 555 - A general-purpose button debouncer
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join DIY Test Equipment to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: balearicdynamics
  • Date Created: 12 Aug 2017 2:24 PM Date Created
  • Views 13925 views
  • Likes 8 likes
  • Comments 26 comments
  • mini-project
  • micro controller
  • vintage
  • diytestequipch
  • ne555
  • genuino 101
  • button tool
  • debouncer
  • testing equipment
  • arduino
Related
Recommended

Vintage 555 - A general-purpose button debouncer

balearicdynamics
balearicdynamics
12 Aug 2017

Too many button clicks

Buttons and tactile switches are frequently used in many projects involving micro controllers; one of the most frequent issue is related to unwanted multiple transitions when the button is pressed once.

Tactile switches as well as push buttons are mechanical components subject to the problem of bouncing. When a button is connected to a digital GPIO input pin (i.e. an Arduino pin configured as INPUT) we ideally expect that when the button is pressed we get only one high signal; unfortunately this rarely happens. During the mechanical movement the physical material vibrates affecting the voltage and the transitions between the On/Off status are not so clear as we usually need. Micro controllers and FPGA are fast enough reading the microseconds oscillations when the button is pressed, resulting multiple transitions while apparently we are pressing the button only once.

 

Button debouncing

To solve this problems we should apply a button debouncing to reach the goal: pressing a button only one signal should be detected by the micro controller digital input. We can identify two possible approaches: software and hardware.

There are plenty of source examples on how to debounce a button via software; the software approach seems the easiest way but in my opinion this is one of the cases where a hardware solution may be more efficient and resource saving. Micro controllers have memory and resource limits so adding a debouncing routine maybe critical in many cases.

 

The hardware choice

As I had to add a button debouncer to a test project based on Arduino 101 I decided to make something as much general as possible, easy to adapt to almost any micro controller and possibly platform independent. I figured two possible approaches: RC (resistor-capacitor) method and IC method. The RC option is easier to realise but I am not so confident it can be applied to very different operating conditions (e.g. very different micro controllers types and clock speed). It is not so difficult to calculate the values of resistor and capacitor for a RC debouncing circuit but I see a limitation restricting the application range. The calculation of the RC circuit is  dependent on the voltage of the board used; this means that for different voltage boards (1.8V, 3.3V, 5V etc.) we should provide a different RC calculation.

The RC simple circuit shown in the image below can be calculated with the nice RC Debounce online calculator

image

The parameters involved in the calculation are:

 

  • Voltage
  • High logic level
  • Bounce time (ms)
  • Capacitor value
  • Resistor value

 

The other hardware alternative is adopting a debouncing IC.

There are many specific IC for mechanical contacts debouncing, but they are almost expansive and oriented to manage power buttons while we generally use a push button is to generate a logic signal. The LTC2951CTS8 for example sounds good (not sure if the DIL version is available) with a base price of about 5$.

This is why I decided to move to a general-purpose debounce circuit based on the Vintage NE555. TI provides a wide range of 555 ICs including DIL packaging covering a range supply levels from 1.5V up to 16V; the most common is the DIL package NE555-P in the range between 4.5V and 16V. Just what I need, sold at 1/10 (one tenth) of the specialised debouncing ICs average price!

 

The NE555 circuit

image

I designed the circuit based on the popular NE555 monostable configuration shown above and detailed in the below schematics:

image

In this specific case using the two 10uF capacitors connected in parallel to the discharge pin and the 10K resistor for charging we get a timing of about 220 ms. It is a reasonable value to debounce a tactile switch connected to a digital input pin of an Arduino board; changing the values of the capacitors and the resistor we can increase or reduce the charge time resulting a different timing to the output pin (debounced signal.

 

Wiring the circuit

Using the NE555-P IC the circuit can be powered by the Arduino itself; the images below show the circuit placed as part of the Arduino 101 project where a push button is needed. The small board can also host the designated button making a compact object independent by the platform (an external power source can also be used) involving only the debounced signal connected to the desired GPIO micro controller pin.

imageimage

imageimage

imageimage

The resulting PCB is about 30x35 mm; I have provided a tactile switch button surface mounted on the opposite side of the components to make easier assembling the module in any project.

imageimage

The button in action

The video below shows the debouncer module at work powered by the Arduino 101 and a couple of screenshots showing the stability of the signal

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

 

imageimage

 

  • Sign in to reply

Top Comments

  • jw0752
    jw0752 over 8 years ago +3
    Hi Enrico, Thanks for this post. It will be very useful for anyone with a switch that needs debouncing. I love the production of your videos, always so professional. I always think of you and smile when…
  • koudelad
    koudelad over 8 years ago in reply to balearicdynamics +3
    I agree. I just wanted to point out that the Debouncer datasheet shows the circuit diagram and it can even be built by the internal components manually (Or even external discreet components, but this would…
  • dougw
    dougw over 8 years ago in reply to balearicdynamics +3
    These are just alternatives for particular requirements: Sometimes the priority is for minimum hardware cost - software debounce is the lowest hardware cost and easiest to wire up. The other hardware solutions…
Parents
  • koudelad
    koudelad over 8 years ago

    Nice post image

     

    I have seen the RC variant on STM32 Nucleo boards and I guess it is the cheapest if we consider the total bill of material.

     

    By the way, PSoCs have a component just for this purpose: a Debouncer. Works like a charm.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 8 years ago in reply to koudelad

    PSoCS are absolutely innovative ! I love these ICs but I think that the Arduino generation needs to be more involved in real programming to manage them. This is the advantage and disadvantage of the Arduino-like platforms: keep makers far away from the depth of electronics.

     

    Enrico

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • balearicdynamics
    balearicdynamics over 8 years ago in reply to koudelad

    PSoCS are absolutely innovative ! I love these ICs but I think that the Arduino generation needs to be more involved in real programming to manage them. This is the advantage and disadvantage of the Arduino-like platforms: keep makers far away from the depth of electronics.

     

    Enrico

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • koudelad
    koudelad over 8 years ago in reply to balearicdynamics

    I agree.

     

    I just wanted to point out that the Debouncer datasheet shows the circuit diagram and it can even be built by the internal components manually image (Or even external discreet components, but this would be very ineffective.)

     

    image

     

    I am glad that Cypress is trying to solve the most common issues that engineers have. (How many applications you have done incorporate at least one button?) I think it would be great to see more circuits like this in microcontrollers of other manufacturers.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • michaelkellett
    michaelkellett over 8 years ago in reply to koudelad

    Interesting ...........

     

    Lots of talk about denouncing but no definition about what is meant by the term.

     

    Enrico's 555 circuit does a lot that a schmitt (hysteresis) trigger or the Cypress circuit won't do.

     

    In my specification for  a robust denounce system the output will be asserted when the input has been stable true for at least t1 seconds and will be de-asserted when the input has been stable false for at least t2 seconds (where t1 and t2 can be chosen to suit the application but are likely to be in the range 5 - 100ms and 5 to 500ms respectively for manual push buttons). I don't think that ANY of the suggestions so far will achieve that. (Enrico will correct me if I'm wrong but  I think the 555 will trigger with very short input pulses).

     

    Usually the best way to do it is in software (if you have the option). FPGA style logic is fine but since the ratio between debounce times and internal clocks is likely to be >1000 you need quite lot of logic.

     

    There is food for thought here:

     

    Debouncing Contacts and Switches in Embedded Systems

     

    and here:

     

    Debounce Code – one post to rule them all | Hackaday

     

     

    and lots more on the web !

     

    MK

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 8 years ago in reply to koudelad

    Hi David,

     

    I think it would be great to see more circuits like this in microcontrollers of other manufacturers

    It is true that Cypress includes a (sort of) debouncing in its options but you should consider some things;

     

     

    1. the first is that it is not so robust as can be an external debouncing system (personal opinion) like the NE555 - cheapest - or more expensive specific IC. The advantage is that as a matter of fact - with a circuit like the one I am using or similar don't care of what platform you are using, as a matter of fact you can consider a sort of "advanced push button". You can also use it to power on a lamp, no electronics at all and it will works as well.
    2. You can't compare the Cypress - or more in general - PSoC micro controllers category with the Arduino family, mini, micro nano, extra, super mega, pic (pac, puc ?) including also the Minion Micro controller (there is not yet but we all TMs are expecting it one day or the other image). I love and use all where it is possible the PSoC 4, 5 and now hopefully 6 IC just because of these characteristics. But these are more complex, requires a relatively strong C/C++ programming skill and also a decent, at least minimal, knowledge of electronics. Because they incorporate internally a well programmable FPGA logic. They can "spend" the including of a debouncer because as well as other features of this IC you can use or not without dedicating a specific pin (with some limitations, I know).
    3. Last but not least, if you try to design an almost complex circuit with PSoC 4 or 5 you can discover that you meet lmitations also with this device, as it is correct and should be expected. It is not rare that while on the papre apparently I can do something - almost everything - with the PSoC 4 (the cheapest) then as I try to add another block to the circuit design with PSoC Creator I get the message that this block is not allowed because some kind of resource is already used for another block. And I should always pay attention to keep the right dimensions of the entire design.

     

    Enrico

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 8 years ago in reply to michaelkellett

    Michael,

     

    You have done an interesting analysis.

     

    Enrico's 555 circuit does a lot that a schmitt (hysteresis) trigger or the Cypress circuit won't do.

     

    Frankly I have not investigated in this direction, but this was my intuition. The point - as I have already stated in the previous comment to David - is that the idea of a general purpose, platform independent debouncer is not adding some component to a project or over a Arduino shield etc. but making one for all a cheap, easy tu customise (and easy to learn) more complex button; something a bit ahead than the bare mechanic switching. This is the reason I have adopted the NE555 instead of a Schmidt solution or RC (efficient in some cases but conceptually crap, IMHO). A Surface mount Push button soldered with this small circuit (total cost is about 3.5$ including the button) means forget the problem.

     

    Then, I agree with your detailed considerations.

     

    Last: about the software approach I deny all when possible this approach for two reasons; the first is that is uses mciro controller resources. Not only memory but processing time. The second (most important) is that you cant drive the button by interrupt that reveals essential in some cases.

     

    Enrico

     

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 8 years ago in reply to michaelkellett

    Michael Kellett wrote:

     

    Interesting ...........

     

    ... FPGA style logic is fine but since the ratio between debounce times and internal clocks is likely to be >1000 you need quite lot of logic.

     

    ...

     

    MK

    I've checked out fpga debouncing a while (oh - 2014, I'm getting old) ago.

    Here's the 1st video (out of a series of 3) about that:

    You don't have permission to edit metadata of this video.
    Edit media
    x
    image
    Upload Preview
    image

     

    Videos 2 and 3 here and here.

     

    My code was based on an example template that comes with Xilinx ISE:

    image

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube