Go Down

Topic: Tri color led strip with pots? (Read 730 times) previous topic - next topic

fultonm11

Aug 30, 2013, 01:07 am Last Edit: Aug 30, 2013, 02:59 am by fultonm11 Reason: 1
Hey all, first off very new user here. Ready to get my hands dirty with a fairly simple project. I found some code from the wiki and am curious if it would work for an led strip.

Basic idea is to have a 15 ft strip of tricolor leds in which I can color mix via pots. Im assuming, correct me if im wrong please, that I would need 12v power with the correct amperage instead of the 5v for smaller projects?

Here is the code, I think, I should start with. ANY help is very very appreciated. Looking forward to it!



Code: [Select]
Connect the LED's anode lead to +5v and connect the 3 RGB cathode leads to digital pins 9, 10, 11 respectively. Use 220 Ohm resistors on each pin of the cathode pins.
Wire up each potentiometer's first pin to +5v, the third pin to ground, and the second pin to analog pins 0, 1, 2. 0 is for Red, 1 is for Green, and 2 is for Blue.
Upload this source code to the arduino. Then turn up and down each pot to change the color of the LED.
Questions or problems: ziptiesispro@yahoo.com

// Init the Pins used for PWM
const int redPin = 9;
const int greenPin = 10;
const int bluePin = 11;

// Init the Pins used for 10K pots
const int redPotPin = 0;
const int greenPotPin = 1;
const int bluePotPin = 2;

// Init our Vars
int currentColorValueRed;
int currentColorValueGreen;
int currentColorValueBlue;

void setup()
{
 pinMode(redPin, OUTPUT);
 pinMode(greenPin, OUTPUT);
 pinMode(bluePin, OUTPUT);
}

void loop()
{
// Read the voltage on each analog pin then scale down to 0-255 and inverting the value for common anode
 currentColorValueRed = (255 - map( analogRead(redPotPin), 0, 1024, 0, 255 ) );
 currentColorValueBlue = (255 - map( analogRead(bluePotPin), 0, 1024, 0, 255 ) );
 currentColorValueGreen = (255 - map( analogRead(greenPotPin), 0, 1024, 0, 255 ) );

// Write the color to each pin using PWM and the value gathered above
 analogWrite(redPin, currentColorValueRed);
 analogWrite(bluePin, currentColorValueBlue);
 analogWrite(greenPin, currentColorValueGreen);

}


jack wp

Looks like the code is for a anode common tri color (single LED). Your strip is different.
what is the amp and voltage requirement for that 15 foot strip of leds?
What is the URL for specs on that led strip.
I suspect you do not realize yet, you need more power, actually, you need to power the led strip with its on supply probably.
LED strips require lots more power than an arduino board can provide, hence, separate power supplies ( common grounds tho ).


fultonm11

#2
Aug 30, 2013, 04:11 am Last Edit: Aug 30, 2013, 04:15 am by fultonm11 Reason: 1
Thanks for the response,

Here is the URL http://www.ledlightsworld.com/smd-5050-trichip-flexible-led-strip-with-150-leds-p-91.html#productinfoBody

They are SMD5050 LEDs and require 7.2w @ 12V DC. That is per meter and I plan on trying with 2 meters first then adding 2 more if all is well. How would I calculate amperage from that? Google? I can certainly
Do that.

Also, how would adress the change in code for the strip?

EDIT: from my brief search, I would need approx 1.309 amps for 2 meters...

Go Up