cannot address more than 255 leds

  • Hi folks,
    I am new to the forum and using Hyperion and ran into a problem.
    The following is my problem, I made a 100"projector screen with 408 LEDs W2812b ..Arduino connected to RPI3 with HYPERION software. All 408 LEDs function if I upload a sketch to the Arduino no matter what I use color effects, etc. its all working properly.
    Only i cannot use hyperion whit more than 255 leds on .
    Even ambilight works but only 255 leds .
    I have to chance the sketch for arduino to 255 addressable leds en then it will work .
    i dont think its a problem with the ledstrips because its working with the arduino software just not in combination Hyperion ..


    So any help would be welcome ..
    Grtz Frank


    Arduino R3 Uno
    RPI 3 OSMC
    W2812B ledsstrip 60 leds p/m +- 6 meters


    Ambilight***.txt change txt to .rar !

  • ssh in: Jan 24 10:13:35 osmcAllie systemd[1]: Stopped Hyperion Systemd service.
    ssh in: Jan 24 10:14:01 osmcAllie systemd[1]: Starting Hyperion Systemd service...
    ssh in: Jan 24 10:14:01 osmcAllie systemd[1]: Started Hyperion Systemd service.
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: Hyperion Ambilight Deamon (1634)
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: Version : V1.03.2 (brindosch-99d9396/d3713a8-1469452981
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: Build Time: Jul 25 2016 06:54:40
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: INFO: Selected configuration file: /etc/hyperion/hyperion.config.json
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: HYPERION INFO: ColorTransform 'default' => [0; 406]
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: HYPERION INFO: ColorCorrection 'default' => [0; 406]
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: HYPERION INFO: ColorAdjustment 'default' => [0; 406]
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: LEDDEVICE INFO: configuration:
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: {
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: "colorOrder" : "rgb",
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: "delayAfterConnect" : 0,
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: "name" : "Hyperion_leds408_working",
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: "output" : "/dev/ttyACM0",
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: "rate" : 500000,
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: "type" : "adalight"
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: }
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: Opening UART: /dev/ttyACM0
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: INFO: Creating linear smoothing
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: HYPERION (CS) INFO: Created linear-smoothing(interval_ms=50;settlingTime_ms=500;updateDelay=1
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: EFFECTENGINE INFO: 27 effects loaded from directory /usr/share/hyperion/effects
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: EFFECTENGINE INFO: Initializing Python interpreter
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: INFO: Hyperion started and initialised
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: INFO: Kodi checker created and started
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: INFO: Json server created and started on port 19444
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: INFO: Proto server created and started on port 19445
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: DISPMANXGRABBER INFO: Display opened with resolution: 1920x1080
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: BLACKBORDER INFO: threshold set to 0.1 (26)
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: BLACKBORDER INFO: mode:classic
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: INFO: Frame grabber created and started
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: KODICHECK INFO: Kodi Connected
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: KODICHECK INFO: switching to MENU mode
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: BORDER SWITCH REQUIRED!!
    ssh in: Jan 24 10:14:01 osmcAllie hyperiond[1634]: CURRENT BORDER TYPE: unknown=0 hor.size=3 vert.size=3
    ssh in: Jan 24 10:14:21 osmcAllie hyperiond[1634]: BORDER SWITCH REQUIRED!!
    ssh in: Jan 24 10:14:21 osmcAllie hyperiond[1634]: CURRENT BORDER TYPE: unknown=0 hor.size=4 vert.size=4
    ssh in: Jan 24 10:14:28 osmcAllie hyperiond[1634]: BORDER SWITCH REQUIRED!!
    ssh in: Jan 24 10:14:28 osmcAllie hyperiond[1634]: CURRENT BORDER TYPE: unknown=0 hor.size=3 vert.size=3
    ssh in: Jan 24 10:14:53 osmcAllie hyperiond[1634]: BORDER SWITCH REQUIRED!!
    ssh in: Jan 24 10:14:53 osmcAllie hyperiond[1634]: CURRENT BORDER TYPE: unknown=0 hor.size=5 vert.size=4

  • @penfold42 thanks for your reply ..


    So i have bin testing with your sketch and mine (ambilight**2)
    With your sketch i can set 408 leds and when the arduino is finished uploading all lights are up , hyperion starts , ambilight works but only 207 Leds light up.
    When i use my sketch and set 408 leds after finishing upload to arduino all lights are up ,hyperion starts , no working ambilight ..
    Its getting better ...


    With your sketch i can set 255 leds and when the arduino is finished uploading all 255 lights are up , hyperion starts , ambilight works but only 207 Leds light up.
    When i use my sketch and set 255 leds after finishing upload to arduino all 255 lights are up ,hyperion starts , ambilight works but only 255 Leds light up thats because i set to 255.. when i go any higher hyperion stops working ...


    So.....


    I also replaced a meter leds after led 205 ..but problem stays exactly the same ..

  • Hi penfold42,
    Thanks for the help ..
    I've changed the sketch (uint8_t to int)


    #include "FastLED.h"


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


    // 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 6


    #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() {
    FastLED.addLeds<WS2812B, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);

    // initial RGB flash, comment out if your setup works.
    //LEDS.showColor(CRGB(255, 255, 255));
    //delay(500);
    //LEDS.showColor(CRGB(100, 0, 0));
    //delay(1000);
    //LEDS.showColor(CRGB(255, 255,255));
    //delay(500);
    //LEDS.showColor(CRGB(0, 0, 100));
    //delay(1000);
    LEDS.showColor(CRGB(100, 0, 0));
    delay(1000);
    //LEDS.showColor(CRGB(255, 255,255));
    //delay(500);
    LEDS.showColor(CRGB(0, 0, 100));
    delay(1000);
    LEDS.showColor(CRGB(175,125,55));

    // start listening on serial port
    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 (int 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();
    }

  • Now all leds are working with this sketch and react to hyperion grabber....BUT..
    The leds behavior is off ..
    The leds right and top have the same color as the screen but left and bottom are just copy's of right and top !
    diagonal screen mirror color..
    tested with the hyperion color calibration pictures .
    Why? ******has it something to do with the code ..

  • sketch you provided only lights up 207 lights after the changes .


    #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


    // Number of leds in your strip. set to "1" and ANALOG_OUTPUT_ENABLED to "true" to activate analog only
    #define MAX_LEDS 408


    // 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 6 // 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 500000 // use 115200 for ftdi based boards
    //#define serialRate 115200 // 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);
    }


    // Uncomment/edit one of the following lines for your leds arrangement.
    int ledCount = MAX_LEDS;
    if (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
    Serial.println("initial test");
    showColor(CRGB(INITIAL_LED_TEST_BRIGHTNESS, 0, 0)); delay(400);
    showColor(CRGB(0, INITIAL_LED_TEST_BRIGHTNESS, 0)); delay(400);
    showColor(CRGB(0, 0, INITIAL_LED_TEST_BRIGHTNESS )); delay(400);
    #endif
    showColor(CRGB(100, 100, 100));


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



    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 = (hi<<8) + lo + 1;


    // read the transmission data and set LED values
    for (int idx = 0; idx < min(num_leds,MAX_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.
    }

  • yes it does ..
    (knightrider effect)
    when red light on top goes from right to left ,bottom goes from left to right..exact same timing ..
    left and right side blink red at the same time ..

  • I just dug out my led collection and tested this with your config file and it appears to work fine.


    I tested with :
    a 16x16 matrix (256 led) plus a spool of strip leds.
    A $5 arduuino nano
    The sketch I referred you to with:
    - the uint8 -> int mod
    - changed the max leds to 500
    - baud rate of 500000
    Latest Hyperion source from GitHub


    Have you accidently connected the data line to the other corner too?

Jetzt mitmachen!

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