Wiring setup for Rpi:


I have an rpi 3, and I've recently started experimenting with the GPIO side of things. I'm new to electronics in general, although I do computer programming regularly.

I have a 3MM Green LED that I've connected to my breadboard. I have a jumper wire running from Pin#39 (ground) to my negative terminal, and a 47K Ohm resistor connected to my LED. I also have a jumper wire from Pin#7 (GPIO04) to the same LED. If this was poorly explained, there's a picture attached above.

I've mostly followed instructions in this video tutorial as far as enabling I2C/SPI. The same code is essentially used, which I'll post here (though it's minorly tweaked):

import RPi.GPIO as GPIO
import time


for i in range(5):


The code runs without exception from Python, but the LED never switches off. In fact, simply making the connections via the wires makes the LED turn on and stay on. It makes me think that either my wiring connections are wrong, or my understanding of how GPIO works is flawed (which it may; again, I'm new to this). I'd be grateful if anyone has any guidance on how to go about troubleshooting this, or if my understanding of how to do this seemingly simple task is missing something. I can provide more information if needed.

Put simply:

Wiring my LED to the GPIO pins turns the LED on. Why is this? No code I run on the RPI seems to affect the LED or power output from the GPIO. Is this expected? That GPIO will always just be sending power through?

  • Can you try the circuit without the ribbon cable and the plug in? I.e. can you jumper direct from the Pi's expansion header to the breadboard? It's easy to get ribbon cables the wrong way around. – joan Nov 19 '18 at 22:14
  • you connect to GPIO04 ... and try to control GPIO.output(7 .... are you sure that shouldn't be 4? – Jaromanda X Nov 19 '18 at 22:16
  • @JaromandaX GPIO.BOARD specifies the use of pin numbering for the GPIO in the script. Pin 7 is connected to GPIO4. – joan Nov 19 '18 at 22:45
  • Yeah, I suspected that may be the case but wasn't sure :p – Jaromanda X Nov 19 '18 at 22:48

It is most likely you have the cable inserted incorrectly, but this is not shown. (This would connect the LED between 5V and Gnd.)

Run gpio readall which will display the state of the GPIO pins.

A 47kΩ resistor would result in a current of ~50µA which would be invisible, but the image is too dark to tell what it is.

It is unclear what you have done to "I2C/SPI" or WHY.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.