Raspberry pi multiple LED's


#1

Hello,

I am doing a project creating a scoreboard for a phys ed game. I need to light 25 LED’s on one side and 25 LED’s on the other side to represent two teams. When students press a push button I want one LED to light up. When they press it again I want a second LED to light up. (the first can stay on or go off, whichever is easiest or works better). This will repeat for all 25 LED’s. This needs to happen for both teams and I will have separate push buttons for each side. I also wanted to include a reset push button to clear the lights.
I have only used raspberry pi a few times and nothing this extensive. I am wondering if I can even attach this many LED’s and how to actually wire it. I assume I am going to need at least two pi’s to connect all of the LED’s and buttons.

Any help or insight would help and very much appreciated.

Thank you!!

Erica


#2

The Raspberry Pi doesn’t have enough GPIO pins to control 50 LEDs directly, but there are a couple of ways to get the result you’re looking for. The cheaper, but more involved approach, is to use a chip called a shift register which effectively allows you to control 8 LEDs with a couple of pins - by chaining together 7 shift registers you could control 56 LEDs using only 10 GPIO pins. This shift register tutorial should get you started.

The much easier but more expensive solution would be to use individually addressable LEDs like Adafruit’s Neopixels (the color LEDs used on the Circuit Playground). These “addressable” LEDs each include a small controller that allow you to chain as many as you like together connected to a single GPIO pin for data (as well as a power and ground pin) while still controlling each individually. These are available a number of interesting form factors. This tutorial explains how to get Neopixels hooked up to a Raspberry Pi (including some additional circuitry needed to power them from the Pi’s 3.3v supply). Hope that helps!