Debouncing button or switch inputs on microcontrollers can be a challenging problem for those first starting to program these devices. Part of the reason for this difficulty is that real-world butt…
I used a non-inverting Schmidt trigger in one of my recent projects to debounce switch inputs to an ESP-32. It worked exceptionally well and didn’t require software gymnastics or additional code. It just made the switch and interrupt work exactly as expected and cost less than $3.
Many microcontrollers already have Schmitt trigger inputs. If the switch is just for user input, a small capacitor between the input and ground is usually sufficient.
Yup. Many do but the ESP-32 doesn’t. The problem that I was having was that it didn’t matter what combination of R and C I used it wasn’t fast enough to prevent multiple triggers during the transition through the tristate. The Schmidt trigger made the curve square.
This was the best that I could do with an RC hardware debounce.
This is what it looked like with the Schmidt trigger.
I’m happy to use the Schmidt trigger for my project but I’m not suggesting that anyone else should do it for theirs.
I used a non-inverting Schmidt trigger in one of my recent projects to debounce switch inputs to an ESP-32. It worked exceptionally well and didn’t require software gymnastics or additional code. It just made the switch and interrupt work exactly as expected and cost less than $3.
Many microcontrollers already have Schmitt trigger inputs. If the switch is just for user input, a small capacitor between the input and ground is usually sufficient.
Yup. Many do but the ESP-32 doesn’t. The problem that I was having was that it didn’t matter what combination of R and C I used it wasn’t fast enough to prevent multiple triggers during the transition through the tristate. The Schmidt trigger made the curve square.
This was the best that I could do with an RC hardware debounce.
This is what it looked like with the Schmidt trigger.
I’m happy to use the Schmidt trigger for my project but I’m not suggesting that anyone else should do it for theirs.