Arduino RGB LED Strip Controller




About: Software Developper by day, maker and learner by night/weekends ;)

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 :)

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Components

Step 2: The Schematic

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

Step 3: Voltage and Ground

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

Step 4: Potentiometers

Install the potentiometers on your breadboard

Step 5: Inputs

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.

Step 6: Potentiometers Voltages and Grounds

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

Step 7: Transistors

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.

Step 8: Outputs

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.

Step 9: Transistors Grounds

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.

Step 10: The Battery and the Strip

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.

Step 11: 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);

Step 12: The Final Product

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

Step 13: Here's How to Build It and What It Does

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

1 Person Made This Project!


  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

41 Discussions


Question 9 months ago on Step 3

The video is very instructive, but I'm modifying mine which has me wondering why you chose to divide the input (rVal = analogRead(rPotPin) / 4;) by 4?

4 answers

Answer 9 months ago

It is because the analogRead will map the voltage on the rPotPin to a digital value between 0 to 1023, whereas the analogWrite (rVal) can only output a voltage mapped from 0 to 255. By assigning the rVal variable to be equal to the analogRead/4, the resulting value assigned to rVal will always be within that 0 to 255 range.


Reply 9 months ago

Thanks for your reply!
I don't know if it will work for me, as I am 'graphing' one such value into a rgb spectrum.

rVal = -2(A0)+5;
bVal = 2(A0) -5;

if (A0 >= 2.5) {
gVal = 5 -rVal;
if (A0
gVal = 5 -bVal;

PS I'm using 5V
But thanks again!


Reply 8 months ago

What exactly are you doing with this, if you don't mind me asking? In the code you provided in your last comment, it looks like you have the potentiometer connected to pin A0? How does the result of your calculations affect the RGB values?

I also wanted to point out that it is good practice to avoid using pin numbers like this. Instead, try assigning the values to a variable before using them in a calculation. This way your arduino doesn't need to read the value multiple times to complete the calculation, as it will already be stored in memory as a variable. Additionally, in order to make the value fit within the 0 - 255 PWM range, you can use the built-in "map" function provided by the arduino IDE. This way, it also prevents any negative values being returned.


Reply 8 months ago

I was having a school project, but it failed. My promming didn't work, so instead of reading the input, it instead kept going through a cyckle of colors. (Red ,green, blue, red...)

But yeah, I rhink my fuctions probably set the output too high to be fluxuating between 0 and 5 volts, but thank you for your replies!


Question 1 year ago


I appreciate your tutorial!

I would like to create a light strip pattern where just one led is light, and it slowly moves along the length of the strip (so each bulb may be lit in order for 1-2 seconds).

Will I be able to control this?

1 answer

Answer 1 year ago

Hi, no you would need an WS2801 kind of led strip... or something equivalent.


Question 1 year ago on Step 12


I am looking to build a (remarkably) similar circuit to this, however, I have been considering 9 volt batteries. What kind of resistance should I use (or how do i calculate it) in order to keep my arduino and leds safe?



1 year ago

Hi. My rgb led is glowing only on pink color, arduino uno


1 year ago

what are transistors used for? i'm very new to this arduino, but i want to learn alot :)

Eraraya RicardoM

2 years ago

can I use this thing as a night lamp? do the transistors able to withstand workload of turned on for 8 hours each day? (assume that heatsink is on each of the transistors)


2 years ago

what if i change the power to 12v using power supply ?

1 reply

Reply 2 years ago

Well it depends on your led strip... if it takes 12 volts then sure go ahead


3 years ago

you are using a random rgb led strip ?

1 reply

Reply 3 years ago

Well I specify the product number in the instructable


3 years ago

when I connect up the battery first, the led strip blinks and goes off. Why?

1 reply

Reply 3 years ago

i experienced the same thing when i connected the arduino and led strip to the same supply.

Try giving the arduino and the leds a different source ,it should work then.


3 years ago

Very nice!

How can you make it happen only on battery...

I need it for a show and I can't plug it to any kind of power supply..


1 reply

3 years ago

Great project. Worked first try. There is a slight flicker when it's on but nothing too noticable.