Page 3 of 3 FirstFirst 123
Results 21 to 30 of 30

Thread: Vixen Ardunio Ws2811

  1. #21
    Frosty member
    Join Date
    Nov 2014
    Location
    Sauk City, WI
    Posts
    847
    Quote Originally Posted by snowsled View Post
    I have tried the code and will not work for me so far.

    I have this code that i found and it seems to work somewhat, the color shows correct if baud rate is 9600 or 1048576 but no matter what baud rate I use the frames per seconds are too slow. default baud rate is 115200.

    Code:
    /*=====================================
    =            VixPix Sketch            =
    
      For basic control of RGB Pixels 
      using Vixen Generic Serial 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 Serial Controller"
     *    - Name it what you want
     *    - 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 serial
     *    - 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 = 200;             //  Set this to the number of Pixels connected
    
    int   bugLevel  = 0;              //  This is just a way I manage turning debugging over serial 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_GRB + 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'
     
      Serial.begin(115200);          //  Start the Serial communication
      bugit("Setup Complete",10);    //  DEBUG: Confirm setup is complete
    
    }
    
    
    void loop()
    {                                       // START LOOP
     
      if (Serial.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 (Serial.available() < 1)        // Wait for bytes to be received
            {
              delay(10);
            }
            RGB[color] = Serial.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)
      {
        Serial.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 = Serial.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;
            }
        }
    }




    I'm new to the forums and would like to start buying some hardware but don't know which to purchase. I'm determined to have a show this Christmas
    You should start a new thread for your problem.
    What hardware are you using?
    IMO, You should stay away from arduino/serial port for pixel control in your show. It doesn't have enough power. If you want a low cost pixel controller for up to 680 pixels, consider the wireless ESPixel stick and the like. These are programmed like an arduino but have much more speed. If you want a real controller, get a wired e1.31. Wide variety of DIY/professional versions available. The E1.31 controllers will use ethernet and you will have plenty of speed to drive your show.

  2. #22
    Junior Elf member
    Join Date
    Mar 2018
    Location
    Canada
    Posts
    2
    Quote Originally Posted by MikeKrebs View Post
    You should start a new thread for your problem.
    What hardware are you using?
    IMO, You should stay away from arduino/serial port for pixel control in your show. It doesn't have enough power. If you want a low cost pixel controller for up to 680 pixels, consider the wireless ESPixel stick and the like. These are programmed like an arduino but have much more speed. If you want a real controller, get a wired e1.31. Wide variety of DIY/professional versions available. The E1.31 controllers will use ethernet and you will have plenty of speed to drive your show.
    Thanks for the advice. Where can I purchase ESPixel sticks? I have searched but no luck finding any to buy. Is there an alternative?

  3. #23
    Junior Elf member klights's Avatar
    Join Date
    Feb 2017
    Location
    Nashua, NH
    Posts
    9
    I purchased these:
    http://renard-shop.com/home/37-es-wi...ontroller.html

    Have had no issues with them they were rock solid for me this past christmas.

  4. #24
    Frosty member
    Join Date
    Nov 2014
    Location
    Sauk City, WI
    Posts
    847
    sporadic (forkineye)sells the espixelstick on amazon but he has more demand than supply lately. There has been talk about a group buy at some point but so far I have not seen it.
    pixel pops are another version. these are diy but that is what we are about!
    https://www.doityourselfchristmas.co...6_ESPixel_Pops

  5. #25
    Junior Elf member
    Join Date
    Aug 2017
    Location
    mo
    Posts
    61
    Quote Originally Posted by klights View Post
    I purchased these:
    http://renard-shop.com/home/37-es-wi...ontroller.html

    Have had no issues with them they were rock solid for me this past christmas.


    im looking at trying to add just a few strips of the ws2811rgbw pixels they are strip lights and have more then 170 leds. now am I counting wrong? they have 3 leds per section that can be cut to fit. the controller your suggesting shows max pixels is 170. am I wrong on my count or will I need to trim off the remaining lights from the strips? thanks for your time. I was originally going to buy a second Arduino mega just to run the 2 strips this year but if these sticks will control my strands I may try them instead. thanks again.

  6. #26
    Frosty member
    Join Date
    Nov 2014
    Location
    Sauk City, WI
    Posts
    847
    A lot of confusion Comatose760...the RP people have that 170 in their documentation but they use the standard sketches on the esp from madsci or sporadic. Sporadic's software is good for 680 pixels at 25 ms. So don't let the 170 in the documentation stop you. There is nothing in their hardware that would limit it to 170.

    The strips you using are ws2811 rgbw? You will want to make sure your sequencer knows how to handle them. xLights did add some support this year.

    3 lights per pixel is probably what you have. If you have ws2811, there will be an IC chip. It is probably driving 3 leds. Count the chips. If you have ws2812(b) then the chip and LED are integrated. In that case the 3 led cut length is probably for convenience as you should be able to cut every one.

  7. #27
    Junior Elf member
    Join Date
    Aug 2017
    Location
    mo
    Posts
    61
    thanks mike yeah a ton of confusion. new to the whole pixel thing. I had these strips given to me last year in hopes I can use them this year. and yeah 3 leds per chip. thanks for the helpful info. on using a arduino mega to run 32 channels this year. maybe 48 havnt decided 100% yet. but I'm also using vixen 3. what do I need to run these with my set up? or is it even possible? thanks again for all the help

  8. #28
    Frosty member
    Join Date
    Nov 2014
    Location
    Sauk City, WI
    Posts
    847
    let's confirm what you have...closeup picture(s) of your 3 led grouping with any writing on the strip.
    my guess is that you have ws2811 30/10 rgb strips. 30/10 means you have 30 leds with 10 pixels per meter. If so, you can run one strip (5m) very easily from an arduino with vixen 3.

  9. #29
    Junior Elf member
    Join Date
    Aug 2017
    Location
    mo
    Posts
    61
    mikekrebs I sent you a message

  10. #30
    Junior Elf member
    Join Date
    Nov 2018
    Location
    Surrey B.C. Canada
    Posts
    8
    I also tried that code i just edited the led count and pin no. coz this is what my set up is. It works good. however i am trying to use 6 strips on different pins 50 leds each . and cant figure out what to do

    Vixen Lights 3.x - Arduino Generic Serial for Addressable Pixels

    Using this code is pretty straight forward, simply hookup your one wire (WS2811 or WS2812) data line to pin 6 of your Arduino
    and upload this code. Make sure you have properly installed the FastLED library from http://fastled.io Once you are done, simply
    power your Pixel strips from an external power supply. Next configure a Generic Serial Controller inside of Vixen Lights 3.x and
    add 3 x pixels for the number of channels. Configure the Generic Serial Controller to use 115200, 8, none, and 1. Then create
    your element and add "Multiple Items (1 x number of pixels). Finally select your pixel elements and set them as RGB pixels before
    patching them to the controler outputs. You should now be ready to begin testing.

    For a complete tutorial check out blog.huntgang.com

    Created November 8th, 2014
    By Richard Sloan - www.themindfactory.com
    And David Hunt - blog.huntgang.com
    Version 1.4

    */


    // You must download and install the library from http://fastled.io/
    #include <FastLED.h>

    // Sets the maximum number of LEDs that this code will handle to avoid running out of memory
    #define NUM_LEDS 100

    // Sets the pin which is used to connect to the LED pixel strip
    #define DATA_PIN 22

    CRGB leds[NUM_LEDS];


    void setup() {
    // Define the speed of the serial port
    Serial.begin(115200);
    }

    void loop() {
    // Set some counter / temporary storage variables
    int cnt;
    unsigned int num_leds;
    unsigned int d1, d2, d3;

    // Begin an endless loop to receive and process serial data
    for(; {
    // Set a counter to 0. This couter keeps track of the pixel colors received.
    cnt = 0;
    //Begin waiting for the header to be received on the serial bus
    //1st character
    while(!Serial.available());
    if(Serial.read() != '>') {
    continue;
    }
    //second character
    while(!Serial.available());
    if(Serial.read() != '>') {
    continue;
    }
    //get the first digit from the serial bus for the number of pixels to be used
    while(!Serial.available());
    d1 = Serial.read();
    //get the second digit from the serial bus for the number of pixels to be used
    while(!Serial.available());
    d2 = Serial.read();
    //get the third digit from the serial bus for the number of pixels to be used
    while(!Serial.available());
    d3 = Serial.read();
    //get the end of the header
    while(!Serial.available());
    if(Serial.read() != '<') {
    continue;
    }
    while(!Serial.available());
    if(Serial.read() != '<') {
    continue;
    }
    // calculate the number of pixels based on the characters provided in the header digits
    num_leds = (d1-'0')*100+(d2-'0')*10+(d3-'0');
    // ensure the number of pixels does not exceed the number allowed
    if(num_leds > NUM_LEDS) {
    continue;
    }
    // Let the FastLED library know how many pixels we will be addressing
    FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, num_leds);
    // Loop through each of the pixels and read the values for each color
    do {
    while(!Serial.available());
    leds[cnt].r = Serial.read();
    while(!Serial.available());
    leds[cnt].g = Serial.read();
    while(!Serial.available());
    leds[cnt++].b = Serial.read();
    }
    while(--num_leds);
    // Tell the FastLED Library it is time to update the strip of pixels
    FastLED.show();
    // WOO HOO... We are all done and are ready to start over again!
    }
    }

Page 3 of 3 FirstFirst 123

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
  •