Global Sources
EE Times-Asia
Stay in touch with EE Times Asia
EE Times-Asia > Controls/MCUs

Grasp the science behind color mixing

Posted: 04 Jul 2012 ?? ?Print Version ?Bookmark and Share

Keywords:HB LEDs? Colour mixing? linear transformation?

Figure 5 shows the block diagram of a colour-mixing algorithm built upon Cypress' PowerPSoC family of controllers built around an 8bit microcontroller and combining up to four independent channels of constant current drivers which feature hysteretic controllers. It also contains configurable digital and analogue peripherals, operates from 7V to 32V, and drives up to 1A of current using internal MOSFET switches.

The implementation of a four-channel colour mix is based on a three-channel colour mix. The first step in the algorithm is the creation of a matrix. Then, find the inverse of the matrix and multiply it with Ymix. Ymix is the number of lumens that the total mixed light output must produce. These steps are shown in figure 6.

Figure 5: Block diagram for the implementation of colour-mix algorithm using Cypress' PowerPSoC.

Figure 6: Flowchart for three-channel colour mixing.

The resultant Y values of the product are the lumen output of each respective LED that is necessary to create the requested colour and flux.

At this point, all math operations give rise to two benefits of doing the math this way. If any of the final product's Y values are negative, it signifies that the colour coordinate that was requested is invalid. In other words, the requested colour was outside the colour gamut.

Also, check if any of the product's Y values are larger than the maximum lumen output of any of the three LEDs. This means that the Ymix input was too large. In this case, the firmware scales back the values so that they produce the maximum possible flux at the requested (x, y) coordinate.

The flowchart in figure 7 describes the steps required for four-channel colour mixing algorithm. If the colour points of four LEDs are mapped onto the chart, it forms four triangles. These triangles are made up of the following LED triplets: (R,G,B), (R,A,B), (R,G,A), and (G,A,B). These triangles are referred to as TRI1, TRI2, TRI3, and TRI4 in the flowchart.

The three-channel algorithm is implemented to solve dimming values for each of these triangles. Each triangle is solved to calculate TRx. If any of the three dimming values obtained from this process are negative, then the solution is invalid. If the solution is valid, the three dimming values are saved. When two sets of three valid dimming values are obtained, there is no need to proceed with the other triangles.

Figure 7: Flowchart for four-channel colour mixing.

The operation flow skips down to the "Add Two Sets of Dim Values" process as shown in figure 7. The six saved dimming values are added together so that there are four values: one for each of the four LEDs in the system. These four values are scaled to the appropriate dimming resolution and the dimming value solution is complete.

Lastly, these four dimming values are given as inputs to the external or internal drivers which control the brightness of LEDs by modulating the current flowing through each channel. If any three of four solutions are invalid that means the desired colour is not present in the colour gamut.

The user can implement this error condition. It may be done by continuing to retain the old colour, turning off the LED, and so on. These three-channel and four-channel colour-mix algorithms can be extended to more LEDs, as well as to a variety of lighting applications.

About the author
Anshul Gulati holds a Bachelors degree in Electrical and Electronics from BITS C Pilani, India. She has 8 years of experience in embedded systems design. Her interests include firmware development, digital design, and firmware/hardware co-design. She has worked on 8bit, 16bit and 32bit controllers from different semiconductor companies likes Cypress, Motorola, Microchip and STMicroelectronics. She is currently working in CSBU R&D team developing solutions based on Cypress' PSoC products.

To download the PDF version of this article, click here.

?First Page?Previous Page 1???2???3

Article Comments - Grasp the science behind color mixin...
*? You can enter [0] more charecters.
*Verify code:


Visit Asia Webinars to learn about the latest in technology and get practical design tips.

Back to Top