I've got this cool RGB led strip from aliexpress and i want to use it for PC lights.
The first problem is hot to control it then how to power him up.
This instructable shows you how to do it with github arduino code, working project video and step-by-step guide.
Step 1: Needed Parts
For this project we will be using:
- Arduino nano
- RGB strip
- NPN transistor
- 100-220 Ohm resistor
- Jumper wires
- Soldering kit
The reason behind the need of transistors is because most of the RGB strips need 12 volts to be powered with, so we will need an external power supply for the RGB strip and a secondary one for arduino (we could also use a 7805 voltage regulator to scale from 12 volts to 5 volts).
The transistors set the voltage given to each color channel controlling brightness and color type.
The RGB led strip i am using is an SMD 3528. It doesn't have lots of RGB leds, but instead it has 2 green, 2 blue and 2 red leds for each track (the entire strip is splitted into 10 cm tracks, so you can cut the length you want, solder it up and it will work). With this knowledge we know that setting 50% to red and 50% to blue won't generate a violet color. We will instead have red and blue leds with low brightness.
To have the full-color effect we will need to buy a different led strip.
P.S. we will not use addressable led strips.
Step 2: Connection
We will take the breadboard and put the arduino nano with 3 transistors on it.
Each transistor has 3 pins as Base, Collector and Emitter. We will connect one channel as it follows:
- Base to Ardino pin channel
- Collector to led relative channel
- Emitter to GND
The channels are:
- BLUE --> Arduino D3
- RED --> Arduino D5
- GREEN --> Arduino D6
Feel free to change pinout, just remember to choose PWM pins in arduino.
Step 3: Coding
The full arduino code is available on github and can be used with Arduino IDE.
I coded a few functions to see some basic effects:
fade_colors_slow: fades thru each color (red, green and blue) with FADESPEED and KEEPCOLORTIME as seconds.
all_on: sets all 3 colors on
change_colors_rough: changes colors directly from one to other
You can loop them, create some dynamical fade speed or whatever. Just remember that this led strip is not full-RGB, it have separate red, green and blue channels so those functions are cool for this strip. Having other strips will result in different colors and fading styles.
Step 4: Placing Inside PC Case
Now it's time to cut the rgb strip and place inside the PC's case. I choosed to place the breadboard on top of the power supply (the base is plastic, so no shortcuts will be made).
To power up the project we can use the power supply Peripheral connector (see picture of pinout) that offers 5V and 12V directly from power supply. Connect:
- 5V to Arduinot Vin
- 12V to RGB strip 12v
- GND to Arduino GND
If you want to continue uploading some code or changing it, we can remove the 5V connector and plug in the arduino to the pc using the USB port. This way we can upload our code and have the arduino powered up.
Step 5: Done!
Now you have your personal lighting system for your PC. Feel free to change the code and adapt to your needs.
Some changes can be made to this project, including:
- Using a NODEMCU V3 as the controller with a personal webserver having buttons and a cool interface to change settings and color effects or having a raspberry with interface sending HTTP requests to the controller (see this project)
- Using an ATTINY85 as controller to shrinkify the entire project (maybe soldering all into a PCB). A full post can be found here)
- Adding a bluetooth HC-05 module to control thru bluetooth...
That's it! Have fun.