5

I'm very new to electronics in general, but I want to build a small project where I can individually control (from a GPIO pin) 8 LED's. From what I understand, each GPIO pin on the Pi (Pi2 model B V1.1 in my case) sends out 3.3v?

I have a basic understanding of Ohm's law, but I don't know if I am going about this the right way. The only resistors I have are 330ohm.

All the LED's anodes are currently jumped to GPIO pins starting from 18 going to 25.

As the picture below explains, I can get 3 to work, but once I write the code for the 4th, 5th, and/or 6th LED's, nothing after the 3rd will light.

Is this even possible with my setup? Do I need to learn about how to use (and buy) transistors or something for this project? How can I get this to work?

Here is my python code:

import RPi.GPIO as GPIO

import time

GPIO.setmode(GPIO.BCM)

GPIO.setup(18, GPIO.OUT)

GPIO.setup(19, GPIO.OUT)

GPIO.setup(20, GPIO.OUT)

GPIO.setup(21, GPIO.OUT)

GPIO.output(18,1)

GPIO.output(19,1)

GPIO.output(20,1)

GPIO.output(21,1)

time.sleep(2)

GPIO.cleanup()

layout

enter image description here

0

1 Answer 1

6

The problem is the breadboard (though some would call it a feature). The breadboard you have has split power rails (Marked by the red and blue lines on the edge of the board). If you look carefully the lines are not continuous from one end of the board to the other, but are split in the middle (this allows you to run two separate voltages). To solve your problem just add a pair of jumpers between the power rails, like the orange wires in this picture.

power rail jumper wires

10
  • Thank you so much! I can move on with this project now! :) Woo hoo!
    – Kenneth
    Feb 1, 2016 at 3:15
  • 1
    Though using red wire to jumper both lines feels so wrong.
    – Chris H
    Feb 1, 2016 at 9:26
  • @ChrisH most of the pics I found showed two wires of the same color. Feb 1, 2016 at 9:27
  • I wonder why. Actually looking at the breadboard in that picture, the ground rail isn't split but he power rail is (no break in the black line). On the breadbosrd in the Q, both are split.
    – Chris H
    Feb 1, 2016 at 9:32
  • 1
    @ChrisH no idea I included the pic only to make sure the OP and those who will see this in future did bot misunderstand - as they say a pic is worth a 1000 words. Feb 1, 2016 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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