Browse Definitions :
Definition

debouncing

What is debouncing?

Debouncing is removing unwanted input noise from buttons, switches or other user input. Debouncing prevents extra activations or slow functions from triggering too often. Debouncing is used in hardware switches, programs and websites.

Debouncing hardware switches

Physical switches are mechanical devices with a little bit of natural bounce. The springs and metal contacts can cause the connection to be made and broken several times each time the switch is pressed. For simple things, like a light switch, the bounce can't be detected by a human, so it doesn't matter. But, in digital electronics, extra bounces can be detected and interpreted as intentional inputs and cause problems. For example, if you press the change channel button on a TV and the channel changes twice, it may be due to the input not being properly debounced.

Microchip Technology ATtiny817 microcontroller
It is common to add switch debouncing in software with microcontrollers.

Debouncing switches can be done in hardware or software. A simple hardware debouncer can be made with passive components. Using a resistor-capacitor filter with a Schmitt trigger diode can smooth out the transition into a curve. A digital debouncer can be achieved with a set/reset latch. Dedicated integrated circuits for debouncing switches and buttons are available and can be added to a design. All hardware debouncing requires adding extra components and, therefore, adds to the cost of a design.

Adding switch debouncing in software is common with microcontrollers. A switch can be directly connected to the microcontroller input, and a debouncing function can be applied to the input to filter out the physical bounce in the switch.

Debouncing in programming

In programming, debouncing is when a function filters user input before triggering the action. Improperly debounced user input can cause bad performance, double activations or user frustration. Often, a general debouncing function is used instead of writing new code for each input activity. The debouncing function sits after the user input and then calls the target action of the button. Many programming libraries include a pre-built debounce function.

The following example use cases for debouncing functions can be implemented in JavaScript or other programming languages:

  • For a website that has a submit button to place an order, if a user double-clicks the button, they may accidentally buy the order twice. A debounce function would ensure that only one request is submitted.
  • For a site that takes input from a text box with an autofill or suggested search box, debounce can ensure that the input was accepted only after every letter was typed into the box. Other activations could cause poor performance, high server load or user confusion. A debounce function might wait a second or two after the last letter is typed before taking any action.
  • Another example might be a graphic element or message that's programmed to follow the cursor around the screen or as a webpage is scrolled through. This action could run hundreds of times a second and cause poor page performance or high resource utilization. A debounce function could limit the movement script to only run a few times a second to maintain smooth performance.

See in-demand programming languages for developers, explore what it means to do 'everything as code' in IT operations and learn about the different kinds of network switches.

This was last updated in December 2022

Continue Reading About debouncing

Networking
  • firewall as a service (FWaaS)

    Firewall as a service (FWaaS), also known as a cloud firewall, is a service that provides cloud-based network traffic analysis ...

  • private 5G

    Private 5G is a wireless network technology that delivers 5G cellular connectivity for private network use cases.

  • NFVi (network functions virtualization infrastructure)

    NFVi (network functions virtualization infrastructure) encompasses all of the networking hardware and software needed to support ...

Security
  • virus (computer virus)

    A computer virus is a type of malware that attaches itself to a program or file. A virus can replicate and spread across an ...

  • Certified Information Security Manager (CISM)

    Certified Information Security Manager (CISM) is an advanced certification that indicates that an individual possesses the ...

  • cryptography

    Cryptography is a method of protecting information and communications using codes, so that only those for whom the information is...

CIO
  • IT project management

    IT project management is the process of planning, organizing and delineating responsibility for the completion of an ...

  • chief financial officer (CFO)

    A chief financial officer (CFO) is the corporate title for the person responsible for managing a company's financial operations ...

  • chief strategy officer (CSO)

    A chief strategy officer (CSO) is a C-level executive charged with helping formulate, facilitate and communicate an ...

HRSoftware
  • HR automation

    Human resources automation (HR automation) is a method of using software to automate and streamline repetitive and laborious HR ...

  • compensation management

    Compensation management is the discipline and process for determining employees' appropriate pay and benefits.

  • HR technology (human resources tech)

    HR technology (human resources technology) is an umbrella term for hardware and software used to automate the human resource ...

Customer Experience
  • martech (marketing technology)

    Martech (marketing technology) refers to the integration of software tools, platforms, and applications designed to streamline ...

  • transactional marketing

    Transactional marketing is a business strategy that focuses on single, point-of-sale transactions.

  • customer profiling

    Customer profiling is the detailed and systematic process of constructing a clear portrait of a company's ideal customer by ...

Close