• wiringPi


  • Pull-up resistor (10k) to 3.3v on GPIO 24 (=THERMO_BUTTON_PIN)
  • floating GPIO 4 (=AUDIO_BUTTON_PIN)

In short, I want to implement an auto-recognition for one of two selfmade HATs. As you can guess, the other HAT has the properties of the first one vice versa. Based on this, i ask the following after booting my program:


if(digitalRead(THERMO_BUTTON_PIN) == HIGH){

    printf("Thermo-HAT registered. Starting thermo-branch.\n");
    hat_type = thermo;
if(digitalRead(AUDIO_BUTTON_PIN) == HIGH){

    printf("Audio-HAT registered. Starting audio-branch.\n");
    hat_type = audio;

The output is:

Thermo-HAT registered. Starting thermo-branch.
Audio-HAT registered. Starting audio-branch.

What i already know/tried:

A pin configured as input has no defined voltage, that's why the "pullUpDnControl" is in place. It doesn't seem to do anything, sadly. The voltage on the pulled up pins stays around 2.7v, while the floating one stays at 2.1v. When disconnecting the HAT, it shows normal 3.3v pull-up behavior, the other one stays at a few millivolts. This tells me that the raspi's input doesn't have enough resistance, so some voltage gets lost over the pull-up, which should not happen. I also disabled the 1-wire bus, which seems to cause problems on GPIO 4.

Why are the voltages in this between state? At least the pulled up GPIO should show the 3.3v.


1 Answer 1


WiringPi is deprecated and unsupported so I suggest you use other libraries.

Measuring the voltage on an INPUT is unreliable and depends on the load.

The internal pullups are high impedance ~50kΩ. If you want reliable performance use external lower value resistors.

NONE of the GPIO "float" - they are either configured as pullup (BCM 0-8) or pulldown, unless reconfigured.

GPIOreadall is a replacement for gpio readall which also shows pull (on a Pi4).


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.