Re: RGB LED's



On Thu, 22 Jan 2009 13:12:20 +0000, Jan Panteltje wrote:

What I want to solder together one of these days is a simple PIC
with 3 PWM outputs driving those 3 LEDS, and RS232 in, accepting the
appended list.

[X11's rgb.txt file]

So you can then send for example 238 232 170, and get the color 'pale
goldenrod', or ask for 'pale goldenrod' and the LEDs are set that way.

Should not be too difficult to program, hope PIC is big enough for all
those strings... that table is 17371 bytes... mmm, need external memory
or bigger PIC perhaps.

You don't need to store the entire table as raw ASCII.

For a start, 11 bytes (3+1+3+1+3) for the RGB is excessive.

If you don't need to reject invalid values, you can just store an array of
RGB triples indexed using a hash of the string. 657 distinct strings @ 3
bytes each = 1971 bytes.

Even if you need to store all of the strings, there's a lot of scope
for compression. gzipping the raw table comes out at 1715 bytes; I don't
know how much space a gzip decompressor would take, but LZW is pretty
trivial (and no longer patented).

You may be able to improve compression further by taking advantage of the
nature of the data, e.g.:

You can lose 101 entries if you equate grey/gray in code.

You can omit the versions with spaces (their RGB values are identical to
those without spaces) and strip spaces on input. Or omit those without
spaces and skip the space when checking.

You only need [A-WZ0-9] (no X) without case sensitivity, 35 values = 5.17
bits/char = 6 chars in a 32-bit word.

If you store the table alphabetically, you can use an encoding which takes
advantage of similarities in consecutive entries (e.g. a code to indicate
that the first N characters are identical to the previous name).

Or just find yourself a "demo" coder; a decent one could probably get both
data and code into less than 1KiB.

Or put the table on the PC side and just send the numbers, using a small
PIC.

This is part of the Linux distribution, and as such copyright of Xorg,
and likely GPL:

X is MIT-licensed, which means you can do what you want so long as you
don't remove any copyright notice or warranty disclaimer. You'll find the
same file included with commercial versions of X.

.



Relevant Pages

  • Re: Outdoor Christmas Tree With Lights Not In Series?
    ... I can surely purchase C7 bulbs that consume 7 watts as well as going as ... on strings to old for any ... specifications to extent of actual power consumption, ... Maybe not much out of the ballpark - I figure that if the LEDs have any ...
    (alt.home.repair)
  • Re: Just checking if my thinking is right on an automotive LED lighting design
    ... >> per string and limiting resistor is a good route. ... The cost of the LEDs is trivial. ... > for a parking light and the bright filament for intermittent use ... I can probably run twenty strings of 6 LEDs ...
    (sci.electronics.basics)
  • Re: X-10 Mister House Motion sensor problems
    ... Mom and Dad who need more than a dimmed bulb hallway bulb. ... I changed over to the LED strings last Christmas, to save wattage and the X10 appliance would not turn off the 5 strings of 50 each bulbs. ... Ergo, we needed a night light for the whole hall, and the LEDs hung on adhesive cup hooks at the ceiling provide an unobtrusive ghostly light. ... I will wire that to an existing attic light switch and replace the existing attic lights with CFLs at the same time. ...
    (comp.home.automation)
  • RE: HeapFree() Failure
    ... HeapAllocand HeapFreecalls with GlobalAlloc() and GlobalFree ... globally defined strings it declares like so: ... Sixteen bytes are successfully allocated to store pointers to ...
    (microsoft.public.windowsce.embedded)
  • Re: LED backlight driver
    ... The LEDs are arranged as 5 series strings of 9 white LEDs. ... The brightness needs to be adjustable down to 2 mA per string. ... feedback pin connected to current-sensing resistor. ...
    (sci.electronics.design)

Loading