Browse over 10,000 Electronics Projects

COLIBRÌ: the driver for RGBW LEDs

COLIBRÌ: the driver for RGBW LEDs

 

It allows to drive the ever-new 4 colour light diodes, by easily changing their brightness and colouring.

 

Recently some multicoloured power LEDs have appeared on the market and, differently from the more common RGB LEDs, they incorporate a white LED, as an addition: they are named RGBW (Red, Green, Blue, White) just because of this. They have been created because, even if in order to obtain a white light it is enough to light red, green and blue LEDs together (the brightness proportion as for red, green and blue will determine the white’s tone, that may be warm or cold), the addition of a white LED allows to obtain some much more “clean” white colours, in comparison with what could be obtained from mixing the three basic colours; it is moreover possible to use all the four LEDs together, in order to obtain a much greater luminous power.

 

AL8805-1

 

The RGBW type LEDs may be purchased typically in powers such as 4 x 1 watt (for a total of 4 watts) and 4 x 3 watt (for a total of 12 watts). It must be said that the real power must actually be inferior to what has been declared by the manufacturers, and it is always better to look at the maximum driving current more than at the power, if for no other reasons that the LEDs are current driven and that the manufacturers build brightness diagrams as a function of the direct current (If).

Given the availability of these new 4-colour LEDs, we have designed a driver in order to power them, starting from the control PWM signals that may be supplied, as an example, by a microcontroller, but also by an Arduino board. In these pages we will describe the project, also proposing a sketch for the management from Fishino Uno, that is our compatible Arduino Uno board.

Listing1

void loop(void)
{
// cycle to the growing brightness white
for(int w = 0; w < 256; w++)
{
// cycle for brightness (VALUE) ascending
for(int v = 100; v < 256; v++)
{
// cycle for Hue (HUE)
for(int h = 0; h < 256; h++)
{
showColor(h, 255, v, w);
delay(del);
}
}
// cycle for brightness (VALUE) descending
for(int v = 254; v >= 100; v--)
{
// cycle for Hue (HUE)
for(int h = 0; h < 256; h++)
{
showColor(h, 255, v, w);
delay(del);
}
}
}
// cycle to brightness of the white descending
for(int w = 254; w >= 0; w--)
{
// cycle for brightness (VALUE) ascending
for(int v = 100; v < 256; v++)
{
// cycle for Hue (HUE)
for(int h = 0; h < 256; h++)
{
showColor(h, 255, v, w);
delay(del);
}
}
// cycle for brightness (VALUE) descending
for(int v = 254; v >= 100; v--)
{
// cycle for Hue (HUE)
for(int h = 0; h < 256; h++)
{
showColor(h, 255, v, w);
delay(del);
}
}
}
}

 

Before analyzing the circuit diagram, we will return for a bit on the remarks concerning power and current that we made just a moment ago, so to explain how – for the purposes of evaluating a RGBW LED – the direct current should be taken into consideration. Let’s examine a 4-colour 4-watt LED, whose power is distributed among the four LEDs that usually receive a driving current of 300 mA (direct current); since the voltage drop on the LEDs changes depending on the colour, we have different powers for the various LEDs, that is to say:

 

Pred = (2,2÷2,5V) • 300 mA = 0,66÷0,75 W

Pgreen = (2,5÷2,8v) • 300 mA = 0,75÷0,84 W

Pblu, white = (3,2v÷3,4v) • 300 mA = 0,96÷1,02 W

 

Between brackets are indicated the minimum and maximum voltage drops on the diodes. Considering the maximum values, we have a total power that is equal to:

 

Ptot = 0,75 + 0,84 + 2,04 W = 3,63 W

 

Therefore it is quite close to what has been declared.

As for the 12-watt LEDs the things are a bit different, given that the maximum operating current declared amounts to 700 mA; now the powers become 1,75W for the red LED, 1,96W for the green LED and 2,38W for the white and blue ones. With such values, the total maximum power is:

 

Ptot = 8,47 W

 

This value is well under what has been declared, even if it still is a remarkable power.

The declared power as for the RGBW LEDs is thus to be intended as the maximum one, when piloting each LED at the maximum power, therefore with currents having different values.

 

DSC_9993

 

The project

