I found the following circuit interfacing with a GPIO input on an MCU that has an internal pull up resistor. The GPIO is being used to detect the state of the push button. I have two questions regarding this circuit:

  1. How does the inductor debounce the push button?
  2. What is the purpose of the diode here? If it is a flyback diode, should it not be connected across the inductor instead so that the inductor can dissipate energy?

Any help is much appreciated!

EDIT: The GPIO is now called out in the image.

Pushbutton Circuit

  • 1
    \$\begingroup\$ The GPIO is missing from your schematic. \$\endgroup\$
    – Transistor
    Aug 22, 2017 at 20:27
  • 1
    \$\begingroup\$ @Transistor I read it as the resistor is the pullup in the GPIO. Weird circuit though. \$\endgroup\$
    – Trevor_G
    Aug 22, 2017 at 20:36
  • \$\begingroup\$ @Trevor my thoughts exactly. \$\endgroup\$
    – athedcha
    Aug 22, 2017 at 20:53

2 Answers 2


The inductor slows down (only) the falling edge of the signal, so any bouncing will reset the state:

inductor debouncing schematic
inductor debouncing waveforms

The diode does not make any difference in the simulation. But the only difference it could make is to block any positive voltages from the inductor, so so I'd have to guess that the designer feared this could happen when the switch is opened.

  • \$\begingroup\$ Thanks for the illustration, certainly helps with my understanding. Why does the inductor only slow the falling edge? \$\endgroup\$
    – athedcha
    Aug 23, 2017 at 18:15
  • \$\begingroup\$ When the switch is opened, no current flows, so the voltage drop over R1 becomes zero immediately. \$\endgroup\$
    – CL.
    Aug 23, 2017 at 19:03
  • \$\begingroup\$ Got it! Another question for you, if the diode is there to block positive voltage from the inductor, will this not create a large build up of positive potential on the node between the inductor and diode? \$\endgroup\$
    – athedcha
    Aug 23, 2017 at 19:56
  • \$\begingroup\$ The right end of the inductor has a positive voltage spike, but that does not show up at its left end in the simulation. And any positive charge would be drained to ground the next time the switch is closed. (It might be helpful to play around in a simulation yourself.) In practice, a high enough voltage will result in arcing while the switch is still being opened (as mentioned by Transistor). \$\endgroup\$
    – CL.
    Aug 24, 2017 at 7:03

When looking at inductor circuits I sometimes try to visualise what the complimentary capacitor circuit would look like. In this case that would be a cap between the GPIO and GND. So, for the inductor it would have to be in series with the input.


simulate this circuit – Schematic created using CircuitLab

Figure 1. Complimentary circuits?

My guess is that as the switch closes we have an R-L time delay before the GPIO is pulled low. When the switch opens the inductor will force some current through - giving a micro-arc - until the switch is truly open.

  • In the capacitor version the input is pulled low instantly but is slow to release.
  • In the inductor version the input is slow to get pulled down but will release instantly.

How does the inductor debounce the push button?

I think I've covered that above.

What is the purpose of the diode here? If it is a flyback diode, ...?

I don't know but there are usually input protection diodes on the GPIO so the one pointing up from GND to the GPIO would suffice to provide the ground return path.

... should it not be connected across the inductor instead so that the inductor can dissipate energy?

No. I think that in this case we want to force an arc.

Maybe someone else can think of a reason for the Schottky diode. I might if I sleep well enough.


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.