Martin's corner on the web

Temperature to color encoding for visual status display using RGB LED

I sometimes need to quickly check on certain temperature reading and find myself walking to one of my status displays to see, for example, if there will be enough solar hot water for a hot tub. I figured, it would be easier to encode the temperature to color, so I could visually check a temperature reading from across the room (not necessarily solar water tank’s temperature, could be any measurement including power usage, humidity, moisture etc). An excellent tool for the purpose would be a RGB LED. I have previously toyed with one, using the software PWM library since not all routed header pins on the Funky v2 support hardware PWM. My RGB led was a clear cased one and I had to diffuse it with sandpaper so that it becomes usable.

The code to convert temperature to RGB values is heavily copied off John Montgomery’s similar project, I like his approach the best. Basically he enumerates the major temperature color points and interpolates between these values, so coldest is encoded with purple, then come blue, cyan, green, yellow and warmest is red. You define a minimum and maximum range so that the temperature is mapped accordingly, for my solar hot water tank I chose a range of 40-80 degrees C.


Here is a video and a picture of the setup:


The video doesn’t show the true colors, it is much more saturated and looks better live.

So my final code intercepts the solar hot water tank wireless transmissions and visualizes them on the RGB. Pretty neat. I may use this approach to drive a RGB LED strip in the future using MOSFETs.