More than 255 leds?

  • I am using an Arduino Uno to control my LEDs and if I go past 256, they do all turn on for a few seconds when the sketch starts, but I can't turn on a solid colour via Hyperion remote. 256 or fewer works fine.


    The top of the sketch has the following:


    [INDENT]#define LEDCOUNT 256 // Number of LEDs used in your system
    #define SHOWDELAY 20 // Delay in micro seconds before showing
    #define BAUDRATE 1000000 // Serial port speed


    #define BRIGHTNESS 100 // Max. brightness in %


    const char prefix[] = {0x41, 0x64, 0x61, 0x00, 0xff, 0xaa}; // Prefix at the start of the transmission
    char buffer[sizeof(prefix)]; // Temporary buffer for receiving the prefix data
    [/INDENT]
    I think the issue may be because the prefix array final 2 values go to 2 bytes. For example 258 would give 0x101 and 0x154. I am very rusty at coding...


    Can I make this work? With 60/m strips it works out to 266 LEDs in total. I could order 30/m strips and end up with around 134. I have already added a few thicker power wires to each corner and I seem to be able to run all of them at full white without any problems.

  • Wow, solved in less than 2 hours. Amazing, thank you very much! Makes perfect sense now that I see there is that empty byte sitting there... wonder how long it would have taken me to figure that out on my own?!

  • 266 leds:
    const char prefix[] = {0x41, 0x64, 0x61, 0x01, 0x09, 0x5d};


    There's another sketch here that isn't so picky about the header bytes - you only need to change the number of leds
    https://github.com/hyperion-pr…ino/adalight/adalight.ino


    Hey there, I am in the same situation and wondering how I get 0x185 and 0x1d0 to only 2 digits? I'm trying to use 390 LEDs and ran into the same problem as themorb where I can get more than 256 LEDs operational... Line in my Arduino sketch the same.


    Tried to reverse engineer your numbers for 266 but not sure I understand where the extra byte is that themorb mentioned.... Would the first digit not be 109?


    For 390 LEDs I get 0x185 and 0x1d0


    Any help would be greatly appreciated

  • Hi there, first post and it appears the solution to my problems may be here!


    I have set up an Ambilight system running from RPI3 with Libreelec OS, WS2812B Leds and a UTV007 Grabber/Splitter from Lightberry
    i initially set up the system with an arduino Uno R3 to control the LED's, it would communicate via USB (RX would flash in sequence with info) but no Lights would come on, only boot sequence would repeat whenever i SSH'd hyperion.


    Switched to using the GPIO pins and initially had success running Openelec (latest release) but then out of nowhere the system developed serious lag. it would take 15-20 minutes for the Pi to boot but once it did it would work fine. Tried 2 different SD cards and re-installs, the first reinstall appeared to solve it but upon reboot hyperion wouldn't start. The issue only appeared on first boot though, if i restarted via SSH it would work fine. Same when i tried Libreelec, wouldn't start first time but with none of the "green" issues from the grabber that people seemed to have. Tried OSMC and it wouldn't work at all. Read about the issues with recent versions of OSMC so I got a version from 2015 (30th August) but it wouldn't even boot.


    Reinstalled Libreelec again recently and all seemed well, but then i noticed on the second boot, only 255 of the LEDs lit (out of 392). However, the LED's were still in the right place relative to the screen and effects worked as you'd expect, dissappearing when they would be above LED 255. It appears to be the issue with all my installs that the LED count exceeds 255 so i thought I'd switch back to the Arduino (Although i now have the Mega, incase the Uno is not up to the Job)


    I think my initial failure with Arduino is the same as CrowLight;


    the prefix, mine ending 0X187 0X1D2 (for 392 LEDs)


    Am i right in thinking i need to change this to 3, 2 digit numbers?
    0x01 then ignore the 1 so 0x87 then add 1 to the last value 0xD3?
    or is that totally wrong? (i assume it is!)
    I tried XORing all 3 but there seems to be a lot of debate on which is the correct way to do it.
    I tried 0x01 XOR 0x87 and got 0x89 then XOR'ed again with 0x55 and got 0xDC, that seems more likely!


    So long story short could you confirm how you managed to work out the prefix as i am planning on making another system and will probably again exceed 255 LED's


    Thank you very much for the help and sorry for the Novel, just wanted to make sure al info was there if necessary!

  • Ok, please tell me the prefix is wrong!


    I tried with the new prefix and still couldn't get it working, tried so many different arduino scripts too, none of them worked. Triple checked Baud rates matched and tried multiple different ones. Tried changing number of LEDS below 256 and got matching prefixes, still won't work. Tried both the Uno and Mega, same thing every time, Rx flashing but no lights.


    Any advice at all? I have now sank 100+ Hours into this, the system doesn't cope through GPIO so I need to something else to do the processing, i was wondering about USBASP but is it limited to 256 Leds?


    Would really appreciate the help, I'm totally out of ideas, don't wan't to buy anything else if i can't even get it working on Uno!

  • Yeah the strand tests are all fine. The ambilight works perfectly through GPIO and a logic converter, its just after the reboot that i get issues hence changing back to Arduino.
    The Arduino plays it's initial opening sequence then no response from there.


    To clarify the strand tests were obviously done with just the arduino, read that back and it sounded wrong haha

  • I will do, the setup is at my parents house, i should be there tomorrow so I will keep you posted!


    I did originally have a delay after connect of 20, then i set it higher in the hopes it would help, is there a reason 15 was chosen or is it just a good value?


    Thanks very much for the help!

  • Hi,


    I remembered a link that may help with calculating the correct prefix. There is a processing script in that post that works well for the calculation. Post is here.

    Zitat

    Prefix for 392 LEDS: 41 64 61 01 87 D3



    It might be of help.

  • Thanks Akriss! At least that confirms I went wrong somewhere with my prefix! i actually had D3 in the script but like i said in post #7 i thought it was totally wrong! If TPModdings script doesn't work i'll have to go back and give that prefix another shot, maybe it didn't like the baudrate or Datapin? I've tried so many combo's now i could have easily missed one!


    Thanks again for that!

Jetzt mitmachen!

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