0
\$\begingroup\$

I am familiar with the debounce of a switch connected to GND and swinging between the same voltage levels of the logics:

schematic

simulate this circuit – Schematic created using CircuitLab

But I need a circuit to debunce and reduce the voltage from a 24V switch. The output signal must be 3.3V. The switch has one side connected to the 24V rail, and can't be changed.

What about the following circuit? Are the calculations correct?

schematic

simulate this circuit

\$\endgroup\$
4
  • \$\begingroup\$ Looks good. ... \$\endgroup\$ Commented Feb 6, 2022 at 16:30
  • \$\begingroup\$ Can you double check the switch state in software after the debounce-period? That is the simplest way of overcoming debounce. Optimizing a RC filter to get maximum response without double-presses is difficult and might change with the next switch you use. \$\endgroup\$
    – Ralph
    Commented Feb 6, 2022 at 19:18
  • \$\begingroup\$ Two things - the switch may need a minimum current in order to operate correctly (wetting current) and your software should always filter/debounce the input. The hardware is for some EMI filtering and protection. \$\endgroup\$
    – Kartman
    Commented Feb 7, 2022 at 1:17
  • \$\begingroup\$ Unfortunately the output of this switch does not reach a microcontroller. There is no software that could debounce the signal. \$\endgroup\$
    – Marco
    Commented Feb 7, 2022 at 8:23

1 Answer 1

0
\$\begingroup\$

Consider what happens in the circuit at different moments in time.

Let's say the line is at 0, and you apply 24V input. You're charging the capacitor only through R1, and there is also part of the current that goes via R2 that would otherwise charge C1. It's not constant since voltage at C1 rises exponentially and current via R2 is proportional to it. In theory, 3.3V equilibrium is where charging current via 100k equals discharging current via 16k. Since they all depend on each other, you're gonna have to (probably) compute for charge, and it may involve integrals (or maybe I'm overcomplicating).

When input goes to 0, you have 100k and 16k in parallel to GND, that is pretty simple.

Circuit like this is easy to simulate.

Here, take a look, I simulated with 24V supply and 0V initial C1 voltage and 0V supply and 3.3V initial C1 voltage (link in the first picture is left for you on purpose):
enter image description here
enter image description here

\$\endgroup\$

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.