1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

RPi + OSMC More than 255 leds?

Discussion in 'Hardware Support' started by themorb, 17 November 2016.

  1. Mackwhyte

    Mackwhyte New Member

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi3, +Arduino
    yeah, i'm at a complete loss, there doesn't seem to be any reason for it at all. I'll post if i find a solution, hopefully sooner rather than later (or never!)
     
  2. Mackwhyte

    Mackwhyte New Member

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi3, +Arduino
    Going to try a fresh install of each OS and Hyperion to see if anything changes, is there any way to emulate the bitstream into the Arduino to see if it is the Pi that isn't doing it's job? I've also tried communication through UART but someone might know a better way (I hope). I also have a Teensy 2.0 and 3.1 at my disposal but wasn't sure how to implement them. Looked at getting an Octows2811 and splitting the 392 into 4 strings of 98 but am not 100% sure how to go bout this, the hardware side is fine its the software side that i need to improve upon. I know there is a modified Ambibox capable of running 400 Leds but since seeing it I can no longer find it!
     
  3. Mackwhyte

    Mackwhyte New Member

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi3, +Arduino
    Just remembered! I read a while ago that Penfold42 made a custom ws2801 to 2812 protocol converter, if he wouldn't mind sharing details i would easily give building one a go if it meant i could get this working. I worked as an Electronics Engineer for 5 years so the assembling part of the circuit wouldn't be an issue, it's usually the software side i'd need help with. I've only just broken into this side and I'm pretty much self taught so I know that I might not have the right info, it would be nice to be kept right.
     
  4. Mackwhyte

    Mackwhyte New Member

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi3, +Arduino
    OK. one as i said above and started with a fresh install and done some testing, heres what i found;

    OSMC and Arduino sketch using Pin 51 (MOSI) (config file edited to match Baud rates etc.)
    Baud Rate=from 115200 to 460800 tried - Rx Light=ON - Arduino Intro plays=Yes (but only on fresh startup) - Lights respond=No

    OSMC with Arduino Ambilight sketch inc Prefix
    Baud rate-115200 - Rx Light on - Arduino Intro plays=Yes (but only on fresh startup) - Lights Respond No
    Initially tested with PWM pin 6, then 10

    I then tried each PWM pin on the Mega and FINALLY got the lights working on Pin 2.
    If Hyperion is stopped and restarted via SSH the lights will no longer respond until the Pi is rebooted

    After getting the Arduino talking at 115200 I increased the Baud rate to 460800 as the lights were lagging by around a second and a half
    At 460800 the lights were still lagging by just under a second.

    I tried increasing further but looks like hypercon only allows 1000000. This is not bad but there is still a 250-500ms delay.

    So any advice on eliminating the delay? I know the original Pi could handle a speed up to 4000000, although only up til 1500000 stably.
    I also know you can get 2000000 out of a Mega if you edit the UARTnA register
    But would this be the right way to go? Is there another approach I could take to get the lights a bit more synced up?

    Also would you think it would run any better on a different OS? now that I have the Arduino working I couldn't see the OS causing a problem now?
     
  5. Akriss

    Akriss Active Member

    Messages:
    377
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    Awesome!

    reducing the "time" in smoothing may help. Or change the update frequency a little.
     
  6. Mackwhyte

    Mackwhyte New Member

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi3, +Arduino
    Okay. New update, the ambilight has stopped working entirely! checked the WS2812 Strip and it works fine so the problem is not the LED's. I think OSMC has just stopped working with hyperion. Opened hypercon and in the SSH Traffic window keep getting the following message. "Unit hyperion.service entered failed state." Uninstalled and reinstalled hyperion but no luck. Initially i thought it was the sketch so stupidly i reuploaded it onto the arduino but forgot that my HDD had failed a few months ago, so i''m not 100% sure im using the same sketch I was originally. I made sure that the baud rates were matched at 1,000,000 in both the sketch and config file as i remember that being the last baud rate i tried successfully. However, i can't remember if i had an issue with the prefix, i think i got 0x41, 0x64, 0x61, 0x01, 0x87, 0xd3 for 392 leds but vaguely remember there being an issue involving this. When the arduino is on neither the Rx or Tx light at any time, i remember the Rx light flashing when the ambilight was operational, but i think this may be due to the fact hyperion doesn't seem to be working at all. I also can't currently find my MicroSD card adaptor to try a different Os so im currently stuck, I can't understand how OSMC would suddenly stop working with Hyperion as i have not updated or anything. It just doesn''t even attempt to work. any recommendstions of a working os and arduino sketch combo that works with more than 255 leds?
     
  7. Akriss

    Akriss Active Member

    Messages:
    377
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    SD card corruption would be my guess/bet. That's if OSMC didn't auto update. I have a OSMC w/160-/+ WS2812 + arduino nano that's not been updated since it was made. I remember having some problems updating OSMC and just elected to keep that system as is and working. ( It's a TV in the garage that rarely used and Hyperion lights up the garage for other stuff :) )

    You have done it before. Chance's are you can do it again. =)
     
  8. Mackwhyte

    Mackwhyte New Member

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi3, +Arduino
    Well i figured out my issue (well one at least), it appears the USB ports on the Pi have failed, but not in the traditional way! I discovered only 1 of the 4 ports appears to have communication, I had my keyboard/mouse plugged in, the grabber and the arduino and one spare for USB pens/HDD's etc, but when I disconnected everything I noticed one of the plastic tabs that locates the USB had broken. So I ordered some replacement USB Ports and soldered them in this morning. Got the Multimeter and measured each of the test points
    PP1: 5.1V
    PP2: 5.1V
    PP7: 5.1V
    PP8: 3.3V
    PP9: 1.8V
    PP10: 1.8V
    PP27: 5.1V

    PP27 is the USB 5v and all appears to be working, there appears to be a lot of mention of C97 but it appears perfectly fine , i also can't see this being an issue as the ports are all getting power. I confirmed this by plugging in the Arduino, it powers up in all ports but L only blinks in one specific port, I then tried the same with the Keyboard/Mouse and sure enough I get illumination in all ports but only get full functionality in one. Any idea how to proceed? I can only seem to find info that relates to power failure of the ports and not comms issues.

    Oh, the issue with OSMC, my first setup used OSMC pre 2015 and had no issues, I then updated to i think it was August 2017 and also never had issues even though I had read a lot about the incompatibility with Hyperion and OSMC with OS newer than 2015 so it might just be it finally caught up to me, what made it strange was that I had turned off auto update so nothing should have really changed between the two, the SD card checked out fine and I tried another OS with the same issue previous to finding the USB issue so I will have to investigate that if i get the USB working properly again.
     
  9. Mackwhyte

    Mackwhyte New Member

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi3, +Arduino
    Got bored so made something i think might help out some others, a prefix calculator for excel (https://github.com/mackwhyte/Ws2812-prefix-calculator-/tree/master)
    Still need to get a replacement Pi but until then at least this might help people with prefix issues above 255 leds, because i haven't currently got a working setup i can't confirm if you have to +/-1 from the entered number of leds but gets you in the right ballpark.
     
  10. TPmodding

    TPmodding Administrator Staff Member Administrator

    Messages:
    942
    Hardware:
    RPi1/Zero, RPi2, RPi3, +Arduino, +nodeMCU/ESP8266
  11. Mackwhyte

    Mackwhyte New Member

    Messages:
    16
    Hardware:
    RPi1/Zero, RPi3, +Arduino
    I'll have to try these codes when i get my replacement parts, only put the calculator there as i'd had no luck with several different sketches but thanks for the heads up!
    i'll tell you how it goes when i get it set up again
     
    • Like Like x 1
  12. DiceBanga

    DiceBanga New Member

    Messages:
    14
    Hardware:
    RPi3, 32/64bit, +Arduino
    I keep getting an error when I upload this sketch to my nano

    'CRGB' does not name a type

    What am I missing?
     
  13. TPmodding

    TPmodding Administrator Staff Member Administrator

    Messages:
    942
    Hardware:
    RPi1/Zero, RPi2, RPi3, +Arduino, +nodeMCU/ESP8266
    can you show ur config
     
  14. DiceBanga

    DiceBanga New Member

    Messages:
    14
    Hardware:
    RPi3, 32/64bit, +Arduino
    #include "FastLED.h"
    // How many leds in your strip?
    #define NUM_LEDS 276
    // 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 10
    //#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, RGB>(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();
    }
     
  15. DiceBanga

    DiceBanga New Member

    Messages:
    14
    Hardware:
    RPi3, 32/64bit, +Arduino
    I've since uploaded this config file and I'm not getting that error anymore, but my LEDs still are not responding to anything besides the startup test.

    So whenever I start Hyperion, it blink green, red, and blue, but nothing else. It does not respond to the app at all and I don't know how to check the USB grabber.

    It says that it's connected to the server. The log registers the command, but nothing happens.
     
  16. TPmodding

    TPmodding Administrator Staff Member Administrator

    Messages:
    942
    Hardware:
    RPi1/Zero, RPi2, RPi3, +Arduino, +nodeMCU/ESP8266
    #define serialRate 500000

    did you changed the baudrate in your hyperion config?
     
  17. DiceBanga

    DiceBanga New Member

    Messages:
    14
    Hardware:
    RPi3, 32/64bit, +Arduino
    YES. I will double check though.
     
  18. DiceBanga

    DiceBanga New Member

    Messages:
    14
    Hardware:
    RPi3, 32/64bit, +Arduino
    How do you load hypercon.dat, I've been hitting load but it isn't changing anything.

    In anycase, yes the baudrate does match.
     
    Last edited: 10 December 2018 at 21:50
  19. TPmodding

    TPmodding Administrator Staff Member Administrator

    Messages:
    942
    Hardware:
    RPi1/Zero, RPi2, RPi3, +Arduino, +nodeMCU/ESP8266
    i never user hypercon... only to generate the led-part... i know that hypercon has some bugs...
     
  20. DiceBanga

    DiceBanga New Member

    Messages:
    14
    Hardware:
    RPi3, 32/64bit, +Arduino
    are there any configs that I can load directly to the Pi that may help? My config is below.

    Via Hypercon: