I need to simulate realistic button presses that include bounce patterns..but digitally with something like an FPGA to test my debouncing code. How do I generate those noises?

  • 2
    \$\begingroup\$ Why not test it by pressing a button? \$\endgroup\$
    – Hearth
    Commented Jun 3, 2021 at 3:27
  • \$\begingroup\$ I need to test it for a lot of buttons..something that I can do by running a script \$\endgroup\$
    – Baba Yaga
    Commented Jun 3, 2021 at 3:32
  • 2
    \$\begingroup\$ How about a relay? \$\endgroup\$
    – Hearth
    Commented Jun 3, 2021 at 3:55
  • \$\begingroup\$ I suppose you could use a DAC. But seems like more trouble than its worth. \$\endgroup\$
    – DKNguyen
    Commented Jun 3, 2021 at 4:07
  • \$\begingroup\$ On board? Use a real button. \$\endgroup\$
    – Mitu Raj
    Commented Jun 3, 2021 at 4:46

1 Answer 1


The press of a button is not really noise, they are mostly at the logic level of either 0V and VDD.

When bounce occurs, it would bounce a few times between VDD and GND, but there is not really much transient noise, or they appear because of the acquisition speed of the oscillo.

enter image description here

You can take a button and record a few presses on an oscilloscope, and then program the pattern in your FPGA.

If you really want to make transient peaks, you can add a small cap on the line and generate very short pulses.

  • \$\begingroup\$ currently I'm able to generate very small pulses of periods in the range of microseconds but the pulses that don't go up to VDD are the ones I can't generate and the noise around the edges \$\endgroup\$
    – Baba Yaga
    Commented Jun 3, 2021 at 11:09
  • \$\begingroup\$ Damien - Hi, That image seems to have come from somewhere else, so in order to comply with this site rule, can you edit your answer and add a link back to the original source web page, please? Thanks :-) \$\endgroup\$
    – SamGibson
    Commented Jun 3, 2021 at 13:01
  • \$\begingroup\$ @BabaYaga you can add a simple RC filter on the pin and with short pulses you can do the ones that don't go to VDD. \$\endgroup\$
    – Damien
    Commented Jun 4, 2021 at 4:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.