# Debouncer with LED inside

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.

• 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? Commented Mar 28, 2019 at 13:58
• 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. Commented Mar 28, 2019 at 17:31
• It's not a button, but a switch, so I want to see the result of switch. Commented Mar 28, 2019 at 17:36

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.
• 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. Commented Mar 28, 2019 at 17:05
• 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. Commented Mar 28, 2019 at 17:10
• Or you could just add another diode, switching D1 and INPUT separately. R2 becomes the pullup for INPUT. Commented Mar 28, 2019 at 17:12
• There's a way to reduce INPUT voltage to 0v? I've updated my post, it's a reference for a Micro. Commented Mar 28, 2019 at 17:26
• What is the threshold voltage for your microcontroller to guarantee that it reads a '0'? Commented Mar 28, 2019 at 17:54