Led-boards control via serial - patch optimization question

    Apr 18 2011 | 8:18 am
    Dear All, I want to control 50 rgb-led-boards that are daisy-chained via serial board. Each Board is equipped with 50 rgb led's and a microcontoller, and all led's do the same for each board, so i can just dim / colorchange each board individually, but not single led's.
    The guys that did the electronics for that came up with a protocol, where i have to send individual messages to the ledboards via serial port: *01102030$ -> first *, second adress of the ledboard (in this case 01, means first board), third Red-Value (in this case 10), fourth Green-Value (in this case 20), fifth Blue-value (in this case 30) and last $ to complete the command.
    Attached is my patch how i achieve this message format via sprintf & regexp.
    My first question is: While it is working fine, i guess there are more elegant ways / objects to achieve the same translation.
    And second: I have to send the messages one after another, so if i would like to dim the Red channel of the led board Nr.1 I have to send a series of messages ala: *010102030$ *010112030$ *010122030$ *010132030$.....
    I guess if I want to control/dim 50 led-boards at the same time, the speed of the serial connection cannot handle it, heh? (right now i can only try with two boards, while the other 48 will be finished only a few days before I have to use them). Does anybody know how many messages can be send in one second and maybe give some tips also how i could avoid in such a setup that messages got lost in the transfer? somehoe i have the feeling that there will be a lot of problems with the 50 daisychained boards, and that i cannot really control all of them simultanously...
    thanks for hints

    • Apr 19 2011 | 9:43 am
      ok, i guess it will work much more reliable if the code on the microcontrollers is changed and the dimming is done there, so that i can just send a time in ms and the next value from maxmsp...
    • May 13 2011 | 9:33 am
      ok, the code of the pics will probably changed.
      00Adress (00=all, 01 is Board 1…) 9 Mode (Computer Control) 99R99G99B
      0010 = 1sec 0001 0 100msec
      right now i try to create a flexible patch, where i can adjust colors, fadetime and delay-patterns for the individual light fixtures.
      hm, right now i end up with many many cords and sprintf objects :-)
      problem is always if i have a color value such as 000010 the first 4 0 will be deleted if i don't use them with a sprintf %s%s with an additional 1 or whatever - but not zero - prepended. so i just realized that i still have to change the structure and need even more cords...
      it would be great if sb. could have a short look into my basic patch (not finished but the principle should be obvious) and make some suggestions of different ways of achieving what i want...
      when i am finished, i will for sure post the patch
    • May 13 2011 | 12:34 pm
      ok, i am happy that it works. here the same patch a little bit clearer. i fill the coll-objects with mathematic patterns on the fly and set then the individual values via coll lists for all parameters, output is printed to max window. still if anybody has some further suggestions,