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

Thread: Vixen Lights multiple ws2811 led strings arduino uno

  1. #1
    Join Date
    Jan 2021
    Posts
    5
    Post Thanks / Like

    Default Vixen Lights multiple ws2811 led strings arduino uno

    Dear All,

    Wondering if anyone can help me with an issue that I have ran into.

    First of all, I am new to Vixen and Pixels, so do excuse me if i ask dumb questions.

    I started developing my first Christmas lighting show and bought 4 led strings with 100 addressable leds type WS2811 for this. So I want to control 400 LEDs in total. I managed to control one of the 4 strings (100 leds) with an Arduino Uno by means of standard sketches. Then I downloaded Vixen Lights. After this I started to patch 100 leds with RGB at the Arduino (300 outputs total). This works great.

    However, the question is whether it is possible to control the other 3 LED strings via Vixen with the same Arduino Uno and run separate sequence (effects) per string? I suspect not because I then have to configure the same Arduino 4x in Vixen as output with the same com-port.

    Does each string need its own Arduino if I want to ran different sequences, is the question?

    However, I wanted to verify this in advance and ask for other options/ideas.

    Thanks
    Jeroen

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

    Default Re: Vixen Lights multiple ws2811 led strings arduino uno

    When you say different sequences, are you talking about running vixen twice or just doing something different for each string within the existing sequences? In case one, yes you need different controllers. In case two, no. So, in vixen, you just increase the number of outputs for your existing controller setup. Each string is not a separate controller. In your sketch you just take the first 300 channels and output on pin x, then take the next 300 channels and output on pin y, etc

    But...at some point you will overrun the capability of the serial port to support all the channels and the speed of the arduino to get the bytes and output the data. But you can just keep increasing the number until you run out of steam.

  3. #3
    Join Date
    Jan 2021
    Posts
    29
    Post Thanks / Like

    Default Re: Vixen Lights multiple ws2811 led strings arduino uno

    just make the elements in a set groupe and patch them to the outputs you want in the out put total side
    Example
    say you have 50 Elements made up patch those to the 50 out puts you whant to turn on.
    from 1-300 outputs just Remember in your outputs 3 x 300 = 900.
    Every led has 3 out puts for each i Assume you know the math, Justice case somebody else doesn't know and reads this post they understand that.

    Sent from my SM-N975U using Tapatalk

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

    Default Re: Vixen Lights multiple ws2811 led strings arduino uno

    If you want to know how many pixels you can drive on a single serial line, look at the PX1 specifications on this forum. It has a table of baudrate to pixels that provides this information for common baud rates.


    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

  5. #5
    Join Date
    Jan 2021
    Posts
    5
    Post Thanks / Like

    Default Re: Vixen Lights multiple ws2811 led strings arduino uno

    Thanks for the quick answer. It's about case two. I want each string to play a different existing sequence in Vixen. I setup Vixen with my Arduino as a test. I configured my Arduino as Generic Serial with 300 channels.
    I got 100 pixels which output RGB so 300 pixels total patched to the Arduino. Currently I'm sending a header >>300<<



    I'm using a sketch which I found on this Forum. Problem is it doesn't work well. Actually it works fine for one single string (my test case).
    How easly can I change the code to get the first 300 channels and put it to pin 4, the next 300 (so channel 301-600) pixels to pin 5, etc?
    I guess I need to use multiple headers to tell the sketch which channels to collect? Haven't found an example yet.


    // 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 300

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

    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!
    }
    }

  6. #6
    Join Date
    Jan 2021
    Posts
    5
    Post Thanks / Like

    Default Re: Vixen Lights multiple ws2811 led strings arduino uno

    Quote Originally Posted by MikeKrebs View Post
    When you say different sequences, are you talking about running vixen twice or just doing something different for each string within the existing sequences? In case one, yes you need different controllers. In case two, no. So, in vixen, you just increase the number of outputs for your existing controller setup. Each string is not a separate controller. In your sketch you just take the first 300 channels and output on pin x, then take the next 300 channels and output on pin y, etc

    But...at some point you will overrun the capability of the serial port to support all the channels and the speed of the arduino to get the bytes and output the data. But you can just keep increasing the number until you run out of steam.
    Is the code below something well on the way?

    // Output
    int Chan1 = 2; // LED, connected to digital pin 2
    //int Chan2 = 3; // LED, connected to digital pin 3
    //int Chan3 = 4; // LED, connected to digital pin 4



    int i = 0; // Loop counter
    int incomingByte[]; // array to store the 12 values from the serial port

    //setup the pins/ inputs & outputs
    void setup()
    {
    Serial.begin(115200); // set up Serial at 9600 bps

    pinMode(Chan1, OUTPUT); // sets the pins as output
    //pinMode(Chan2, OUTPUT);
    //pinMode(Chan3, OUTPUT);

    }

    void loop()
    { // 300 channels are coming in to the Arduino
    if (Serial.available() >= 300) {
    // read the oldest byte in the serial buffer:
    for (int i=0; i<300; i++) {
    // read each byte
    incomingByte[i] = Serial.read();
    }

    analogWrite(Chan1, incomingByte[]); // Write current values to LED pins

    }
    }

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

    Default Re: Vixen Lights multiple ws2811 led strings arduino uno

    The last snippet of code is not even close. Don't try to do that.

    Use your existing sketch as the starting point.

    Lookup FastLed documentation and look at this page:
    https://github.com/FastLED/FastLED/b...InOneArray.ino
    That sketch is short and sweet and shows how you define the channels (num_leds) and shows how you define what goes where in the setup() section.

    Shorten your header to skip the 300 business. Just use the <<>> part (both in your sketch and in Vixen) and skip the d1,d2,d3 and the math (you will have set the num_leds in your definition section). Notice that there will not be a FastLED.addLeds in the loop...all those will be in setup.

    Give that a try and see how you are getting along. If it appears you are lagging or missing data, try increasing the speed on the serial port.

  8. #8
    Join Date
    Jan 2021
    Posts
    5
    Post Thanks / Like

    Default Re: Vixen Lights multiple ws2811 led strings arduino uno

    Last days I've spending some hours of trying to get the code work. But I still ran into some faults. In the setup I'm telling the Arduino which pin to use,
    how many leds there are and that I'm using WS2811 leds (WS2812B). In the loop tag I'm getting the serial output of Vixen.
    In Vixen I use >><< as header as you said without any number of leds.

    I think I'm almost there but can't figure out what I'm doing wrong.

    #include <FastLED.h>

    #define NUM_STRIPS 3
    #define NUM_LEDS_PER_STRIP 50
    #define NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS

    CRGB leds[NUM_LEDS];


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



    // tell FastLED there's 50 NEOPIXEL leds on pin 2, starting at index 0 in the led array
    FastLED.addLeds<WS2812B, 2>(leds, 0, NUM_LEDS_PER_STRIP);

    // tell FastLED there's 50 NEOPIXEL leds on pin 3, starting at index 60 in the led array
    FastLED.addLeds<WS2812B, 3>(leds, NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);

    // tell FastLED there's 50 NEOPIXEL leds on pin 4, starting at index 120 in the led array
    FastLED.addLeds<WS2812B, 4>(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);

    //FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, num_leds);



    }

    void loop() {

    for(int i = 0; i < NUM_LEDS; i++) {



    while(!Serial.available());
    if(Serial.read() != '>') {
    continue;
    }
    //second character
    while(!Serial.available());
    if(Serial.read() != '>') {
    continue;
    }
    //get the end of the header
    while(!Serial.available());
    if(Serial.read() != '<') {
    continue;
    }
    while(!Serial.available());
    if(Serial.read() != '<') {
    continue;
    }

    do {
    while(!Serial.available());
    leds[i].r = Serial.read();
    while(!Serial.available());
    leds[i].g = Serial.read();
    while(!Serial.available());
    leds[i].b = Serial.read();
    }

    FastLED.show();
    }

    }

  9. #9
    Join Date
    Jan 2021
    Posts
    29
    Post Thanks / Like

    Default Re: Vixen Lights multiple ws2811 led strings arduino uno

    in vixen dor the header wen you use >><<
    try like this >>350<< for 350 leds
    if less then 100 lokks like this >>050<<

    Sent from my SM-N975U using Tapatalk

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

    Default Re: Vixen Lights multiple ws2811 led strings arduino uno

    That sketch looks pretty good.

    fastled.show looks like it is in the for loop? Move it to after you have all the data.

    What is the issue you are having? Are you getting any pixels to light up? They appear random? You can't get a string to show?

    You did connect ground from the Arduino to all the pixel strings/strips?

Page 1 of 2 12 LastLast

Tags for this Thread

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
  •