Page 1 of 2 12 LastLast
Results 1 to 10 of 13

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
    735
    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
    Santa member dirknerkle's Avatar
    Join Date
    Nov 2011
    Location
    Plymouth, MN USA
    Posts
    9,740
    If that is a timing limitation per USB port, then you might split the feed between multiple USB ports instead.
    Even though the DIGWDF Store has closed, it's still awesome! Thanks to all who have supported us through nearly 7 years of excitement!
    Parts of the store will remain open for downloading documentation, firmware and Gerber/DipTrace files: 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
    Santa member dirknerkle's Avatar
    Join Date
    Nov 2011
    Location
    Plymouth, MN USA
    Posts
    9,740
    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
    Even though the DIGWDF Store has closed, it's still awesome! Thanks to all who have supported us through nearly 7 years of excitement!
    Parts of the store will remain open for downloading documentation, firmware and Gerber/DipTrace files: 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

  9. #9
    Junior Elf member
    Join Date
    Feb 2019
    Posts
    3
    I am using similar code
    /*
    ************************ Heinz Doessegger - www.technikfreak.ch ******************************

    Vchristmas v1.0 - January 2015
    Documentation for the project:
    Http://www.technikfreak.ch/category/...tsbeleuchtung/

    HARDWARE: TEENSY 3.1 / 3.2

    ARDUINO PLUGIN: TEENSYDUINO with OctoWS2811 library
    Http://www.pjrc.com/teensy/td_download.html

    LED: WS2811

    SOFTWARE: Vixen Lights 3.x
    Program to control WS2811 RGB LED by Vixen Lights 3.x http://www.vixenlights.com/
    DISPLAY CONFIGURATION - COMx (x = COM port of Arduino) 115200, None, 8 One
    SEND A TEXT HEADER: VIXStart
    Channels: Pro LED requires 3 channels (red / green / blue)
    Color Handling: RGB

    TIP: For beginners
    Start with a 50 series LED. LedsPerStrip and PixelCount to 50.
    In Vixen Lights, create 50 LED elements and map to 150 outputs via the Color Handling RGB.

    ************************ Heinz Doessegger - www.technikfreak.ch ******************************
    */

    #include <OctoWS2811.h>

    const int ledsPerStrip = 1200; // Maximum number of pixels per string
    int PixelCount = 9600; // Effective number of pixels
    float hell = 1.00; // 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, 200*hell, 0, 0);
    }
    leds.show();
    delay (5000);
    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 RGB[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() < 1) // Wait for the next number
    {
    delay(10);
    }
    RGB[color] = int(Serial.read()*hell); // Assign color value to the array with brightness correction
    } // Repeat until all three values are read

    leds.setPixel(pixCount, RGB[1], RGB[0], RGB[2]);

    } // Repeat until all LEDs are read
    leds.show(); // Activate color patterns
    } // Get the next color pattern
    } // Loop end

    void waitForVixenHeader()
    {
    char *header="VIXStart";
    char buffer[8];
    int index = 0;

    while (true)
    {
    int inByte = Serial.read();
    if(inByte==-1)
    {
    continue;
    }

    buffer[index] = inByte;
    if(buffer[index]!=header[index])
    {
    index=-1;
    }

    buffer[index+1] = 0;
    index++;
    if(index==8)
    {
    return;
    }
    }
    }
    but what I can't figure out is how to setup xlights and map my different channels to tje different ports on the octows2811 board can you post a snapshot of your setup tab in xlights

  10. #10
    Frosty member
    Join Date
    Nov 2014
    Location
    Sauk City, WI
    Posts
    925
    I could never quite figure out what Kutsikas15 was doing here but his Octo config was correct in that he had 200 LEDs (pixels) per line and 8 lines (1600/200). So his matrix was pretty easy to figure out. 200 pixels x 8 = 4800 channels.

    But in your case, you have way too many LEDs configured. The OctoWS2811 library is going to take the data in (leds.setPixel...) and map it automatically based on your 1200/9600 pixels into the 8 available pins. So in xLights, you would setup 28,800 (9600*3) channels and configure your models appropriately to use the channels you want knowing that the break on each output is at 1200 pixels.

    So, xLights will handle the channels no problem. But you don't have a reliable way to send that data to your teensy. The various Lighting Networks you have available in xLights will not allow that many channels via a serial style output. And for good reason...you can't really do blinky-flashy when the data takes more than a second to transmit one frame! You might be able to do blink on, blink off, blink on, blink off but it would be pretty clunky with no flashy involved.

    So, lets say you meant that you are going to do 200 pixels per string. That would give you 1600 pixels in 8 groups of 200. In xLights, you could setup one DMX network with 4800 channels but you would map your models into groups of 200. If it were me, I would write it by hand first (or maybe in a spreadsheet) and then create the models taking into consideration the 200 pixel limit using my notes to map them to individual start channels. There might be a better way but that is the one that makes sense to me.

Page 1 of 2 12 LastLast

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
  •