Introduction: Raspberry Pi Zero - Control RGB Leds With E-Waste
Hey Thrifty Nation,
I’m going to show you how to control an RGB led strip with your raspberry pi and pigpio
I built this circuit out of e-waste consisting of an old motherboard and a dead power supply
If the video above is not working for you, try the link below
Step 1: These Are the Parts We Need for This Project:
Step 2: Tools You Will Need
all you need are a few tools and a bit of time
you will need:
- pair of pliers w/strippers
- soldering iron
Step 3: Lets Take a Look at the Led Strip.
I won’t go into how to desolder components in this video but once you have your components,
lets take a look at the led strip.
these led strips have 4 wires, one of them is 12v power and the other 3 are Red - Green and Blue
With your raspberry pi you can control the RGB lines through Pulse Width Modulation to change the brightness and color of your led strip
Step 4: Lets Build the Circuit
Start by placing your a mosfet into the breadboard like so
Step 5: Build Your Circuit
using a jumper wire; connect the source pin to the ground bus of your breadboard
then connect a wire between one of your rgb pads on the strip to the drain pin of the mosfet
use a jumper wire to connect to the gate pin of the mosfet and set the other end aside
Step 6: Replicate
Now that we have one complete, go ahead and replicate the same for the other two colors
Step 7: Wire to Gpio
Now connect the wires from the gate pins of the mosfets to the gpio pins on your raspberry pi (I used 17 for red 22 for green and 24 for blue)
Step 8: Common Ground
Now lets give your new circuit and the raspberry pi a common ground, using a jumper wire; connect the ground bus of your breadboard to a ground pin on your raspberry pi
Step 9: Power Hookups
finally, plug your positive and negative leads of your 12v power supply to the positive and negative bus on your breadboard and also the 12v power from the led strip
Step 10: Software
install the pigpio library at http://abyz.co.uk/rpi/pigpio/
and start it with this command sudo pigpiod
RGB colors are comprised of 3 segment numbers each ranging from 0-255
The range equals brightness of each of the 3 colors allowing you to mix and match to arrive at your chosen color. Now its easy with a bit of Python to control the leds with these commands in your terminal:
pigs p 17 255 - The red part will be set up to 100% and the LED's should be red
pigs p 22 128 - The green part will be set up to 50% and the LED's should be yellow
pigs p 24 128 - The blue part will be set up to 50% and the LED's should be purple
Step 11: Done!
Now go out and have some fun, I’d love to see what projects you create with this!
If you are looking for more fun projects to do with your raspberry pi, check out this video above
Looking for more?
Here are some items from my workbench
Check out www.thethriftyworkshop.com
We have a be nice policy.
Please be positive and constructive.