plugfest: LED colour temp & brightness to RGB values?

My travel, EU reports, and work on EU funding for W3C staff have severely curtailed the time I have for working on my demo which has been frustrating. As a consequence, my plugfest demo won’t be finished in time for TPAC.  One development task that I’ve looked at very briefly is the need for algorithmically mapping the colour temperature and brightness to RGB values for the white light source called for in the plugfest.

I bought a pack of cheap RGB LEDs, with a view to using pulse width modulation to control the intensity of the red, green and blue diodes. This involves programming the PWM values for the GPIO pins and choosing appropriate resistor values. The code for smoothly transitioning from one set of values to another over a given period of time, can likewise use interpolation and a hardware timer interrupt[1].

The Tanner-Helland algorithm [2] involves natural logarithms and floating point operations which are expensive for low end microcontrollers. The alternative is to use tables and interpolation.  I would be interested in how others have been tackling this!

[1] The timer interrupt service request pushes a “tick" event onto an event queue that is dispatched from the Arduino “loop” method for a programming model analogous to web pages. The “tick” event is also used to time resending of messages when waiting for acknowledgement of receipt, as a key part of my code for reliable in-order delivery of messages over UDP.

[2] http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/

Best regards,
—
   Dave Raggett <dsr@w3.org <mailto:dsr@w3.org>>

Received on Wednesday, 21 October 2015 17:16:29 UTC