Experiment #6: Infra-red receiver feedback RGB LED colour balance


It has been decided to use an RGB LED in the infra red receiver unit to provide feedback to the user when entering commands via the infra-red controller.

Each of the elements of the RGB LED have different intensities when being driven via the same value resistors. The consequence is that, for the same PWM value each element of the LED has a different brightness level. This also means that any colours that require a mix of LED elements don’t appear as expected. So it has been decided to use different value resistors for each of the elements. This experiment was to find what resistances gave the most balanced brightness level for each LED element.


An RGB LED was tested displaying the following colours in a repeating sequence, using a pulse modulated 5V signal.

Resistors of different values were attached to each of the LED’s red, green and blues pins until:

  1. Each of the red, green and blue LED segment, when run at full intensity, were equally bright.elements off.
  2. White appeared with as little colour cast as possible.
  3. Yellow, which is a mix of red and green, appeared correctly and at a similar intensity to the red, green and blue segments on their own.

Note that it was important to calculate the minimum safe resistance for each of the LED’s elements and never to use less than that resistance.


The red, green and blue anodes of a common cathode RGB LED were connected to different PWM pins of an Arduino Nano clone, via resistors. The LED’s cathode was connected to the Nano’s GND pin.

The values of the resistors were then changed until the required colour balance was achieved.

The circuit diagram was as follows:

RGB LED test circuit diagram.


The code used in this experiment is available from the cahamo/diorama project on GitHub, in the research\ir-control-tests\rgb-led-colour-balance directory. The code was developed in C++ using PlatformIO.

There is just one program, rgb-led-colour-balance.cpp that cycles through each of the colours listed above and sends the required PWM signals to the RGB LED’s red, green and blue anodes.

When primary colours red, green and blue, a “fully on” value of 255 was sent to the associated anode, while the others were turned off. The PWM values sent to the RGB LED for the “mixed” colours yellow and white were modified in the code until the colours appeared with approximately the same intensity as the primary colours.


The following resistances were found to (a) give the required overall intensity of the LED and (b) give the best balance between the red, green and blue elements:

LED colour Resistance
Red 680Ω
Green 5.1kΩ
Blue 2kΩ

The following values were used in the program for each colour:

Colour Red PWM value Green PWM value Blue PWM value
Red 255 0 0
Green 0 255 0
Blue 0 0 255
Yellow 192 192 0
White 192 192 192

Back to Central Control page | Main project page