How It's possible to add a LED to a line that it's debounced (switch) with an RC circuit. If I place 2 LED, one on ground and one on VCC to know button position. Will they remove my charge/discharge rate of Capacitor since they have a low R load?

/* EDIT */

Of course with schematic is easier.


simulate this circuit – Schematic created using CircuitLab

Switch closed, D2 ON and D1 OFF Switch open, D2 OFF and D1 ON

With debouncing on Input

This schematics is wrong, how can I correctly set it up?

/* EDIT 2 */

It's a reference for a Micro input.

  • \$\begingroup\$ You can remove LED D2, it is shorted and will never light up. With debouncing on Input You added a capacitor which charges and discharges via resistors. That is filtering and not really debouncing. It does work though. Does "INPUT" connect to another circuit? You need to be more clear what you're trying to achieve with this circuit. Why the are LEDs there? \$\endgroup\$ Commented Mar 28, 2019 at 13:58
  • \$\begingroup\$ If the user has tactile feedback and proper debouncing on the switch, why do you need optical feedback to screw up the debouncing then add more parts to fix that and two LED's just in case the LED fails. It's the wrong approach. \$\endgroup\$ Commented Mar 28, 2019 at 17:31
  • \$\begingroup\$ It's not a button, but a switch, so I want to see the result of switch. \$\endgroup\$
    – Singed
    Commented Mar 28, 2019 at 17:36

1 Answer 1



simulate this circuit – Schematic created using CircuitLab

Figure 1. D1 is normally on. When SW1 is pressed D1 turns off and D2 turns on.

Note that the input will fall to 0.7 V minimum. Check that this is OK. I've changed the R values so it will affect your debounce timing. Re-calculate those too.

I've split R1 in two: R1 + R4. This raises the INPUT voltage by \$ \frac {V_{cc}-V_{D1}}{2} \$ to address Dave Tweed's comment.


simulate this circuit

Figure 2. A better design?

How it works:

  • With SW1 open 'B' is pulled high via R2 and D2. Meanwhile D1 is lit via R1. VA will be whatever Vf of the LED is so D3 will be reverse biased.
  • When S1 is pressed 'B' will be pulled to 0 V. D3 will now be in parallel with D1 but it's 0.7 V forward voltage will steal the current from D1 so it will turn off.
  • \$\begingroup\$ Note that Vih is now limited to the Vf of D1. This may or may not be enough, depending on what "INPUT" is connected to. \$\endgroup\$
    – Dave Tweed
    Commented Mar 28, 2019 at 17:05
  • \$\begingroup\$ Thanks, @Dave. This was a lunchtime schematic sketch and that was in the back of my mind. I ran out of time to give the final checkover. I've added R4 which will help. \$\endgroup\$
    – Transistor
    Commented Mar 28, 2019 at 17:10
  • \$\begingroup\$ Or you could just add another diode, switching D1 and INPUT separately. R2 becomes the pullup for INPUT. \$\endgroup\$
    – Dave Tweed
    Commented Mar 28, 2019 at 17:12
  • \$\begingroup\$ There's a way to reduce INPUT voltage to 0v? I've updated my post, it's a reference for a Micro. \$\endgroup\$
    – Singed
    Commented Mar 28, 2019 at 17:26
  • \$\begingroup\$ What is the threshold voltage for your microcontroller to guarantee that it reads a '0'? \$\endgroup\$
    – Transistor
    Commented Mar 28, 2019 at 17:54

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.