A pot of many colors

Microchip MCP6002

Here’s a neat and novel way of using a long-tailed pair to drive not just two but three LEDs.

As everyone knows, rainbows always have pots of gold at their ends. This Design Idea reverses that, starting with a pot (no gold, alas) and ending with a rainbow.
Bi-color LEDs can be useful animals for indicating circuit balance or battery condition, and the common-cathode types are easily driven with a long-tailed pair, with various proportions of red and green giving oranges and yellows. Tri-color (RGB) types, capable of producing a much wider spectrum, usually need three separate drive sources.

So what happens if we drive drive the red and blue LEDs with a modified long-tailed pair, adding in the green as some function of the other two? Read on to find out.

Figure 1 shows the first attempt.

The red and blue LEDs are driven by a long-tailed pair and controlled by pot (potentiometer) R4, whose wiper voltage varies according to its position and is used to control the green LED's drive, producing a decently wide spectrum.
Figure 1. The red and blue LEDs are driven by a long-tailed pair and controlled by pot (potentiometer) R4,
whose wiper voltage varies according to its position and is used to control the green LED’s
drive, producing a decently wide spectrum.

Figure 2 gives plots of the three LED currents as calculated by LTspice, which did most of this Design Idea’s heavy lifting. When pot R4’s wiper is at either end of its travel, Q1 or Q2 will be fully on and the voltage across R5 will be high (~3 V). When it’s centered, Q1 and Q2 and thus the red and blue LEDs will be largely off, but the top of R5 will fall to ~1.7 V. That 3 V is enough to hold the Darlington-pair current source Q3/4 off, while reducing it towards 1.7 V gently turns it on, proportionately driving the green LED.

This graph plots the LED currents against pot rotation.
Figure 2. This graph plots the LED currents against pot rotation.

This result is optimized, meaning it’s the best that Figure 1 can do, but is still rather unsatisfactory because the drives for intermediate colors – oranges, lemons, and the interesting cyans and turquoises – are badly matched, giving rather sludgy shades compared with the pure ones. Breadboarding confirmed the problem.

Take two

Some thought and a rearrangement of the circuit gave Figure 3.

Rearranging the circuit and adding an op-amp to drive the green LED gives better, more linear control of the LED currents.
Figure 3. Rearranging the circuit and adding an op-amp to drive the green LED
gives better, more linear control of the LED currents.

The pot now gives a lower, more linear, drive to Q1/Q2, the green-controlling voltage being picked off from the tail resistor R1. Obviously, the voltage across R1 is at a maximum with the pot at either extreme and falls to near zero with the pot centered, when red and blue LEDs are off. A1 amplifies that voltage and drives the green LED through R7.

Figure 4 shows the sim plot, which implies that it should work much better when built as indeed it does!Owing to brightness mismatches in my 10 mm diffused LEDs (common to most tri-color types) I had to drop the green drive by increasing R7 to 1k2. That drive is also affected by LED1_G’s forward voltage; turning A1 into a proper current source worked well but added more components and didn’t look any better. After fixing R7, the brightness was fairly constant over the whole available spectrum.

The response of the revised design has more linear curves, giving a smoother spectrum.
Figure 4. The response of the revised design has more linear curves,
giving a smoother spectrum.

A rainbow, or only a portion thereof?

Ah, that weasel word “available”! This can never quite match a real rainbow or other white-light spectrum because the deepest reds and the furthest indigos and violets are outside its range – even rainbows have rather a limited palette compared with a full RGB mix. Swapping the LEDs around gives some interesting spectra (to use the word loosely) in other parts of the chromaticity diagram.

A digital departure

While the basic analog circuit may find applications where three interdependent values need to be controlled by a single pot, there is a better way to drive LEDs like this: use a micro that can read the voltage tapped from a pot and generate appropriate PWM signals to drive the LEDs, perhaps indirectly should you need kilo-lumen rainbows. This approach would also allow direct voltage control of the effects.

I have some solar-powered garden lights that use this principle to span the whole (again, “available”) RGB gamut, using what looks like my my favorite PIC12F1501 nanocontroller containing a mere 64 bytes of RAM, but more peripherals than pins. Internal demons crank three virtual pots up and down, although low-powered operation means a low and flickery PWM rate. Time to put on the coding hat – waterproof, because rainbows imply rain – and have some digital fun doing it properly.

Materials on the topic

  1. Datasheet Fairchild BC557B
  2. Datasheet Microchip MCP6002

EDN