As is well known, the LEDs have to be driven by means of a constant current and not of a constant voltage, in order to obtain the maximum performance and to avoid to “burn” them (please remember that the current variation in the diodes is an exponential one, therefore small voltage variations determine wide current variations). The main technique used in order to modulate the current and therefore the brightness consists in powering them with a PWM signal, that is to say a voltage having a square waveform, for which the duty-cycle is modulated. This technique is preferred because it allows to obtain very high performances, given that in order to supply power to the LEDs – under the form of pulses – it is enough to use functioning transistors in an on-off mode, by taking advantage of the minimal series resistances of the modern MOSFETs, and thus obtaining paltry power losses. If the LEDs were driven by linear voltage regulators – thus having transistors that operate as amplifiers – the more the voltage provided to the diodes is lower than the one of the power source, the more the performance would drop, since it would increase the voltage drop on the transistors, the current and the dissipated power being equal. The performance drop, therefore, would be coupled to the need to implement some dissipators, with an unavoidable increase of the costs and of the driver circuits’ size.

 

imma2

 

In this article we will therefore present a driver for a 4-channel LED, having excellent features and capable of driving elements that have a maximum current absorption of 1 Ampere per channel; our circuit is fitted so to receive PWM command signals (or even digital ones, at a TTL logical level) and is capable of accepting an input voltage from 6 to 36 volts.

Moreover, the high supply voltage that may be tolerated allows to drive more LEDs in series, so to create lamps and spotlights; for example, with a 36 volt voltage, it is possible to drive a maximum of 36V/3,4V = 10 white LEDs in series, for each channel.

 

Circuit diagram

As you may notice, the driver is composed of four sections that are perfectly identical, therefore we will only describe one of them, it being understood that what will be said will also be valid for the other ones.

All of this revolves around an integrated circuit driver, that has been specifically created to control the power LED, IC1, that is an AL8805 manufactured by Diodes. In practice, this is a step-down converter (buck converter), designed in order to supply a constant current output – having an adjustable value – since the LEDs are controlled in current, and by means of an adaptation of the voltage supplied to the LEDs, so to keep the intensity value that corresponds to the desired brightness: the more current is requested, the more the supplied voltage, and vice versa.

 

1242_Schema

 

Inside the integrated circuit, the output stage that powers the LED is composed of a MOSFET that depends on the SW (switch) pin, while the SET pin is used for the control of the output current, that is set by means of the R1 resistor, according to the following formula: 

 

formula1



Advertisement1


 

in which I is the current we want to circulate in the LEDs and VTHD is the reference voltage that is internal to the integrated circuit, and equal to 100 mV.

Therefore, if you want to have 300 mA to circulate in the LEDs – which is suited for the 4-watt LEDs we’ve been talking about – you need to insert a resistor equal to: 

 

formula2

 

that is the value that we inserted in the board, rounded off to 0.3 ohm. In order to obtain a 700 mA current – which is suited for the 12-watt LEDs – it is needed to insert a resistor that is equal to:

 

formula3

 

We may easily get close to this value by means of a second 0.3 ohm resistor, to be welded upon the one found on the PCB, so to create a parallel for a total of 0.15 ohm.

The L1 inductor and the Schottky D1 diode represent the remaining part of the buck converter that is contained in the integrated circuit. The converter operates at a maximum frequency of 1 MHz and thus allows the usage of components that have a limited price and a small size, be it for the inductor and for the C1 conductor filter, that is used uniquely in order to reduce the output ripple (the ripple of the direct voltage supplied to the LED) and to lessen possible interferences generated by the converter, though strictly speaking the LEDs shouldn’t need them.

Lastly, the C2 capacitor represents an essential filter/uncoupling as for the input, so that the integrated circuit may “see” a direct voltage that is lacking noises, and so to avoid malfunctions that may be originated by the presence of spikes.

Talking about the settings as for the output current carried out by means of R1, we omitted to say that it is meant as the maximum current, when the chip is set for the maximum brightness. Actually, the current in the LED may be modulated via the CTRL input, which, thanks to a couple of interesting mechanisms, allows a complete control as for the brightness, both by means of an analog voltage value and by means of a PWM square signal.

 

figura

 

