loading

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

https://youtu.be/3y_YuqfOyIA

Step 1: ​These Are the Parts We Need for This Project:

These are the parts we need for this project:

  • breadboard
  • 3 mosfets (from the motherboard)
  • wire (from the psu)
  • p4 connector (from the motherboard)
  • p4 connector & wire (from the psu)
  • 12v power source (1a or higher rating, i used an old laptop power brick)
  • RGB Led Strip

Step 2: Tools You Will Need

all you need are a few tools and a bit of time

you will need:

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

Tenma Temperature Controlled Soldering Iron

Breadboard w/jumper wires

Power Supply 12v

Check out www.thethriftyworkshop.com

<p>I am looking at doing a similar thing...however I want to replace a controller I currently have that is driving 2 sets of led lights. Currently it goes from a controller to 2 separate amplifiers which is driving the 2 sets of lights. Is it possible to run from the pi gpio pins direct to the rgb amplifers without running it through mosfets as there should be minimal load on the pi as its not driving the lights?</p>
I might add a Pi inside my PC case and have it run some lights of the PSU. Thanks for sharing!
<p>A little sneak peek on what I am working on next,</p><p>I salvaged a scroll wheel from an old mouse that died, it is called a rotary encoder. With this I hope to be able to utilize it with the gpio on the pi and add a bit of code to change colors with the rotary encoder !</p>
<p>If anyone has questions let me know, i'll answer as quickly as possible.</p>
Right now it's still sitting on my desk same configuration but I have a new video in store that will show the application :)

About This Instructable

9,602views

82favorites

License:

More by thriftyworkshop:Add Passive Cooling To The Raspberry Pi 3 Solder Header Pins to a 1602A LCD With a Breadboard Solder Gpio Headers to a Raspberry Pi Zero With a Breadboard 
Add instructable to: