+arduino NANO+WS2812B GRB (hyperion NG)

  • Hi all!
    Please show my mistakes.
    I connect ardruino nano to RPi 3. There is no any reaction from LED strip. It is worked with hypercon. May be mistake in hyperion NG configuration or ardruino programm.


    adalight
    General Settings
    Hardware LED count 194
    RGB byte order


    Specific Settings
    Output path auto
    Baudrate 500000
    Delay after connect 0 ms


    LightBerry APA102 Mode
    Latch time 0 ms
    Refresh time 0 ms



    #include "FastLED.h"


    // How many leds in your strip?
    #define NUM_LEDS 194


    // For led chips like Neopixels, which have a data line, ground, and power, you just
    // need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
    // ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
    #define DATA_PIN 13
    //#define CLOCK_PIN 13


    #define COLOR_ORDER GRB


    // Adalight sends a "Magic Word" (defined in /etc/boblight.conf) before sending the pixel data
    uint8_t prefix[] = {'A', 'd', 'a'}, hi, lo, chk, i;


    // Baudrate, higher rate allows faster refresh rate and more LEDs (defined in /etc/boblight.conf)
    #define serialRate 500000


    // Define the array of leds
    CRGB leds[NUM_LEDS];


    void setup() {
    // Uncomment/edit one of the following lines for your leds arrangement.
    // FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
    // FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
    // FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
    // FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
    // FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
    FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
    // FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
    // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
    // FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS);
    // FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS);
    // FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS);


    // FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
    // FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
    // FastLED.addLeds<LPD8806, RGB>(leds, NUM_LEDS);


    // FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
    // FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
    // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);


    // initial RGB flash
    LEDS.showColor(CRGB(255, 0, 0));
    delay(500);
    LEDS.showColor(CRGB(0, 255, 0));
    delay(500);
    LEDS.showColor(CRGB(0, 0, 255));
    delay(500);
    LEDS.showColor(CRGB(0, 0, 0));


    Serial.begin(serialRate);
    Serial.print("Ada\n"); // Send "Magic Word" string to host


    }


    void loop() {
    // wait for first byte of Magic Word
    for(i = 0; i < sizeof prefix; ++i) {
    waitLoop: while (!Serial.available()) ;;
    // Check next byte in Magic Word
    if(prefix == Serial.read()) continue;
    // otherwise, start over
    i = 0;
    goto waitLoop;
    }
    // Hi, Lo, Checksum
    while (!Serial.available()) ;;
    hi=Serial.read();
    while (!Serial.available()) ;;
    lo=Serial.read();
    while (!Serial.available()) ;;
    chk=Serial.read();
    // if checksum does not match go back to wait
    if (chk != (hi ^ lo ^ 0x55))
    {
    i=0;
    goto waitLoop;
    }
    memset(leds, 0, NUM_LEDS * sizeof(struct CRGB));
    // read the transmission data and set LED values
    for (uint8_t i = 0; i < NUM_LEDS; i++) {
    byte r, g, b;
    while(!Serial.available());
    r = Serial.read();
    while(!Serial.available());
    g = Serial.read();
    while(!Serial.available());
    b = Serial.read();
    leds.r = r;
    leds.g = g;
    leds.b = b;
    }
    // shows new values
    FastLED.show();
    }

  • I had tried your sketch. It didnt work.
    This is debug log.
    2021-03-03T18:47:22.436Z [hyperiond DAEMON] (INFO) CEC handler created
    2021-03-03T18:47:22.457Z [hyperiond EFFECTFILES] (INFO) 39 effects loaded from directory :/effects/
    2021-03-03T18:47:22.463Z [hyperiond EFFECTFILES] (INFO) 22 effect schemas loaded from directory :/effects/schema/
    2021-03-03T18:47:22.464Z [hyperiond EFFECTFILES] (INFO) 0 effects loaded from directory /storage/hyperion/custom-effects
    2021-03-03T18:47:22.525Z [hyperiond SETTINGSMGR] (DEBUG) (SettingsManager.cpp:109:SettingsManager()) Settings database initialized
    2021-03-03T18:47:22.530Z [hyperiond BLACKBORDER] (DEBUG) (BlackBorderProcessor.cpp:64:handleSettingsUpdate()) Set mode to: default
    2021-03-03T18:47:22.531Z [hyperiond COMPONENTREG] (DEBUG) (ComponentRegister.cpp:36:setNewComponentState()) Blackborder detector: enabled
    2021-03-03T18:47:22.577Z [hyperiond DAEMON] (INFO) set screen capture device to 'dispmanx'
    2021-03-03T18:47:22.577Z [hyperiond DISPMANXGRABBER] (DEBUG) (Grabber.cpp:30:setVideoMode()) Set videomode to 0
    2021-03-03T18:47:22.579Z [hyperiond DISPMANXGRABBER] (INFO) Display opened with resolution: 1920x1080
    2021-03-03T18:47:22.579Z [hyperiond DISPMANXGRABBER] (DEBUG) (Grabber.cpp:90:setWidthHeight()) Set new width: 80, height: 45 for capture
    2021-03-03T18:47:22.580Z [hyperiond DAEMON] (INFO) DISPMANX frame grabber created
    2021-03-03T18:47:22.581Z [hyperiond V4L2:AUTO] (DEBUG) (Grabber.cpp:30:setVideoMode()) Set videomode to 0
    2021-03-03T18:47:22.581Z [hyperiond V4L2:AUTO] (INFO) Signal threshold set to: {12, 12, 12}
    2021-03-03T18:47:22.581Z [hyperiond V4L2:AUTO] (INFO) CEC detection is now disabled
    2021-03-03T18:47:22.581Z [hyperiond V4L2:AUTO] (INFO) Signal detection is now disabled
    2021-03-03T18:47:22.581Z [hyperiond V4L2:AUTO] (INFO) Signal detection area set to: 0.250000,0.250000 x 0.750000,0.750000
    2021-03-03T18:47:22.581Z [hyperiond DAEMON] (DEBUG) (hyperiond.cpp:630:handleSettingsUpdate()) V4L2 grabber created
    2021-03-03T18:47:22.602Z [hyperiond JSONSERVER] (DEBUG) (JsonServer.cpp:28:JsonServer()) Created instance
    2021-03-03T18:47:22.622Z [hyperiond JSONSERVER] (INFO) Started on port 19444
    2021-03-03T18:47:22.593Z [hyperiond LEDDEVICE] (INFO) Start LedDevice 'adalight'.
    2021-03-03T18:47:22.593Z [hyperiond LEDDEVICE] (DEBUG) (LedDevice.cpp:148:init()) deviceConfig: [{"colorOrder":"grb","currentLedCount":194,"delayAfterConnect":0,"hardwareLedCount":194,"latchTime":30,"lightberry_apa102_mode":false,"output":"auto","rate":115200,"rewriteTime":1000,"type":"adalight"}]
    2021-03-03T18:47:22.593Z [hyperiond COMPONENTREG] (DEBUG) (ComponentRegister.cpp:36:setNewComponentState()) Smoothing: enabled
    2021-03-03T18:47:22.594Z [hyperiond LEDDEVICE] (DEBUG) (LedDevice.cpp:407:setLatchTime()) LatchTime updated to 30ms
    2021-03-03T18:47:22.594Z [hyperiond LEDDEVICE] (DEBUG) (LedDevice.cpp:428:setRewriteTime()) Refresh interval = 1000ms
    2021-03-03T18:47:22.594Z [hyperiond SMOOTHING] (DEBUG) (LinearColorSmoothing.cpp:701:selectConfig()) cfg [0]: Type: linear - Time: 200 ms, outputRate 25.000000 Hz, interpolationRate: 25.000000 Hz, timer: 40 ms, Dithering: 0, Decay: 1.000000 -> HalfTime: 100.000000 ms
    2021-03-03T18:47:22.594Z [hyperiond LEDDEVICE] (DEBUG) (LedDevice.cpp:434:setRewriteTime()) RewriteTime updated to 1000ms
    2021-03-03T18:47:22.594Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:36:init()) DeviceType : adalight
    2021-03-03T18:47:22.594Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:37:init()) LedCount : 194
    2021-03-03T18:47:22.594Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:38:init()) ColorOrder : grb
    2021-03-03T18:47:22.594Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:39:init()) RefreshTime : 1000
    2021-03-03T18:47:22.594Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:40:init()) LatchTime : 30
    2021-03-03T18:47:22.595Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:52:init()) deviceName : auto
    2021-03-03T18:47:22.595Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:53:init()) AutoDevice : 1
    2021-03-03T18:47:22.595Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:54:init()) baudRate_Hz : 115200
    2021-03-03T18:47:22.595Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:55:init()) delayAfCon ms: 0
    2021-03-03T18:47:22.595Z [hyperiond LEDDEVICE] (DEBUG) (LedDeviceAdalight.cpp:59:init()) Adalight header for 194 leds: Ada 0x00 0xc1 0x94
    2021-03-03T18:47:22.602Z [hyperiond SMOOTHING] (DEBUG) (LinearColorSmoothing.cpp:701:selectConfig()) Previous line repeats 1 times
    2021-03-03T18:47:22.603Z [hyperiond FLATBUFCONN] (INFO) Connecting to Hyperion: 127.0.0.1:19401
    2021-03-03T18:47:22.622Z [hyperiond EFFECTENGINE] (INFO) Run effect "Rainbow swirl fast" on channel 0
    2021-03-03T18:47:22.634Z [hyperiond FLATBUFSERVER] (INFO) Started on port 19400
    2021-03-03T18:47:22.635Z [hyperiond PROTOSERVER] (INFO) Started on port 19445
    2021-03-03T18:47:22.636Z [hyperiond WEBSERVER] (DEBUG) (WebServer.cpp:33:initServer()) Initialize Webserver
    2021-03-03T18:47:22.638Z [hyperiond WEBSERVER] (DEBUG) (WebServer.cpp:33:initServer()) Initialize Webserver
    2021-03-03T18:47:22.659Z [hyperiond LEDDEVICE] (INFO) found serial device: ttyAMA0
    2021-03-03T18:47:22.659Z [hyperiond LEDDEVICE] (INFO) Opening UART: ttyAMA0
    2021-03-03T18:47:22.659Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:141:tryOpen()) _rs232Port.open(QIODevice::ReadWrite): ttyAMA0, Baud rate [115200]bps
    2021-03-03T18:47:22.708Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:146:tryOpen()) portName: ttyAMA0
    2021-03-03T18:47:22.708Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:147:tryOpen()) systemLocation: /dev/ttyAMA0
    2021-03-03T18:47:22.709Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:148:tryOpen()) description:
    2021-03-03T18:47:22.709Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:149:tryOpen()) manufacturer:
    2021-03-03T18:47:22.709Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:150:tryOpen()) productIdentifier: 0x0
    2021-03-03T18:47:22.709Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:151:tryOpen()) vendorIdentifier: 0x0
    2021-03-03T18:47:22.709Z [hyperiond LEDDEVICE] (DEBUG) (ProviderRs232.cpp:152:tryOpen()) serialNumber:
    2021-03-03T18:47:22.838Z [hyperiond EFFECTENGINE] (DEBUG) (EffectEngine.cpp:183:runEffectScript()) Start the effect: name [Rainbow swirl fast], smoothCfg [2]
    2021-03-03T18:47:22.839Z [hyperiond HYPERION] (DEBUG) (PriorityMuxer.cpp:161:registerInput()) Register new input 'System/EFFECT' with priority 0 as inactive
    2021-03-03T18:47:22.839Z [hyperiond HYPERION] (INFO) Initial foreground effect 'Rainbow swirl fast' started
    2021-03-03T18:47:22.840Z [hyperiond HYPERION] (DEBUG) (PriorityMuxer.cpp:161:registerInput()) Register new input 'System/GRABBER' with priority 250 as inactive
    2021-03-03T18:47:22.841Z [hyperiond COMPONENTREG] (DEBUG) (ComponentRegister.cpp:36:setNewComponentState()) Framegrabber: enabled
    2021-03-03T18:47:22.841Z [hyperiond Dispmanx] (DEBUG) (GrabberWrapper.cpp:48:start()) Grabber start()
    2021-03-03T18:47:22.841Z [hyperiond BOBLIGHT] (DEBUG) (BoblightServer.cpp:28:BoblightServer()) Instance created
    2021-03-03T18:47:22.844Z [hyperiond HYPERION] (INFO) Hyperion instance 'First LED Hardware instance' has been started
    2021-03-03T18:47:22.842Z [hyperiond COMPONENTREG] (DEBUG) (ComponentRegister.cpp:36:setNewComponentState()) LED device: enabled
    2021-03-03T18:47:22.938Z [hyperiond HYPERION] (DEBUG) (PriorityMuxer.cpp:251:setInputImage()) Priority 250 is now active
    2021-03-03T18:47:22.939Z [hyperiond HYPERION] (DEBUG) (PriorityMuxer.cpp:351:setCurrentTime()) Set visible priority to 0
    2021-03-03T18:47:22.940Z [hyperiond SMOOTHING] (DEBUG) (LinearColorSmoothing.cpp:701:selectConfig()) cfg [2]: Type: linear - Time: 200 ms, outputRate 25.000000 Hz, interpolationRate: 25.000000 Hz, timer: 40 ms, Dithering: 0, Decay: 1.000000 -> HalfTime: 100.000000 ms
    2021-03-03T18:47:22.941Z [hyperiond HYPERION] (DEBUG) (Hyperion.cpp:559:handlePriorityChangedLedDevice()) priority[0], previousPriority[255]
    2021-03-03T18:47:22.941Z [hyperiond HYPERION] (DEBUG) (Hyperion.cpp:569:handlePriorityChangedLedDevice()) new source available -> switch LED-Device on
    2021-03-03T18:47:22.967Z [hyperiond WEBSERVER] (DEBUG) (WebServer.cpp:91:handleSettingsUpdate()) Apply Webserver settings
    2021-03-03T18:47:22.967Z [hyperiond WEBSERVER] (DEBUG) (WebServer.cpp:109:handleSettingsUpdate()) Set document root to: :/webconfig
    2021-03-03T18:47:22.967Z [hyperiond WEBSERVER] (DEBUG) (WebServer.cpp:91:handleSettingsUpdate()) Apply Webserver settings
    2021-03-03T18:47:22.968Z [hyperiond WEBSERVER] (DEBUG) (WebServer.cpp:109:handleSettingsUpdate()) Set document root to: :/webconfig
    2021-03-03T18:47:22.969Z [hyperiond WEBSERVER] (INFO) Started on port 8090 name 'Hyperion Webserver'
    2021-03-03T18:47:23.113Z [hyperiond WEBSERVER] (DEBUG) (WebServer.cpp:175:handleSettingsUpdate()) Setup SSL certificate
    2021-03-03T18:47:23.115Z [hyperiond WEBSERVER] (DEBUG) (WebServer.cpp:191:handleSettingsUpdate()) Setup private SSL key
    2021-03-03T18:47:23.115Z [hyperiond WEBSERVER] (INFO) Started on port 8092 name 'Hyperion Webserver'
    2021-03-03T18:47:23.149Z [hyperiond HYPERION] (DEBUG) (PriorityMuxer.cpp:251:setInputImage()) Priority 0 is now active
    2021-03-03T18:47:25.971Z [hyperiond HYPERION] (DEBUG) (PriorityMuxer.cpp:315:setCurrentTime()) Timeout clear for priority 0
    2021-03-03T18:47:25.971Z [hyperiond HYPERION] (DEBUG) (PriorityMuxer.cpp:351:setCurrentTime()) Set visible priority to 0
    2021-03-03T18:47:25.971Z [hyperiond SMOOTHING] (DEBUG) (LinearColorSmoothing.cpp:701:selectConfig()) cfg [0]: Type: linear - Time: 200 ms, outputRate 25.000000 Hz, interpolationRate: 25.000000 Hz, timer: 40 ms, Dithering: 0, Decay: 1.000000 -> HalfTime: 100.000000 ms
    2021-03-03T18:47:25.972Z [hyperiond HYPERION] (DEBUG) (Hyperion.cpp:559:handlePriorityChangedLedDevice()) priority[0], previousPriority[0]
    2021-03-03T18:47:26.221Z [hyperiond HYPERION] (DEBUG) (PriorityMuxer.cpp:351:setCurrentTime()) Set visible priority to 250
    2021-03-03T18:47:26.222Z [hyperiond HYPERION] (DEBUG) (Hyperion.cpp:559:handlePriorityChangedLedDevice()) priority[250], previousPriority[0]
    2021-03-03T18:47:29.852Z [hyperiond WEBSOCKET] (DEBUG) (WebSocketClient.cpp:30:WebSocketClient()) New connection from ::ffff:192.168.1.140
    2021-03-03T18:47:29.852Z [hyperiond WEBSOCKET] (DEBUG) (JsonAPI.cpp:81:handleInstanceSwitch()) Client '::ffff:192.168.1.140' switch to Hyperion instance 0
    2021-03-03T18:47:30.813Z [hyperiond WEBSOCKET] (DEBUG) (JsonAPI.cpp:1054:handleLoggingCommand()) log streaming activated for client ::ffff:192.168.1.140
    2021-03-03T18:47:30.841Z [hyperiond WEBSOCKET] (DEBUG) (JsonAPI.cpp:1063:handleLoggingCommand()) log streaming deactivated for client ::ffff:192.168.1.140
    2021-03-03T18:48:48.429Z [hyperiond WEBSOCKET] (DEBUG) (WebSocketClient.cpp:204:sendClose()) send close: 1000
    2021-03-03T18:48:48.934Z [hyperiond WEBSOCKET] (DEBUG) (WebSocketClient.cpp:30:WebSocketClient()) New connection from ::ffff:192.168.1.140
    2021-03-03T18:48:48.934Z [hyperiond WEBSOCKET] (DEBUG) (JsonAPI.cpp:81:handleInstanceSwitch()) Client '::ffff:192.168.1.140' switch to Hyperion instance 0
    2021-03-03T18:48:49.773Z [hyperiond WEBSOCKET] (DEBUG) (JsonAPI.cpp:1054:handleLoggingCommand()) log streaming activated for client ::ffff:192.168.1.140

  • Arduino Nano
    data pin is 13
    194 leds
    And this is the sketch i used:


    #include "FastLED.h"
    #define ANALOG_MODE_AVERAGE 0
    #define ANALOG_MODE_LAST_LED 1
    /**************************************
    S E T U P
    set following values to your needs
    **************************************/
    #define INITIAL_LED_TEST_ENABLED true
    #define INITIAL_LED_TEST_BRIGHTNESS 32 // 0..255
    #define INITIAL_LED_TEST_TIME_MS 500 // 10..
    // Number of leds in your strip. set to "1" and ANALOG_OUTPUT_ENABLED to "true" to activate analog only
    // As of 26/1/2017:
    // 582 leaves ZERO bytes free and this
    // 410 is ok
    // tested with 500 leds and is fine (despite the warning)
    #define MAX_LEDS 194
    // type of your led controller, possible values, see below
    #define LED_TYPE WS2812B
    // 3 wire (pwm): NEOPIXEL BTM1829 TM1812 TM1809 TM1804 TM1803 UCS1903 UCS1903B UCS1904 UCS2903 WS2812 WS2852
    // S2812B SK6812 SK6822 APA106 PL9823 WS2811 WS2813 APA104 WS2811_40 GW6205 GW6205_40 LPD1886 LPD1886_8BIT
    // 4 wire (spi): LPD8806 WS2801 WS2803 SM16716 P9813 APA102 SK9822 DOTSTAR
    // For 3 wire led stripes line Neopixel/Ws2812, which have a data line, ground, and power, you just need to define DATA_PIN.
    // For led chipsets that are SPI based (four wires - data, clock, ground, and power), both defines DATA_PIN and CLOCK_PIN are needed
    // DATA_PIN, or DATA_PIN, CLOCK_PIN
    #define LED_PINS 13 // 3 wire leds
    //#define LED_PINS 6, 13 // 4 wire leds
    #define COLOR_ORDER GRB // colororder of the stripe, set RGB in hyperion
    #define OFF_TIMEOUT 15000 // ms to switch off after no data was received, set 0 to deactivate
    // analog rgb uni color led stripe - using of hyperion smoothing is recommended
    // ATTENTION this pin config is default for atmega328 based arduinos, others might work to
    // if you have flickering analog leds this might be caused by unsynced pwm signals
    // try other pins is more or less the only thing that helps
    #define ANALOG_OUTPUT_ENABLED false
    #define ANALOG_MODE ANALOG_MODE_LAST_LED // use ANALOG_MODE_AVERAGE or ANALOG_MODE_LAST_LED
    #define ANALOG_GROUND_PIN 8 // additional ground pin to make wiring a bit easier
    #define ANALOG_RED_PIN 9
    #define ANALOG_GREEN_PIN 10
    #define ANALOG_BLUE_PIN 11
    // overall color adjustments
    #define ANALOG_BRIGHTNESS_RED 255 // maximum brightness for analog 0-255
    #define ANALOG_BRIGHTNESS_GREEN 255 // maximum brightness for analog 0-255
    #define ANALOG_BRIGHTNESS_BLUE 255 // maximum brightness for analog 0-255
    #define BRIGHTNESS 255 // maximum brightness 0-255
    #define DITHER_MODE BINARY_DITHER // BINARY_DITHER or DISABLE_DITHER
    #define COLOR_TEMPERATURE CRGB(255,255,255) // RGB value describing the color temperature
    #define COLOR_CORRECTION TypicalLEDStrip // predefined fastled color correction
    //#define COLOR_CORRECTION CRGB(255,255,255) // or RGB value describing the color correction
    // Baudrate, higher rate allows faster refresh rate and more LEDs
    //#define serialRate 460800 // use 115200 for ftdi based boards
    #define serialRate 115200 // use 115200 for ftdi based boards
    //#define serialRate 500000 // use 115200 for ftdi based boards
    /**************************************
    A D A L I G H T C O D E
    no user changes needed
    **************************************/
    // Adalight sends a "Magic Word" (defined in /etc/boblight.conf) before sending the pixel data
    uint8_t prefix[] = {'A', 'd', 'a'}, hi, lo, chk, i;
    unsigned long endTime;
    // Define the array of leds
    CRGB leds[MAX_LEDS];
    // set rgb to analog led stripe
    void showAnalogRGB(const CRGB& led) {
    if (ANALOG_OUTPUT_ENABLED) {
    byte r = map(led.r, 0,255,0,ANALOG_BRIGHTNESS_RED);
    byte g = map(led.g, 0,255,0,ANALOG_BRIGHTNESS_GREEN);
    byte b = map(led.b, 0,255,0,ANALOG_BRIGHTNESS_BLUE);
    analogWrite(ANALOG_RED_PIN , r);
    analogWrite(ANALOG_GREEN_PIN, g);
    analogWrite(ANALOG_BLUE_PIN , b);
    }
    }
    // set color to all leds
    void showColor(const CRGB& led) {
    #if MAX_LEDS > 1 || ANALOG_OUTPUT_ENABLED == false
    LEDS.showColor(led);
    #endif
    showAnalogRGB(led);
    }
    // switch of digital and analog leds
    void switchOff() {
    #if MAX_LEDS > 1 || ANALOG_OUTPUT_ENABLED == false
    memset(leds, 0, MAX_LEDS * sizeof(struct CRGB));
    FastLED.show();
    #endif
    showAnalogRGB(leds[0]);
    }
    // function to check if serial data is available
    // if timeout occured leds switch of, if configured
    bool checkIncommingData() {
    boolean dataAvailable = true;
    while (!Serial.available()) {
    if ( OFF_TIMEOUT > 0 && endTime < millis()) {
    switchOff();
    dataAvailable = false;
    endTime = millis() + OFF_TIMEOUT;
    }
    }
    return dataAvailable;
    }
    // main function that setups and runs the code
    void setup() {
    Serial.begin(serialRate);
    // analog output
    if (ANALOG_OUTPUT_ENABLED) {
    // additional ground pin to make wiring a bit easier
    pinMode(ANALOG_GROUND_PIN, OUTPUT);
    digitalWrite(ANALOG_GROUND_PIN, LOW);
    pinMode(ANALOG_BLUE_PIN , OUTPUT);
    pinMode(ANALOG_RED_PIN , OUTPUT);
    pinMode(ANALOG_GREEN_PIN, OUTPUT);
    }
    int ledCount = MAX_LEDS;
    if (ANALOG_OUTPUT_ENABLED == true && ANALOG_MODE == ANALOG_MODE_LAST_LED) {
    ledCount--;
    }
    #if MAX_LEDS > 1 || ANALOG_OUTPUT_ENABLED == false
    FastLED.addLeds<LED_TYPE, LED_PINS, COLOR_ORDER>(leds, ledCount);
    #endif
    // color adjustments
    FastLED.setBrightness ( BRIGHTNESS );
    FastLED.setTemperature( COLOR_TEMPERATURE );
    FastLED.setCorrection ( COLOR_CORRECTION );
    FastLED.setDither ( DITHER_MODE );
    // initial RGB flash
    #if INITIAL_LED_TEST_ENABLED == true
    for (int v=0;v<INITIAL_LED_TEST_BRIGHTNESS;v++)
    {
    showColor(CRGB(v,v,v));
    delay(INITIAL_LED_TEST_TIME_MS/2/INITIAL_LED_TEST_BRIGHTNESS);
    }
    for (int v=0;v<INITIAL_LED_TEST_BRIGHTNESS;v++)
    {
    showColor(CRGB(v,v,v));
    delay(INITIAL_LED_TEST_TIME_MS/2/INITIAL_LED_TEST_BRIGHTNESS);
    }
    #endif
    showColor(CRGB(0, 0, 0));
    Serial.print("Ada\n"); // Send "Magic Word" string to host
    Serial.println("Ada: LED num: " + String(FastLED.size())); //Return number of LEDs configured
    boolean transmissionSuccess;
    unsigned long sum_r, sum_g, sum_b;
    // loop() is avoided as even that small bit of function overhead
    // has a measurable impact on this code's overall throughput.
    for(;;) {
    // wait for first byte of Magic Word
    for (i = 0; i < sizeof prefix; ++i) {
    // If next byte is not in Magic Word, the start over
    if (!checkIncommingData() || prefix != Serial.read()) {
    i = 0;
    }
    }
    // Hi, Lo, Checksum
    if (!checkIncommingData()) continue;
    hi = Serial.read();
    if (!checkIncommingData()) continue;
    lo = Serial.read();
    if (!checkIncommingData()) continue;
    chk = Serial.read();
    // if checksum does not match go back to wait
    if (chk != (hi ^ lo ^ 0x55)) continue;
    memset(leds, 0, MAX_LEDS * sizeof(struct CRGB));
    transmissionSuccess = true;
    sum_r = 0;
    sum_g = 0;
    sum_b = 0;
    int num_leds = min ( MAX_LEDS, (hi<<8) + lo + 1 );
    // read the transmission data and set LED values
    for (int idx = 0; idx < num_leds; idx++) {
    byte r, g, b;
    if (!checkIncommingData()) {
    transmissionSuccess = false;
    break;
    }
    r = Serial.read();
    if (!checkIncommingData()) {
    transmissionSuccess = false;
    break;
    }
    g = Serial.read();
    if (!checkIncommingData()) {
    transmissionSuccess = false;
    break;
    }
    b = Serial.read();
    leds[idx].r = r;
    leds[idx].g = g;
    leds[idx].b = b;
    #if ANALOG_OUTPUT_ENABLED == true && ANALOG_MODE == ANALOG_MODE_AVERAGE
    sum_r += r;
    sum_g += g;
    sum_b += b;
    #endif
    }
    // shows new values
    if (transmissionSuccess) {
    endTime = millis() + OFF_TIMEOUT;
    #if MAX_LEDS > 1 || ANALOG_OUTPUT_ENABLED == false
    FastLED.show();
    #endif
    #if ANALOG_OUTPUT_ENABLED == true
    #if ANALOG_MODE == ANALOG_MODE_LAST_LED
    showAnalogRGB(leds[MAX_LEDS-1]);
    #else
    showAnalogRGB(CRGB(sum_r/MAX_LEDS, sum_g/MAX_LEDS, sum_b/MAX_LEDS));
    #endif
    #endif
    }
    }
    } // end of setup
    void loop() {
    // Not used. See note in setup() function.
    }

  • I have found the answer in this video

    Externer Inhalt www.youtube.com
    Inhalte von externen Seiten werden ohne Ihre Zustimmung nicht automatisch geladen und angezeigt.
    Durch die Aktivierung der externen Inhalte erklären Sie sich damit einverstanden, dass personenbezogene Daten an Drittplattformen übermittelt werden. Mehr Informationen dazu haben wir in unserer Datenschutzerklärung zur Verfügung gestellt.

    LED Controller- Output path = auto must changed on /dev/ttyUSB0 (0- number of your USB port)

  • This sketch works too


  • Did you find a Solution.

    Trying to Switch from my RPI4 with Hyperion (APA102 LED's) to an X86 HTPC with Arudino for Hyperion and having trouble getting started.


    Fastlight Sketch was loaded properly and LED's start to glow as soon as they are connected, but can't control them with Hyperion.


    Seems also that i'm missing Configuration Parameters in Hyperion when i compare it to other Screenshots i've seen from here and Tutorial Videos.


    Any Tipps where to STart looking?


    • Offizieller Beitrag

    you sure it is /dev/ttyUSB?


    to check the name is the easiest way: unplug the device write "ls /dev" in terminal, then plug it in and write again "ls /dev" then compare the outputs and look which new device name is listed

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!