This is a more in-depth guide that will help walk you through the Rainbow LED Project video that I have also recorded.
To begin, here’s what you’re going to need:
Raspberry Pi 4 with anOS installed on the SD card
Power adaptor and an HDMI cord(not pictured)
A monitor, mouse, and keyboard(not pictured)
Solderlessbreadboard
10 male-to-female jumper wires
8 220 Ohm resistors
8 LEDs (I have 2 each: red, yellow, green, blue)
Connect the male end of one of the jumper wires to the ground rail on the bottom right portion of the breadboard
Connect the male end of one of the jumper wires to the ground rail on the bottom left portion of the breadboard
We need two ground components because with this breadboard, the voltages are split half-way between the board.
3. Grab your first LED (I am using blue) and place it to the right of the middle of the breadboard. The cathode (-) should be in a slot along the ground rail, and the anode (+) will be in the same row, but in the column labeled “E”. For this tutorial, the LED ended up being in row 27.
4. Grab the next LED (I am using another blue) and place it to the left of the middle of the breadboard. The cathode should be in a slot along the ground rail, and the anode will be in the same row, but in the column labeled “E”. Since this LED is going to the left, it ended up in row 33.
5. Repeat steps 3 and 4 for the rest of the LEDs. I decided to space them out 3 rows away, for accessibility reasons. You are free to choose where any of these LEDs go! Once you have placed all the LEDs on the breadboard, it should look like this:
Each row is labelled in the image.
6. Grab a 220 Ohm resistor, and place one end two columns away (this will be column “G”) from the anode (+), but make sure it is in the same row as the anode. Place the other end of the resistor in the column labeled “E” on the other side of the dip support.
7. Next, insert the male end of the jumper wire in column “D” which is right next to the other end of the resistor.
8. Repeat steps 6 and 7 for each row of LEDs. When you are finished, your breadboard will look like this:
At this point, we need to connect the female ends of the jumper wires to the GPIO pins on the Raspberry Pi. Here is the image that I use to help me navigate the pins
Go ahead and connect your Pi to the power source and the monitor and turn it on! At this point, you can now follow the rainbow1.py and rainbow2.py scripts that I have provided to start programming the GPIO pins and watch the LEDs turn on!