I recently bought a Pi 3 and was playing with the GPIO pins to power some LEDs when I noticed that a particular pin was staying on after the program exited. It persisted even after the Pi was turned off (but still plugged in). However, if the pin is initialized within a program, it turns off completely again until exited. I tested this with both Ruby's PiPiper and Python's RPi.GPIO.

What causes this? Is there a way to 'fix' it?

I've noticed this with Pins 3, 5, 7, and slightly with 10. Also, it appears Pin 8 - GPIO14 doesn't actually function as GPIO but rather a 3V3 or 5V source despite being listed as GPIO.


2 Answers 2


GPIO 0-8 have internal pull-ups to 3V3 enabled by default. In addition GPIO 2 and 3 have 1k8 hard wired pull-ups to 3V3.

The currents (potentially) flowing are more than enough to illuminate a modern LED.

Pin 3 = GPIO 2
Pin 5 = GPIO 3
Pin 7 = GPIO 4

Pin 8/10 will be at logic 1 if they have been left in their default ALT0 UART mode.

Pin 8 = GPIO 14 (TXD)
Pin 10 = GPIO 15 (RXD)

These defaults are applied at power-on. They will be overridden once you specifically set the mode of a GPIO or set/remove the internal pull-ups.

  • For the non UART pins I think joan is hinting at the high-Z state of an input pin, which is what the miscellaneous GPIOs (non-UART, etc) are configured as by default. If you actually set those pins as outputs, using a reasonable resistor (e.g. 50-200 Ohm), and drive them high, the LEDs will be much brighter.
    – goldilocks
    Commented Apr 28, 2016 at 19:20

Is there a way to 'fix' it?

I believe the pi user has permission to do this by default now on Raspbian but I'm not sure; if not you'll have to run this root.



for x in 17 27 22; do
    echo $x > $gpioDir/export
    echo out > $gpioDir/gpio$x/direction

This is just meant to be illustrative. The default value of an output pin is 0, so setting it as such will turn the power off. Note that I did not use 2 3 4 here simply because 2 and 3 are the I2C bus and you should leave it as is and not connect things to it that aren't meant to be. The /sys interface uses the commonplace Broadcom numbering; GPIOs 17, 27, and 22 are adjacent on the inside row (physically 11, 13, 15).

This will not persist across reboots, or after the settings are changed by some other program. Short of creating your own bootloader, kernel, etc., there is no simple way to make this the default. The pins start up as floating inputs to prevent accidental shorts.

I'm sure there are plenty of ways to leave the pins this way using python, C, etc. as well.

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.