In practice, the control may be carried out like this:

  • When a direct voltage below 0.4 volt is applied to the CTRL pin, the converter is turned off and the output goes to zero volts;

  • By applying a direct voltage between 0.4 and 2.5 volts to the CTRL pin,  the converter modifies the output current from zero to the maximum (as set by means of the R1), and proportionally to the input voltage;
  • if the direct voltage applied to the CTRL pin exceeds 2.5 volts, the converter keeps the output to the maximum value, as preset by means of R1;

  • By applying – on the other hand – a PWM signal to the CTRL input, but paying attention that the low value of the same is below 0.4 volts and that the high signal is greater than 2.5 volts (it may be obtained by means of logics, both at 3.3 V and at 5 V) the output is set accordingly to the duty-cycle of the signal itself, with a resolution of 1.024 steps.

 

Therefore it proves to be very simple to create an analog control by means of a potentiometer, as shown in figure. By rotating the potentiometer (signed as R1 in the aforementioned figure) it is possible to change the brightness from the minimum to the maximum, in a very simple way and without need for driver circuits that are based on a microcontroller; all of this allows to implement the dimmer function, with the minimum hardware possible.

 

Fig1

 

In this simplified diagram we do not take the lower threshold of 0.4 V into consideration, therefore the potentiometer will have a “dead” zone at the beginning, in which the LED will always turn out to be switched off. As an alternative, it is possible to insert a further resistor between the potentiometer and the ground, so to have a minimal voltage on CTRL that is equal to 0.4 volts. With the values in the diagram it is enough to insert a resistor of about 1.5-1.8 kohm. Going from the analog to the digital, by means of the sketch in listing 2 it is possible to obtain the whole range of colours on the LED, and they may vary in a continuous way.

Listing2

RgbColor HsvToRgb(HsvColor hsv) // HSV color conversion to color RGB
{
RgbColor rgb;
unsigned char region, p, q, t;
unsigned int h, s, v, remainder;
if (hsv.s == 0)
{
rgb.r = hsv.v;
rgb.g = hsv.v;
rgb.b = hsv.v;
return rgb;
}
h = hsv.h;
s = hsv.s;
v = hsv.v;
region = h / 43;
remainder = (h - (region * 43)) * 6;
p = (v * (255 - s)) >> 8;
q = (v * (255 - ((s * remainder) >> 8))) >> 8;
t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8;
switch (region)
{
case 0:
rgb.r = v;
rgb.g = t;
rgb.b = p;
break;
case 1:
rgb.r = q;
rgb.g = v;
rgb.b = p;
break;
case 2:
rgb.r = p;
rgb.g = v;
rgb.b = t;
break;
case 3:
rgb.r = p;
rgb.g = q;
rgb.b = v;
break;
case 4:
rgb.r = t;
rgb.g = p;
rgb.b = v;
break;
default:
rgb.r = v;
rgb.g = p;
rgb.b = q;
break;
}
return rgb;
}

 

The variation is not executed – as usual – in the RGB colour space (that is to say by making the single colours change in 3 nested cycles), which is not so pleasant from a chromatic point of view, but by operating in HSV (or HSL) space, that is to say Hue-Saturation-Value.

In order to avoid too long a duration for the cycle the Saturation has been set to the maximum value (and therefore the colours will be very “deep”) and only e Hue and Value will be varied, moreover there is an external cycle that will add a white component to the effect.

The sketch is quite a simple one; by means of 3 nested cycles the values for the White (external cycle), for the Brightness (intermediate cycle) and for the  Tone (internal cycle) are varied.

 

DSC_9988

 

The additional cycles are due to the fact that we want to avoid “surges” in the values, by passing directly from the maximum (255) to the zero; the values for the White and for the Brightness are therefore varied from 0 to 255 and from 255 to 0, gradually. As for the Hue value, since it is found in a circular space, it does not need these precautions.

The ‘del’ variable checks, as it was said above, that the delay in the most internal cycle and therefore the speed of the chromatic variations.

A final notice: the control via Arduino considers the usage of the PWM outputs, and they are only a few; this way with Arduino UNO it is possible to control only a RGBW LED, which is quite a limitation.

For this and other reasons, in a following article we will present an expansion shield, supplied with 16 PWM channels, and that may be controlled by means of an I²C-Bus interface, that will allow to use as many as 4 drivers at the same time, thus driving four RGBW LEDs or a whopping 16 monochromatic LEDs at the same time.

 

From openstore

Colibrì – Driver for power led RGBW

1 watt LED RGBW

3 watt LED RGBW

Fishino UNO

Arduino UNO R3

 

 


Top