Using SK6812 WWA LEDs for "Dim-to-Warm" Effect with Arduino and FastLED Library

Hello everyone,

I am considering using SK6812 WWA LEDs to create a "dim-to-warm" or tungsten emulation. My plan is to control the LED strips using an Arduino, an RS485 module / MAX485, and the FastLED library. The goal is to be able to dim the amber and warm white LEDs in accordance with the behavior of an incandescent bulb, using a DMX channel per LED.

Has anyone attempted a similar project or could provide some guidance on how I could implement this? I'm particularly interested in how I could best calculate the amber and warm white components to achieve a realistic incandescent bulb emulation. One idea that came to mind was to use a lookup table.

I would greatly appreciate any feedback or suggestions on this topic!

Best regards!

A lookup table will be the most accurate, and canbbe stored in PROGMEM if needed. Curves created with a percentage of lineair / (1-Cos() ) per channel are another option.

how did you imagine the wiring to be ?

Thanks very much! I made it and its working fine with a lookup table ... only thing is on the bottom end its a bit steppy/notchy when I run a dimmer chase. Is probably due to the few steps or resolution (255 / 8 bit) ...... Is there a way to avoid this?

Here is my Code:

#include <avr/pgmspace.h>  // Needed for PROGMEM and pgm_read_byte()
#include <DMXSerial.h>
#include "ws2812.h"

#define dmxModePin        2
#define dmxBaseCh         1
#define NUM_LEDS          10

const int RedPin =    13;
const int startChannel = 3;

byte uwLevel, wwLevel, cwLevel;
byte ledRgbData[NUM_LEDS * 3]; 

const uint8_t PROGMEM cwgamma8[] = {
0,  1,  1,  1,  1,  1,  1,  1,  1,  2,  2,  2,  3,  3,  3,  4,  4,  4,  5,  5,  6,  6,  7,  7,  7,  8,  8,  9,  9,  10,  10,  11,  11,  12,  13,  13,  14,  14,  15,  15,  16,  17,  17,  18,  18,  19,  20,  20,  21,  22,  22,  23,  24,  24,  25,  26,  27,  27,  28,  29,  29,  30,  31,  32,  32,  33,  34,  35,  35,  36,  37,  38,  39,  39,  40,  41,  42,  43,  44,  44,  45,  46,  47,  48,  49,  50,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  59,  60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  91,  92,  93,  94,  95,  96,  97,  98,  99,  100,  101,  103,  104,  105,  106,  107,  108,  109,  110,  112,  113,  114,  115,  116,  117,  119,  120,  121,  122,  123,  124,  126,  127,  128,  129,  130,  132,  133,  134,  135,  136,  138,  139,  140,  141,  143,  144,  145,  146,  148,  149,  150,  151,  153,  154,  155,  157,  158,  159,  160,  162,  163,  164,  166,  167,  168,  170,  171,  172,  174,  175,  176,  178,  179,  180,  182,  183,  184,  186,  187,  188,  190,  191,  192,  194,  195,  197,  198,  199,  201,  202,  204,  205,  206,  208,  209,  211,  212,  213,  215,  216,  218,  219,  221,  222,  223,  225,  226,  228,  229,  231,  232,  234,  235,  237,  238,  240,  241,  243,  244,  245,  247,  248,  249,  250,  251,  253,  254, 255 };


const uint8_t PROGMEM uwgamma8[] = {
0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 29, 29, 29, 29, 29, 29, 29, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 26, 26, 26, 26, 26, 26, 25, 25, 25, 24, 25, 24, 24, 24, 24, 24, 24, 24, 24, 23, 23, 23, 23, 23, 23, 22, 23, 23, 22, 23, 22, 22, 22, 22, 22, 22, 22, 21, 22, 21, 21, 21, 21, 21, 20, 21, 21, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18, 18, 19, 18, 18, 18, 18, 18, 18, 18, 17, 17, 17, 17, 17, 17, 17, 17, 16, 16, 16, 16, 16, 16, 16, 16, 15, 15, 15, 15, 16, 15, 15, 15, 15, 14, 14, 14, 13, 14, 13, 13, 13, 12, 12, 11, 11, 10, 10, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 3, 3, 2, 2, 1, 0, 0, 0, 0,
};

const uint8_t PROGMEM wwgamma8[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 12, 13, 13, 14, 15, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 24, 25, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 105, 106, 107, 108, 109, 110, 111, 112, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 126, 127, 128, 129, 130, 131, 132, 133, 134, 136, 137, 138, 139, 140, 141, 142, 143, 144, 146, 147, 148, 149, 150, 151, 152, 153, 154, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 170, 171, 172, 173, 174, 175, 176, 177, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 190, 191, 192, 193, 194, 195, 196, 197, 198, 200, 201, 202, 203, 204, 205, 207, 208, 209, 211, 212, 213, 214, 216, 217, 218, 220, 221, 223, 224, 225, 227, 228, 230, 231, 233, 234, 236, 237, 239, 240, 242, 243, 245, 247, 248, 250, 251, 253, 255,
};



void setup () {
  DMXSerial.init(DMXProbe, dmxModePin);
  DMXSerial.maxChannel(dmxBaseCh + NUM_LEDS * 3); // Adjust for total number of LEDs * 3

  setupNeopixel();
  pinMode(RedPin,   OUTPUT);
}

void loop() {
  if (DMXSerial.receive()) {
    for (int i = 0; i < NUM_LEDS; i++) {
      uwLevel = pgm_read_byte(&uwgamma8[DMXSerial.read(dmxBaseCh + i * 3)]);
      wwLevel = pgm_read_byte(&wwgamma8[DMXSerial.read(dmxBaseCh + i * 3)]);
      cwLevel = pgm_read_byte(&cwgamma8[DMXSerial.read(dmxBaseCh + i * 3 + 1)]);
      
      ledRgbData[i * 3] = uwLevel;
      ledRgbData[i * 3 + 2] = wwLevel;
      ledRgbData[i * 3 + 1] = cwLevel;
    }

    updateNeopixel(ledRgbData, NUM_LEDS);
  }
}

But you are now using 2 channels per LED.

The steps you create are the steps there are, are your lookup tables really 256 bytes each ?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.