Results 1 to 5 of 5

Thread: Arduino 200 Pixel Setup - Having Transfer Problems

  1. #1
    Join Date
    Dec 2013
    Posts
    77
    Post Thanks / Like

    Default Arduino 200 Pixel Setup - Having Transfer Problems

    Arduino 200 Pixel Setup - Having Transfer Problems

    This last season I added pixels to my incandescent setup, 100 pixels on a Reef. These 100 pixels are controlled by an Arduino Mega 2560, Serial UART and Vixen via serial. The show worked with a few glitches that I over looked, now I am trying to add another 100 and look into some of the problems.

    Last Years setup and Issues:
    Reef with 100 Pixels, I could only get the code to work with 99 of them and set to 57600 rate. Setting the code it to 100 pix and you get problems, random pix staying on. Setting the transfer rate to anything other then 57600 would result in either nothing working or random pix activating. The code and others seem to get this to work best at 115200 which it not the case for me.

    This Year.

    I know the Arduino has some limitations with pixels, but after reading it seems I am still with in those limitations, I don't plan on going over 200 pix with the Arduino, Falcon f16 is in my future and probably xLights.

    So can anyone explain to me why only the 57600 is working and do I even have a chance of getting these 200 pix working. I am here because I am at a wall.


    (Also starting a different thread asking help with my Arduino DUE ARM CPU, I was thinking this would fix my transfer and 16MHz bottle neck yet the code below is not working) HERE


    Vixen 3.5u4 Build:759
    FTD1232 UART
    Arduino Mega 2560



    Code:
    /*=====================================
    =            VixPix Sketch            =
    
      For basic control of RGB Pixels 
      using Vixen Generic Serial3 Protocol
    =====================================*/
    
    /**
     * VIXEN Setup:
     * In Vixen display setup...
     *    - Add an element group containing one element for each pixel attached to arduino
     *    - Configure the 'Color Handling'  as "They can be any color: Full RGB"
     *    - Add a "Generic Serial3 Controller"
     *    - Name it what you want (Although... Jdc928IsAwesome is great controller name)
     *    - Set the channel count to 3x the number of Pixels you have 
     *    - Save, then configure these options
     *    - Com Port: choose the correct port for your arduino's Serial3
     *    - Baud Rate: 115200 (or whatever you changed it to below)
     *    - Click OK
     *    - Check the box "Send a text header"
     *    - Type "VIXStart" in the header text box
     *    - Click "OK"
     *
     *    - Click and highlight the newly added Element in the elements list
     *    - Click and highlight the newly created controller
     *    - Your "Total Patch Points" and "Output" counts should match
     *    - Click "Patch Elements to Controllers"
     *    - Click OK and you should be ready to go
     *
     *
     *    You should now be able open a Sequence
          add some effects to the new channels
          and see the strips responding accordingly
    
     */
    
    
    
    /**
     * Pixel Strip Setup
     *    Strips setups vary but generally as follows
     *    - If your using a large number of strips you will
     *      probably want to power them externally. 
     *       
     *    - Connect external V+ to strip Vin
     *    - Connect external Gnd to strip Gnd
     *    - Connect external Gnd to Arduino Gnd
     *    - Connect Strip Data to proper pin on Arduino
     *    - Connect Strip DataClock to proper pin on Arduino if not using ws2812
     */
    
    
    
    #include <Adafruit_NeoPixel.h>    //  This is the Neo-Pixel library (ws2812)
                                      //  Change to the library for your pixel types
                                      //  Suggest using a library created by Adafruit
                                      //  so the function names will be the same                               
                                      
                                      
                                      
    #define DPIN 6                    //  Change this to the pin# connected to your pixels DataIn
                                      //  Will probably need to define a ClockPin for other pixel
    
    
    int   PixelCount = 201;             //  Set this to the number of Pixels connected
    
    int   bugLevel  = 0;              //  This is just a way I manage turning debugging over Serial3 on/off
    
     
    
    /*  Sets up the NeoPixel Strip object
     Replace with proper Object initiation for your pixel types */
    Adafruit_NeoPixel strip = Adafruit_NeoPixel(PixelCount, DPIN, NEO_RGB + NEO_KHZ800);   
    
    
    
    void setup()
    {
      delay(100);                    //  A delay for a reason I can't remember. I can live with one in the setup.  
      strip.begin();                 //  Get strip started
      strip.show();                  //  Initialize all pixels to 'off'
     
      Serial3.begin(115200);          //  Start the Serial3 communication 57600
      bugit("Setup Complete",10);    //  DEBUG: Confirm setup is complete
    
    }
    
    
    void loop()
    {                                       // START LOOP
     
      if (Serial3.available()>2)             // Wait for a few bytes to be recieved
      {
        bugit("Waiting for Header",10);     // DEBUG: Header waiting started
        waitForVixenHeader();               // Header check function
        bugit("VixStart Triggered",10);     //  DEBUG: Header found; getting color data
      
        for (int pixCount=0; pixCount<PixelCount;pixCount++)       // Do this for as many Pixels defined in PixelCount
        {
          int RGB[3];                             // Create array to hold this pixels RGB value                   
          for (int color = 0;color<3;color++)     // For the next 3 incoming bytes
          {                       
            while (Serial3.available() < 1)        // Wait for bytes to be received
            {
              delay(10);
            }
            RGB[color] = Serial3.read();           // Save this byte to the correct RGB value
          }                                       // Repeat until bytes for this pixels RGB value have been recieved
    
          strip.setPixelColor(pixCount,RGB[0],RGB[1],RGB[2]);  //Set this pixels new color
          
        }                                         // Repeat untill all pixels have had new RGB value set
        strip.show();                             // Update the strip and show with new color                             
      }                                           // YAY! DO IT AGAIN!
    }                                              // END OF LOOP
    
    
    
    /**
     *  FUNC    bugit           [manages printing of debugging based on debugging level]
     *  @param  String  bugstr  [string to be be printed]
     *  @param  int     blevel  [the level at which this debugging should be ignored]
     *    
    */
    
    
    int bugit(String bugstr,int blevel)
    {
      if (blevel < bugLevel)
      {
        Serial3.println(bugstr);
      } 
      return;
    }
    
    
    /**
     * I 'borrowed' snippets of this waitForVixenHeader() function from some code I found online
     * Can't find the originator now but thank you. It works well.  
     * 
     */
    void waitForVixenHeader()
    {
    
        bugit("Waiting Loop",10); 
        char *header="VIXStart";
        char buffer[3];
        int index = 0;
    
        while (true) 
        {
    
            int inByte = Serial3.read();
            if(inByte==-1)
            {
              continue;
            }
            
            buffer[index] = inByte;
            if(buffer[index]!=header[index])
            {            
                index=-1;                     // not the right sequence restart
            }
            
            buffer[index+1] = 0;              // add null
            index++;
            if(index==8)
            {
              return;
            }
        }
    }
    Last edited by xGROMx; 10-05-2019 at 01:35 PM.
    Mostly C9 Light Show, powered by Arduino. 48A Full On last year. "It feels like a carnival"
    https://www.facebook.com/ItsaDillonChristmas/

  2. #2
    Join Date
    Dec 2013
    Posts
    77
    Post Thanks / Like

    Default Re: Arduino 200 Pixel Setup - Having Transfer Problems

    Addition, I did manage to get the 200 working but not well, I found that I didn't connect a ground in the cable I was using to connect the data line from the reef to the new 100. It was getting interference/bleed and causing problems. So now if mainily the transfer rate or the speed of the MEGA, they are very jittery and not smooth.
    Mostly C9 Light Show, powered by Arduino. 48A Full On last year. "It feels like a carnival"
    https://www.facebook.com/ItsaDillonChristmas/

  3. #3
    Join Date
    Oct 2014
    Location
    Sauk City, WI USA
    Posts
    1,249
    Post Thanks / Like

    Default Re: Arduino 200 Pixel Setup - Having Transfer Problems

    How does the data get from player to arduino? Is it within a reasonable distance for whatever you are using?
    You've probably seen this from the wiki...

    It is for Renard protocol but pretty much is same for any serial communication. At 600 channels of data and if you are really communicating at 57600, you can't run anything faster than 100+ ms. So, you will need to up the communication speed some way for a standard 50ms sequence.

  4. #4
    Join Date
    Dec 2013
    Posts
    77
    Post Thanks / Like

    Default Re: Arduino 200 Pixel Setup - Having Transfer Problems

    The player is a laptop running Vixen with a USB to Serial UART, the serial is transferred over cat5e. In this test, I was using a 6' cable, the show has a 25'~ cable. For this season, being so close, I am planning on adding a second Arduino Mega to my system, keep it down to 100 each.

    I still can't figure out why I am not able to get 115200 to work at all, maybe I need to look at which twisted pair I am using....I set it up to use the same as standard networking expecting that to be the best method.
    Mostly C9 Light Show, powered by Arduino. 48A Full On last year. "It feels like a carnival"
    https://www.facebook.com/ItsaDillonChristmas/

  5. #5
    Join Date
    Dec 2012
    Location
    Newtown CT
    Posts
    4,195
    Post Thanks / Like

    Default Re: Arduino 200 Pixel Setup - Having Transfer Problems

    RS232 has severe speed and distance limitations. Most likely your issues would go away if you are using RS485 or RS422 interfaces. Those can go 1000 feet.


    2020 Full sized show reworked for the new location. Only adding (famous last words) 13 RBLs that I finally got converted to using pixels
    2019 - Just moved into a new home (yet another change of plans). Will be dim but not dark. Too much to do at the new place to leave time for a show. Dim show (3000 pixels) had regular visits most nights.
    https://www.youtube.com/channel/UCyX...ttrsZNARkUce0Q

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •