# Series of three potentiometers on one analog input (es: led RGB)

Hi to all and tank you for any suggestion,
I have a question about advanced using of potentiometers, but I can use an example to explain better what I mean.
there are many solutions to control an RGB led with arduino and potentiometers.
something like these:

1. rgb led with single potentiometer: Legwinskij's Gadgets: Arduino RGB Mixer with single Potentiometer
2. rgb led with 3 potentiometers: http://www.arduino.cc/playground/Main/RGBLEDPWM

My question is valid for this hack but also for many others…
There is a way to control simultaneously the three colors (RGB) with 3 potentiometers without a swicth (es:1) and only one analog input?

I would use 3 potentiometer, in series, that have different load on a single analog input so that the sum of their values would be useful to generate an unic number for decoding rgb different amount.
To explain better the idea look this image:

in this case (i don’t how to realize it), I should have a single value (es: 195) that would be enough to set up the three values of RGB led.
(in the example 195 => 1 for Blue(lowest intensity), 9 for green (max intensity) and 5 for red (medium intensity)

could someone help me to understand if this solution is possible and, in that case, some suggestion to realize it?

thanks a lot,
Marco.

I don’t think that what you want to do is possible with pots. It would be possible with switched resistors that have discrete values.

You could eliminate the momentary switch and use a single pot:

``````unsigned color = analogRead(potPin);  // Read 10-bit value
byte Red    = (color & 0b0000000111) << 5; // 3 bits (8 levels) of Red
byte Green = (color & 0b0001111000) << 1; // 4 bits (16 levels) of Green
byte Blue   = (color & 0b1110000000) >> 2; // 3 bits (8 levels) of Blue
analogWrite(redPin, RED);
analogWrite(greenPin, Green);
analogWtite(bluePin, Blue);
``````

I agree, it's not possible to read 3 pots and work out how far each one is rotated using with a single pin. If it's specifically analog pins you are short of, you could use 1 analog pin and 3 digital pins (or 2 at a push) to achieve this.

I would recommend three transistors that each tie the potentiometer moving pin to the same analog input. Drive the three transistors from three digital pins (or two, with a binary-to-selector decoder :-).
The sketch would read one value, and then switch which one is active, and then do anything else, each time through the loop. This gives the single analog input some time to stabilize before the next input is read.

If you have digital pins available, use rotary encoder with a clickable shaft. You rotate to set one color, click the shaft to go to the next color.