rainbowduino firmware, gammatab question

hey guys

i have a question about the rainbowduino firmware, can someone explain me, whats exactly the purpose of the gammatab is? i dont get it!

my problem is, that my output on the ledmatrix looks a bit flat/dimmed. I can workarround this issue, if I multiply the color with itself (rr/255, gg/255, b*b/255 then convert to “rainbowduino” format) and thus get more contrast. I ask myself if there is another way, perhaps with this “mysterious” gamma tab?


Hi Michu, the gamma tab is supposed to be for adjusting the output at each level of brightness, by changing the length of time the LED is on for each level. It won’t make the LEDs any brighter at the maximum (level 15) though. Try increasing the supply voltage, they are not very bright at 5V.

thanks for your reply. indeed the saturation is not very good if i use the default gamma tab:

{0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7};  // Default Gamma

and currently i use the internal 5v (supplied by arduino). I’ll switch to external power supply and check the difference.

however, if I use a progressive gamma:

{0xFF,0xFE,0xFD,0xFC,0xFB,0xF9,0xF7,0xF5,0xF3,0xF0,0xED,0xEA,0xE7,0xE4,0xE1,0xDD};  // Progressive gamma

the saturation is MUCH better. but there is one drawback, occasionally (about each 10s) the internal buffer gets screwed up (all red pixels light up, or all blue/green/all pixels light up for some ms). and i have absolutely NO idea where the problem might be.

can someone of the ardiono cracks help me?

For beginners (like me), the arduino interrupt code is not very easy to understand and there are issues porting the code. why not using a library like flexi timer (Based on MsTimer2 V0.5).


I did some experiments:

  1. replace
    with this code:
    FlexiTimer2::set(1, 0.0001, displayNextLine);

  2. add
    void displayNextLine() {
    flash_next_line(line, level); // scan the next line in LED matrix level by level.
    if(line>7) // when have scaned all LEC the back to line 0 and add the level
    if(level>15) {

thats all. what do you think about it?

That looks a lot simpler. Does it make the compiled program size much bigger though?

not much, as the flexi timer library is basically a interrupt wrapper. it grows maybe several bytes, but you get portability for free (doesnt matter which arduino chip is used)…