Results 1 to 8 of 8

Thread: Xlights+teensy3.2+octows2811

  1. #1
    Junior Elf member
    Join Date
    Oct 2018
    Posts
    5

    Question Xlights+teensy3.2+octows2811

    Hello
    I was able to run xlights with teensy3.2 with following code but problem is that first pixel stays always ON and is random color and pixel RGB locations are shifted R+1pixel, B+1 pixel, G+2 pixels - if Xlights sends out red color - it starts at pixel 2, blue at pixel 2 and green at pixel 3.
    And I cant just figure it out whats wrong with the code so it messes up the pixel locations.....
    In Xlights I added Teensy with USB>DMX>com3>last channel 1600

    Code:
        
        #include <FastLED.h>
        #include <OctoWS2811.h>
    
        const int ledsPerStrip = 200;              // Maximum number of pixels per string
        int   PixelCount = 1600;                      // Effective number of pixels
        float hell = 0.20;                          // Dimmer 1.00 = 100% brightness - 0.50 = 50% brightness 
    
        DMAMEM int displayMemory[ledsPerStrip*6];
        int drawingMemory[ledsPerStrip*6];
        const int config = WS2811_GRB | WS2811_800kHz;
        OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);
        int pixelValue = 0;
    
        void setup()
        {
          delay(300);
          Serial.begin(115200);                     // Speed of data transmission from Vixen Lights 3 to the Arduino
    
          leds.begin();
          for (int i=0;i<PixelCount;i++)            // Initialization - Once all LEDs light up blue
             {
               leds.setPixel(i, 0, 0, 200*hell);
             }
               leds.show();   
             delay (1000);  
          for (int i=0;i<PixelCount;i++)
             {
               leds.setPixel(i, 0, 0, 0);
             }
             leds.show();   
        }
    
        void loop() 
        {                    
         
            if (Serial.available() > 5 )                // Wait for data transmission from Vixen Lights
          {
    //         waitForVixenHeader();                   // Call function: Waiting for start string
          
            for (int pixCount=0; pixCount<PixelCount;pixCount++)       // Do this for as many Pixels defined in PixelCount
            {
              int GRB[3];                             // Array for the three RGB color valuesArray for the three RGB color values                   
               for (int color = 0;color<3;color++)     // Three values each form one RGB LED
              {                       
                while (Serial.available() <0 )        // Wait for the next number
                {
                  delay(10);
                }
                GRB[color] = int(Serial.read()*hell); // Assign color value to the array with brightness correction
              }                                       // Repeat until all three values are read
                  
                  leds.setPixel(pixCount, GRB[0], GRB[1], GRB[2]);
              
            }                                         // Repeat until all LEDs are read
            leds.show();                              // Activate color patterns                             
          }                                           // Get the next color pattern
        }                                             // Loop end
    Can anyone help me please?

  2. #2
    Rudolph member
    Join Date
    May 2016
    Location
    UK about the middle - S80 postcode.
    Posts
    665
    HI, a quick guess.

    Your pixels have the colour order set as Green Red Blue.
    The green doesn’t work until pixel 3 (data byte No.7).
    Red doesn’t work until pixel 2 (data byte No. 5).
    You have commented out ‘waitForVixenHeader();’ did the instructions tell you to set up a header something like this - >> number of pixels << ?
    If you have commented out the line and just left >><< as the header this is 4 bytes of data and would offset the pixel data by the amount you are out. Sending no header will fix the offset but cause more problems as time goes on – that said it’s a good test for now.

    I think you will need to change your pixel colour order once you fix the header offset.

  3. #3
    Junior Elf member
    Join Date
    Oct 2018
    Posts
    5

    Cool

    I was just messing around with the code (i mean - not knowing what im doing), but for now it seems that i got it working
    Pixels starts at right place and colors are right. Now I will be testing to see if that code can run my show this year...

    Code:
     #include <FastLED.h>
        #include <OctoWS2811.h>
    
        const int ledsPerStrip = 200;              // Maximum number of pixels per string
        int   PixelCount = 1600;                      // Effective number of pixels
        float hell = 0.20;                          // Dimmer 1.00 = 100% brightness - 0.50 = 50% brightness 
    
        DMAMEM int displayMemory[ledsPerStrip*6];
        int drawingMemory[ledsPerStrip*6];
        const int config = WS2811_GRB | WS2811_800kHz;
        OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);
        int pixelValue = 0;
    
        void setup()
        {
          delay(300);
          Serial.begin(115200);   // Speed of data transmission           
    
          leds.begin();
          for (int i=0;i<PixelCount;i++)            // Initialization - Once all LEDs light up blue
             {
               leds.setPixel(i, 0, 0, 200*hell);
             }
               leds.show();   
             delay (1000);  
          for (int i=0;i<PixelCount;i++)
             {
               leds.setPixel(i, 0, 0, 0);
             }
             leds.show();   
        }
    
        void loop() 
        {                    
         
            if (Serial.available() > 5 )                // Wait for data transmission
          {
             waitForHeader();                   // Call function: Waiting for start string
          
            for (int pixCount=0; pixCount<PixelCount;pixCount++)       // Do this for as many Pixels defined in PixelCount
            {
              int GRB[3];                             // Array for the three RGB color valuesArray for the three RGB color values                   
              for (int color = 0;color<3;color++)     // Three values each form one RGB LED
              {                       
                while (Serial.available() < 0 )        // Wait for the next number
                {
                  delay(10);
                }
                GRB[color] = int(Serial.read()*hell); // Assign color value to the array with brightness correction
              }                                       // Repeat until all three values are read
                  
                  leds.setPixel(pixCount, GRB[0], GRB[1], GRB[2]);
              
            }                                         // Repeat until all LEDs are read
            leds.show();                              // Activate color patterns                             
          }                                           // Get the next color pattern
        }                                             // Loop end
    
        void waitForHeader()
        {
            char *header = "";
            char buffer[1];
            int index = 0;
            while (true) 
            {
                int inByte = Serial.read();
                buffer[index] = inByte;
                buffer[index+1] = 0;              
                index++;
                if(index==5)
                {
                  return;
                }
            }
        }

  4. #4
    Junior Elf member
    Join Date
    Oct 2018
    Posts
    5
    Well now I ran into another problem - xLights allows just 3036 DMX USB channels, I need 4800 channels - is there a way to increase the channel limit?

  5. #5
    Workshop Elf dirknerkle's Avatar
    Join Date
    Nov 2011
    Location
    Plymouth, MN USA
    Posts
    9,391
    If that is a timing limitation per USB port, then you might split the feed between multiple USB ports instead.
    The DIGWDF Store is closing at the end of this year.
    While it's still open, please check us out at: http://digwdf.com/store

  6. #6
    Junior Elf member
    Join Date
    Oct 2018
    Posts
    5
    If you set up controller as USB and choose DMX then you cant save it if you have set more than 3036 as the end channel of DMX, but i need 4800 to be the last channel - 1 teensy has more than enough power to run that many channels... i also cant use any other protocol because then my code wont work...

  7. #7
    Workshop Elf dirknerkle's Avatar
    Join Date
    Nov 2011
    Location
    Plymouth, MN USA
    Posts
    9,391
    So set one USB port to 2400 channels and the other USB port to 2400 channels and configure Vixen so that channels 1-2400 go out one port and channels 2401-4800 go out the other. You may run into issues relative to universes insofar as a DMX universe is 512 channels. Then you'd use two Teensy's
    The DIGWDF Store is closing at the end of this year.
    While it's still open, please check us out at: http://digwdf.com/store

  8. #8
    Junior Elf member
    Join Date
    Oct 2018
    Posts
    5
    DMX channel limit was raised to 4800 and everything works perfectly - except I cant use 4800 channels - I can use 4797 channels - after that, things go crazy... but I was also abel to install developer version of xLights and in the future I will be testing USB DMX channel limit further - but for now, I can use xLights for my this years show - YAY

Tags for this Thread

Posting Permissions

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