Computing stuff tied to the physical world

RGB strips – the software

In Software on Sep 9, 2010 at 00:01

Now that the hardware is ready, let’s move on to the software. First task is to figure out all the pin assignments with a little “rgbTest.pde” sketch:

Screen Shot 2010 09 08 at 12.43.29

Yep, it works. Here’s AIO4 in action:

Dsc 1913

On to the real thing. I’m going to re-use the code from this post, but with a couple of modifications:

  • since that code apparently still flimmers a bit, I’m going to make it run faster by reducing the number of steps from 256 to 101, i.e. intensity values 0..100 – that should increase the refresh rate to about 300 Hz
  • the fourth value will be re-used as a general intensity control, so “RGBW” now means: take each individual RGB intensity times the W intensity
  • the main logic will remain the same, even for the “White” dimmer – this is harmless, since there is nothing connected to port 3
  • need to re-define the pin assignments to match the above, twice

Ok, the new sketch is here – it’s a bit long to include in this post. Now I can send messages via a JeeLink to control this thing:

  • full on: 100,100,100,100,100,100,100,100,30s
  • full off: 100,100,100,0,100,100,100,0,30s

And here’s a very first / rough attempt to create a decent white tint:

  • 100,40,5,0,100,40,5,100,30s

Here’s my (messy!) workbench with four different light sources:

Dsc 1916

  • top right – a warm white incandescent lamp, seems to use a 12V headlight
  • middle back, under the shelf: commercial sort-of-warm-white LED lamp
  • middle center, magnifying glass: fluorescent cool white tube
  • left front, paper sheet: my RGB test setup, indirect lighting

When looking straight at the LEDs (always a bit painful), you can clearly see the different colors. The color offsets produce a slight fringe in the shadows cast from this light:

Dsc 1917

This won’t be good enough for photographers, but my impression is that it might work out fine when used as indirect lighting.

The results did surprise me quite a bit: for this tint, you have to turn on as much red as possible, add some some green, and drop almost all the blue.

The unfortunate part is that the red LEDs are responsible for most of the energy loss via their series resistors. Sigh. I wish they’d make RGB strips with all resistors the same small value – I could easily adjust the actual intensity with PWM and stay below the maximum specs.

Some estimates gleaned from the lab power supply w.r.t. current draw for the 50 cm 60-LED strip + JeeNode:

  • all off: 10 mA
  • full on: 620 mA
  • warm white: 270 mA

That last one translates to 6.72 Watt/meter (with some 2W eaten up by the red-side resistors, yikes). I don’t think I’d want to go any lower than that as full-on lighting setting, so if Jee Labs is to get more of these RGB strips around the house, I’ll definitely want to use the 60 LED/meter strips.

  1. About your color mix ratio: “as much red as possible, add some some green, and drop almost all the blue.”

    This is very similar to how software normally converts a rgb image into a grayscale image, e.g.: gray=red0.7 + green0.25 + blue*0.05 (or some slight variation).

    There is a detailed description for LEDs at http://members.misty.com/don/ledrgb2w.html

  2. Nice work again!

    In the last paragraph you mention that you would use 60 LED/meter strips instead of 30 LED/meter strips due to high losses.

    I don’t understand that fully I think. Are you saying that given a certain amount of light, the 60 LED/meter version (using PWM) needs less power than the 30 LED/meter version????

  3. Mars, jcw only refers to the amount of light produced by the strips and feels that 30 leds/m is not enough. Which I totally agree. It’s often a good idea to have some lumens in reserve, although in normal conditions just a portion might be needed.

  4. Ah, sorry – no the efficiency would be the same, I was more thinking that the 30 LED/m option would not give me enough light. Dimming green and blue so far down means that the whole strip is essentially running at half brightness.

    Another idea to try out, now that the color balance is clearer, would be to drop the red setting (since it’s always 100%) and increase the resolution of the green and blue components for more accurate control. Perhaps specify the green and blue times directly in microseconds for PWM.

    And then there’s the issue of dimming the entire strip – I’d like to dim while maintaining a fairly accurate color balance. I suspect that the ratios will need to change for this. Some sort of lookup table may be needed, either in the ATmega, or on the controlling end.

  5. Ok, you both cleared that point up!

    Ik have a 5m 30 LED/meter strip in the living room on top of a bookcase, which lights the whole room (white ceiling reflects a lot of the light) if set to 100% brightness, so using a 60 LED/meter strip would be a bit toooooooooooooo much I guess…

    But I see your point if I adjust the strips colour to warm white: less light compared to white.

  6. Mars, are you directing the light from the strip directly to the ceiling or have you angled that towards the center of the room?

    Just thinking about the light output. I have a 60 led/m RGB strip of about 4 m length and a separate 60 leds/m white one on top of the shelf directed at the white ceiling. The light output isn’t enough for other than just ambient lightning. Led types are those quite common low-priced 5050s.

    • Angled and no diffusor whatsoever. Strip is about 30-50cm below the ceiling, so has lots of ‘room’. Furthermore, the walls are also some off-white color and also help to reflect the light into the living room.

      Using another color (red/green) is a distinct difference and gives me more ambient lighting.

Comments are closed.