Visualizing Contact Bounce
If you’ve ever tried to press a button on an FPGA board, you might expect a response similar to Fig 1 below:
You want the button to transition from low (idle) to high (pressed) once for
every time your finger pushes the button. You also want the button to return
to zero in a similarly simple fashion. In Fig 1 above,
i_btn does just
that, although only the button press (
i_btn rises) is shown and not the
In reality, electrical contacts don’t work that way.
The following several images show examples of what happens when a button is
either pressed or released. In each of them,
i_btn is the raw input from
the external port, whereas
debounced is the result of a debouncing circuit
that we’ll discuss over the next couple of posts. Further, you may notice
that the number of wires in
debounced changes from board to
board–this is just a reality of different boards having different numbers
For example, Fig 2 shows the logic read when a button was released on Digilent’s Arty development board.
i_btn doesn’t simply transition back to zero (off) when the button
is released, but rather bounces on its way down.
It’s not that the board is broken, its not. The board actually works quite
well. Rather, the signal from a changing button doesn’t always simply change.
It tends to bounce as well.
Figs 3 and 4 show bouncing as measured on the ICO board.
Notice that, though we’ve switched boards, the button on this other board still bounces.
In case you think the reason for the bounce might be because both the Arty. and the ICO Board use similar buttons, Figs 5-8 show example button bounces from the PMod Keypad as measured by a CMod S6 board. Since the keypads logic is inverted from that of the buttons above, the events presented are actually keypad releases, and not keypad presses.
Of these, Fig 5 (below) may show the most severe bounce from the keypad.
Fig 6 appears to be fairly benign, but the key still bounces.
Fig 7 shows another two bounces.
Fig 8 shows that the locations appear fairly random–even though it represents the same number of bounces Fig 7 had.
Measuring this sort of contact bounce isn’t really that hard at all—especially once you have access to a debugging bus such as the one we built together on this blog.
Stick around, and we’ll discuss not only how to debounce a set of buttons, but also how to measure the effects of button bounce, and how to modify the debugging bus project to handle a task such as this one.
Through thee will we push down our enemies: through thy name will we tread them under that rise up against us. (Ps 44:5)