Introduction: Arduino RGB LED Strip Controller

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

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

Comments

author
h0tm (author)2016-10-18

you are using a random rgb led strip ?

author
Clapoti (author)h0tm2016-10-18

Well I specify the product number in the instructable

author
ebenezerdiagi (author)2016-03-11

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

author
navjotsd (author)ebenezerdiagi 2016-09-29

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.

author
reggaeshark (author)2016-03-18

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..

Thanks!!

author
navjotsd (author)reggaeshark 2016-09-29

powerbanks with dual usb out maybe, thats what i use

author
jdunlop3 (author)2016-09-17

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

author
jdunlop3 (author)jdunlop32016-09-17

It was the green flickering. I unplugged it from the breadboard and it has stopped. I still have no idea what it is. By the way my strip needs 12v and I am using a 12v power supply. The flicker gets worse with different colors. Could the limiter settings need changing?

author
AmitabhS (author)2015-01-13

How many LEDs you are able to glow using BC547B transistor? As per the spec, the transistor can support 100mA continuous current. As per my understanding, each segment of LED strip (comprising of 3 LEDs requires 60mA. But in the video i can see there are more than 3 LEDs glowing. Can you please provide more details on the LED strip? Also how much current is the strip consuming through the transistor?

Thanks.

author
AhmedA679 (author)AmitabhS2016-08-19

I was thinking the same, bc547 ic=100mA, so this should burnouts within very short time if we plug a led strip consist of even 20rgb leds

author
Clapoti (author)AmitabhS2015-01-13

Well you got me there... I have no idea how much it is consuming. I could plug 2 strips in a row... so 100 LEDs and it was still working. Would I have fried the transistor after a while ? That's possible, I would have to build the thing again and make the measurements.

author
AmitabhS (author)Clapoti2015-01-13

I think since you are using a 9V source, you might be saved. But you might not get true colors after some time as the battery voltage drops.
Do let me know what current ratings you are getting if possible? You can try connecting the led strip directly to the battery and check the current rating when each color is switched on and when all colors are on.

author
Clapoti (author)AmitabhS2015-01-16

I'll have to check, unfortunately time is lacking these days, I don't even have time for my current project.

author
ebenezerdiagi (author)2016-03-11

my code shows me 'rpotpin' was not declared in his scope

What should I do please

I using a spark fun led strip

author
Clapoti (author)ebenezerdiagi 2016-03-11

Did you declare the variables at the top ?
The code is case sensitive, so see if you use the correct letters

author
ebenezerdiagi (author)Clapoti2016-03-13

Hello, thank you for your reply.
I have figured out the code
But the circuit is giving me a lot of problems.
I can't seem to figures out what's wrong, but I think it's from
My led strip because when I try to test the led strip with a 9v battery or with a 12v, 2.3A source, the light doesn't stay on, it comes on for about 1/50 of a second and then goes off.
I don't know what's wrong with the led strip and I've had no luck getting help online
Please can you help

author
steffisteffi (author)2016-01-25

Very good!! Easy and working as it should! :-)

author
pacornwell made it! (author)2015-09-19

Worked the very first time!! Great instructable!

20150920_002139.jpg20150920_002144.jpg20150920_002150.jpg20150920_002203.jpg20150920_002205.jpg20150920_002210.jpg
author
Clapoti (author)pacornwell2015-09-22

Cool :)

author
bashar341 (author)2015-04-04

what is this?

FERP6T2I5UXAYIX.LARGE.jpg
author
Clapoti (author)bashar3412015-04-05

I explained it under the image,

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.

author
snevin (author)2015-02-02

I've tried this and connected it exactly as you've shown and the circuit works, however, the IC on the Arduino seems to get way too hot even before power to the LEDs is even added. Do you know which connection could be causing this? Is it something to even be concerned about?

author
Lectric Wizard (author)snevin2015-02-07

You could try using a 1k or so resistor instead of the jumpers to the transistor bases. ( orange blobs in altered layout below) Otherwise the transistors could be drawing too much current as the base to emitter junction will pull the output pin to 0.7v when it should be high. Hope this helps!!

169ABE0_MEDIUM.jpg
author
Clapoti (author)Lectric Wizard2015-02-08

This might help, thanks :)

author
ibenkos (author)2014-10-18

Smart idea! Thanks for shearig :)

author
Clapoti (author)ibenkos2014-10-19

Thank you :)

And it's my pleasure :)

author
Superbender (author)2014-10-12

Hi Clapoti,

Nice and straight forward instructable. I am missing an electrical schematic though. It would, I think, make it easier to follow your build.

author
Clapoti (author)Superbender2014-10-13

Here, I've just created and added a schematic in a new step (Step 2),with an LED instead of a LED Strip... but I hope it helps you :)

author
MsSweetSatisfaction (author)2014-10-12

Very nice project! Thanks for sharing!

author

Thanks :)

About This Instructable

83,091views

144favorites

License:

Bio: Software Developper by day, maker and learner by night/weekends ;)
More by Clapoti:Arduino Binary ClockWooden Puzzle Modular Electronics Prototyping BoardArduino RGB LED Strip Controller
Add instructable to: