Arduino RGB LED Strip Controller

by Clapoti in Circuits > Arduino

133892 Views, 180 Favorites, 0 Comments

Arduino RGB LED Strip Controller

DSC01073.JPG
RGB LED Strip

I was curious about using RGB LED Strip, so I got one and decided to do a little controller to see what I can do with it... so here it is.

If you have any questions, comments, constructive criticism... don't hesitate to write :)

If you like my build, please like the video on YouTube and subscribe, it would be nice :)

Components

DSC01083.JPG

The Schematic

schematic.jpg

This is what the circuit looks like... I used "123D Circuits" by Autodesk.

They don't have an LED Strip component, so I replaced it with the RGB LED here... but never connect an LED to a 9V battery without resistance, you will blow the LED.

Now let's build it

Voltage and Ground

DSC01081.JPG

Connect the voltage and the ground from your Arduino to the tracks of your breadboard.

Potentiometers

DSC01080.JPG

Install the potentiometers on your breadboard

Inputs

DSC01079.JPG

Connect the middle pin of you potentiometers to the analog pins A0, A1 and A2 of your Arduino, this will send a different voltage to the pins of the Arduino depending of the position of the potentiometer. Check the specs of your potentionmeters to know which pin is which.

Potentiometers Voltages and Grounds

DSC01078.JPG

Connect the voltage and grounds to the potentiometers. Check the specs of your potentionmeters to know which pin is which.

Transistors

DSC01077.JPG

Install the transistors on your breadboard. Google the model number of your transistor to know the pin configuration. Here you can find the documentation of the transistors I used, the BC547B, but don't rely on this for your transistors, because the pin configuration isn't standard.

Outputs

DSC01076.JPG

Connect the "base" pin of your transistor to digital PWM pins on your Arduino, I used pins 3, 5 and 6. Those will send the desired current to the transistors to light up the amount of each colour (red, green and blue) separately.

Transistors Grounds

DSC01075.JPG

Connect the "emitter" pins of your transistors to the ground. Again check the documentation of the transistor your are using to know the correct pin configuration.

The Battery and the Strip

DSC01074.JPG

Finally, connect the "collector" pin of your transistors to the LED strip,check your strip to know which pin is which colour. Then connect your battery snap wires, black to the ground and red to the anode (positive) pins of the strip. Now we just need to program the Arduino and try it.

The Code

This is the code to be able to run the controller. It's very basic, taking the value of the resistance coming from the potentiometers, limiting it and sending it to the LED strip via the transistors.

int const rPotPin = A2;
int const gPotPin = A1;
int const bPotPin = A0;

int const rOutPin = 3;
int const gOutPin = 5;
int const bOutPin = 6;

int rVal;
int gVal;
int bVal;

void setup()
{
  pinMode(rOutPin, OUTPUT);
  pinMode(gOutPin, OUTPUT);
  pinMode(bOutPin, OUTPUT);
}

void loop()
{
  rVal = analogRead(rPotPin) / 4;
  gVal = analogRead(gPotPin) / 4;
  bVal = analogRead(bPotPin) / 4;

  analogWrite(rOutPin, rVal);
  analogWrite(gOutPin, gVal);
  analogWrite(bOutPin, bVal);
}

The Final Product

DSC01067.JPG
DSC01068.JPG
DSC01069.JPG
DSC01070.JPG
DSC01071.JPG
DSC01072.JPG

Here you can see some of the colours you can create with different potentiometer positions :)

Here's How to Build It and What It Does

RGB LED Strip

If you like my build, please like the video on YouTube and subscribe, it would be nice :)