Potentiometer' capability to smoothly controling RGB LED

I was just setting up an RGB LED (http://www.dealextreme.com/p/3w-led-emitter-on-star-multicolored-rgb-4530) and its driver (http://www.dealextreme.com/p/waterproof-650ma-3w-led-constant-current-source-power-supply-driver-85-265v-81772)

seems to be working Okay. However i've connected a pot with each color anode (R / G / B) to try to easily select how much Red / Green and Blue I wanted. I tried a 10k, 1k and a 10k Multi-turn pot and the behaviour is the same... On the limit of the potentiometer (left) the color is at its maximum output, however a TINY TINY turn of the potentiometer reduces dramatically the color output, and a TINY bit more and its off, and i still have almost 90% of the Pot to use to the other limit.

I've had this problem several times but never thought much about it but right now, I could use the whole range of the Pot to dim the color.

220v -> Driver (outputs 4v) -> RED wire goes to all the colors / BLACK wire goes to ground (all colors light up, I get some kind of white) The potentiometer was in series with the LED, on the RED wire. So 3 colors would be 3 pots.

After fixing this problem, I'd like to use only one Potentiometer to cycle between all the colors, is that possible without a microcontroller?

Thank you.

Hi, No that's not possible without an Arduino etc... as I see it..

Your constant current supply will defeat most attempts at dimming smoothly.

Some RGB info here: http://arduino-info.wikispaces.com/RGB-LED

No way to dim a color with a potentiometer? awww crap that ruins the project >_>

There is but not with a constant current supply and those values of pot. Use a 100R fixed resistor in series with a 1K pot and a fixed voltage. Then you will be able to see it dim. But as Terry says the whole point of a constant current drive is that the current and hence the brightness stays constant. By adding the pot you are taking the constant current driver outside it's working zone because it can't raise the voltage high enough to compensate for the pot.

All colors is a bit much. the human eye can see (16?) millions of colors. If your potentiometer can do 16 million stable values you can do it easily with one potmeter.

Back to reality. You have an Arduino with max 1024 different values from the potmeter.

How can you get more than 1024 colors?

Option 1: the morphing potmeter
first you can create a lookup table in EEPROM for every value from 0…1023 => external eeprom. Every value maps on 3 bytes R G and B. By choosing smartly from the color spectrum you can choose quite different colors.

Now to the tricky part:

Suppose you have a color {x1,y1,z1} for potvalue A.
You turn the potmeter to position B and a new color {x2,y2,z2} is fetched from EEPROM.

Imagine a function that morphs the color from A to color B, read good morphing not switching. That means you need to have a previous value and go in small steps to the new value

in pseudocode incomplete but to get the idea.

#define STEPS 20;
#define POT 0

float R=0, G=0, B=0;

void loop()
{
  // READ NEW COLOR
  newval = analogRead(POT);
  newR = eepromread(3*newval+0);
  newG = eepromread(3*newval+1);
  newB = eepromread(3*newval+2);

  // MORPHING OLD TO NEW (step by step
  R += (newR - R) / STEPS ;
  G += (newG - G) / STEPS ;
  B += (newB - B) / STEPS ;

  // DISPLAY IT
  DoLED(R,G,B);

  delay(5);
}

The color will change smoothly from on to the other and thereby displaying more colors than available in the lookup table. In fact the color walks from its current color smoothly to the color selected with the potmeter, and it does that with smaller and smaller steps (thats why I used floats for RGB). As you have 1024 points in colorspace there are 1024x1023 walks which is about a million. These walks are made in 20 steps (in example code) so in theory you could trigger 20 million different colors, but that is not the end. If the color is halfway a walk and you turn the potmeter again the walk changes direction. The number of possible points will rise again. OK in practice many paths will cross and you will allways end in one of the 1024 colorspots but the application can visit at least a million.

OPtion umber 2: the random color potmeter.
(pseudocode only)

void loop()
{
  // READ RANDOM COLOR
  val = analogRead(POT);
  for (inti=0; i<val; i++) R = random(255);
  for (inti=0; i<val; i++) G = random(255);
  for (inti=0; i<val; i++) B = random(255);

  // DISPLAY IT
  DoLED(R,G,B);

  delay(5);
}

Option 3: the smart potmeter

the first turn of the pot is the R component,
the second turn is the G component,
the third turn is the B component.
By turning the pot to zero again the next color is chosen and as long the potmeter is not stable it looks for that color…

void loop()
{
  // DO THE R
  while(val > 0) val = analogRead(POT); // wait until 0; turn pot to the left
  oldval =255;
  while (oldval != val)  turn the pot to a stable position.
  {
    oldval = val;
    delay(20);
    val = analogRead(POT);
    R = val/255;
    DoLED(R,G,B);
  }

  // DO THE G
  while(val > 0) val = analogRead(POT); // wait until 0; turn pot to the left
  oldval =255;
  while (oldval != val)  turn the pot to a stable position.
  {
    oldval = val;
    delay(20);
    val = analogRead(POT);
    G= val/255;
    DoLED(R,G,B);
  }

  // DO THE B
  while(val > 0) val = analogRead(POT); // wait until 0; turn pot to the left
  oldval =255;
  while (oldval != val)  turn the pot to a stable position.
  {
    oldval = val;
    delay(20);
    val = analogRead(POT);
    B= val/255;
    DoLED(R,G,B);
  }
}

HOmework is to make a working implementation of all three algorithms, write a playground story, do a usability test and last but not least have fun building it :slight_smile:

(last hint, you might need PWM to control the brightness:)

Also, try a rotary encoder. You can do a smooth variation with rotary encoder and there is no limit in either rotation direction.

I cant really use an arduino for This project because i lack the space for all that (pots, arduino, driver, whatnot). Ill try to upload a sketch so you can see what im aiming for.

Hmm gotta re-think this.....

Not sure if you can see it correctly, im uploading this from a smartphone. ;)

Hi, There are many many LED driver modules available now.

Take a look at Meanwell, one of the biggies:

look for:http://www.meanwell.com/product/led/LED_google.html?gclid=CMC34Iyf6qsCFYGGDgodIyTLJg

• 3 in 1 dimming function (1~10VDC, PWM signal
or resistance)

I’m thinking of stocking the PWM versions on YourDuino.com

Hmmm guess ill ditch the RGB LED for this project.

Ill try to use the 3.7v 1A white SSC-p7 I have.

I was searching around and, I can do PWM with a 555 timer.
one 555timer per color and i can control each color individualy.

same driver , same RGB led, new 555 timer array for PWM control over the colors.
What do you think? seems feasible?