Skip to main content
Associate II
Aug 11, 2026 1:05 PM UTC
Question

Reading values from a button

Hello, I am desiging PCB with STM32F030Fx where I plan to use blocks of 5 push buttons for reading user inputs.
For the most of  tutorials, they use reading ACTIVE HIGH after the press, but I thought more common is to read ACTIVE LOW.
Also there is internal pull-up ressistors according to the schemtaic, so probably not necessary to use external pull-up resitstor for it.
Using 100nF capacitors should simplify debounce process.

Is it reliable for readings?
 

 

7 replies

TDK
Aug 11, 2026 1:16 PM UTC

That will work just fine. The time constant will be 40kOhm*100nF = 4 ms which is sufficient for debouncing. You can use either active high or active low. They both work.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Associate II
Aug 11, 2026 1:46 PM UTC

How did you identify 40kOhm values?

TDK
Aug 11, 2026 1:50 PM UTC

Check the datasheet for the nominal value of the internal pullup/pulldown.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Explorer
Aug 11, 2026 1:26 PM UTC

Yes, active-low with the STM32 internal pull-up is a perfectly reliable approach. Ensure the input is configured correctly and the 100 nF capacitor doesn’t make the RC time constant too slow. A small software debounce is still recommended for clean button readings.

Andrew Neil
Super User
Aug 11, 2026 2:01 PM UTC

For the most of  tutorials, they use reading ACTIVE HIGH after the press, but I thought more common is to read ACTIVE LOW.

It really makes no difference: you just check whether the value at the pin is the ‘open’ or ‘closed’ value.

Make your code easily adaptable to either case with something like 

#if defined ACTIVE_HIGH
// Active high
#define PRESSED 1
#define RELEASED 0
#elif defined ACTIVE_LOW
// Active low
#define PRESSED 0
#define RELEASED 1
#else
#error "Must define either ACTIVE_HIGH or ACTIVE_LOW"
#endif

 

Jack Ganssle did some good articles on #debouncing:

https://www.ganssle.com/debouncing.htm

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.