Skip to main content
Associate II
August 11, 2026
Question

Reading values from a button

  • August 11, 2026
  • 7 replies
  • 38 views

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
August 11, 2026

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
August 11, 2026

How did you identify 40kOhm values?

TDK
August 11, 2026

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
August 11, 2026

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
August 11, 2026

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.