Robot App Store

image description

Robopedia

Related: Concepts

Switch Debouncing


Often times when a mechanical switch or button is used for input to a robot, the contacts usually don't close as cleanly as you might think. When the contacts internal to the switch are closed quickly to complete the circuit, there is almost always a "bouncing" effect where the metallic parts briefly separate as they flex and rebound off one another. Although this effect occurs extremely quickly (~1/100th of a second), it is slow enough that a Microcontroller or other logic device can detect the switch opening and closing and will treat them as multiple button presses or switch closes.
If you didn't take the debouncing effect into account, and say your robot was counting how many times a switch was pressed, it might count one physical switch press as three or four actual presses. To avoid this, we use a technique called debouncing.
Debouncing can be done in both hardware and software. Generally, hardware is not ideal because the debouncing circuits usually incorporate a circuit that charges a capacitor, which can add a long delay time to your switch press. Additionally, different types of switches may have different debouncing requirements, which can be adjusted much easier in software then in hardware. The upshot of this technique however is that you won't have to build a debouncing routine into your program.
A software debouncing routine can work in various ways, but the easiest is to usually start a timer when the button press is first detected. If after a set time (when the timer runs out), the button is still detected as pressed, then you can be confident that the switch is pressed and the debouncing phase is over. For most all mechanical switches properly, the microcontroller should have some sort of debouncing routine, but for other logic signals that are created digitally from another computer chip or IC, debouncing isn't needed.

External Links




my wife cheated on me now what online why are women unfaithful
signs of a cheater married men that cheat
wifes who cheat cheat women women who cheat on their husband
gabapentin and ic gabapentin and ic gabapentin and ic



Related Robopedia portals

Find out further reading in the following topic-based portals.
[Add or Edit Article]