Results 1 to 9 of 9

Thread: arduino with vixen 3 and fpp

  1. #1
    Join Date
    Oct 2018
    Location
    ohio
    Posts
    9
    Post Thanks / Like

    Exclamation arduino with vixen 3 and fpp

    Ok i am new to this but have a good idea how things work. I plan on starting out small this year and plan to grow next year if all goes well. So my plan is to just start with doing our christmas tree indoors then start making things for outdoors the following year. So here is what i have for the tree right now, 4 strings of 50 nodes each ws2811 leds, arduino mega 2560 and raspberry pi 3b+ with falcon player installed. I have downloaded vixen 3 for the sequencing. Ok now that that is out of the way lets start with first problem i have. I uploaded victors sketch to arduino with no problems. The code is below., so that sketch has random and all and i see the redd light come on and all so i plug my data wire from led into pin 2 and my lights do nothing. I know my lights work and all because i have a sketch that does 12 modes and works great. Im sure when i get the lights to work i can get the rest set up but got to get the lights to work. Any help would be appreciated

    Code:
    // Copy from this line down to your new sketch
     // This code was written by Victor Perez for doityourselfchristmas.com based on the code from Zparticle, Si_champion and Neil Tapp.
     // To adapt the code to your case, just change this top section, with the #define lines.
     // how many channels will vixen be sending. Can be set to any number from 1 to 48 for Arduino Mega, and 1 to 18 for Arduino Uno.
     
     #define CHANNEL_COUNT 46
    
     // speed for the com port for talking with vixen. From 9600 to 115200. Use the same speed as set in Vixen.
     #define VIXEN_COM_SPEED 57600
     
     // Timeout waiting for serial input before going to random mode (in milliseconds).
     #define TIME_OUT 2000
     
     // If the relays turn On and Off opposite to Vixen sequence, change "#define MODE NOT_INVERTED" for "#define MODE INVERTED"
     #define NOT_INVERTED 0
     #define INVERTED 1
     #define MODE NOT_INVERTED
    
     // which pins control which channels
     // You can change these assignment to use different pins, but be very careful to not repeat the same pin number for 2 channels. 
    #define CH01 2 // PWM Pin 2
    #define CH02 3 // PWM Pin 3
    #define CH03 4 // PWM Pin 4
    #define CH04 5 // PWM Pin 5
    #define CH05 6 // PWM Pin 6
    #define CH06 7 // PWM Pin 7
    #define CH07 8 // PWM Pin 8
    #define CH08 9 // PWM Pin 9
    #define CH09 10 // PWM Pin 10
    #define CH10 11 // PWM Pin 11
    #define CH11 12 // PWM Pin 12
    #define CH12 13 // PWM Pin 13
    // digital pin - connects to relay board
    #define CH13 14 // DIGITAL Pin 14
    #define CH14 15 // DIGITAL Pin 15
    #define CH15 16 // DIGITAL Pin 16
    #define CH16 17 // DIGITAL Pin 17
    #define CH17 18 // DIGITAL Pin 18
    #define CH18 19 // DIGITAL Pin 19
    #define CH19 20 // DIGITAL Pin 20
    #define CH20 21 // DIGITAL Pin 21
    #define CH21 22 // DIGITAL Pin 22
    #define CH22 23 // DIGITAL Pin 23
    #define CH23 24 // DIGITAL Pin 24
    #define CH24 25 // DIGITAL Pin 25
    #define CH25 26 // DIGITAL Pin 26
    #define CH26 27 // DIGITAL Pin 27
    #define CH27 28 // DIGITAL Pin 28
    #define CH28 29 // DIGITAL Pin 29
    #define CH29 30 // DIGITAL Pin 30
    #define CH30 31 // DIGITAL Pin 31
    #define CH31 32 // DIGITAL Pin 32
    #define CH32 33 // DIGITAL Pin 33
    #define CH33 34 // DIGITAL Pin 34
    #define CH34 35 // DIGITAL Pin 35
    #define CH35 36 // DIGITAL Pin 36
    #define CH36 37 // DIGITAL Pin 37
    #define CH37 38 // DIGITAL Pin 38
    #define CH38 39 // DIGITAL Pin 39
    #define CH39 40 // DIGITAL Pin 40
    #define CH40 41 // DIGITAL Pin 41
    #define CH41 42 // DIGITAL Pin 42
    #define CH42 43 // DIGITAL Pin 43
    #define CH43 44 // DIGITAL Pin 44
    #define CH44 45 // DIGITAL Pin 45
    #define CH45 46 // DIGITAL Pin 46
    #define CH46 47 // DIGITAL Pin 47
     
     int channels[] = {CH01,CH02,CH03,CH04,CH05 ,CH06,CH07,CH08,CH09,
     CH10,CH11,CH12,CH13,CH14,CH15,CH16,CH17,CH18,CH19,CH20,CH21,CH22,
     CH23,CH24,CH25,CH26,CH27,CH28,CH29,CH30,CH31,CH32,CH33,CH34,CH35,
     CH36,CH37,CH38,CH39,CH40,CH41,CH42,CH43,CH44,CH45,CH46};
    
     int incomingByte[CHANNEL_COUNT];
    
    int i = 0;     // Loop counter
    volatile unsigned long  timer_a = 0; // new line
    
    //setup the pins/ inputs & outputs
    void setup(){
    
      // specifically for the UNO
      sei();  
    
    // initalize PWM Channels / Pins
     for (i=0; i < CHANNEL_COUNT; i++){
        pinMode(channels[i], OUTPUT);
      }
    
    // set all the relays to off to start with
    if (MODE == NOT_INVERTED) {
     for (i=0; i < CHANNEL_COUNT; i++){
          digitalWrite(channels[i], LOW);
    
     }
    }
    
    else {
     for (i=0; i < CHANNEL_COUNT; i++){
          digitalWrite(channels[i], HIGH);
     }
    }
    
     testSequence();
     
    // set up Serial according to the speed defined above.
      Serial.begin(VIXEN_COM_SPEED);
    }
    
    void loop()
    {
       if (Serial.available() >= (CHANNEL_COUNT+2)) {
       timer_a = millis (); // new line
      
             for (i=0; i < CHANNEL_COUNT; i++) {
                 // read each byte
              incomingByte[i] = Serial.read();
             }
    		 if (MODE == NOT_INVERTED) {
    			for (i=0; i < CHANNEL_COUNT; i++){
    			int value = incomingByte[i];
    			if (value <= 127) {
    				 digitalWrite(channels[i], LOW);
    			}
    			else {
    				 digitalWrite(channels[i], HIGH);
    			}
    			}
    		 }
    		 else {
    		 for (i=0; i < CHANNEL_COUNT; i++){
    			int value = incomingByte[i];
    			if (value <= 127) {
    				 digitalWrite(channels[i], HIGH);
    			}
    			else {
    				 digitalWrite(channels[i], LOW);
    			}
    			}
    		 }
       }
    // Random mode code. Random mode starts if no serial input has been received in TIME_OUT millisenconds
       else {
         unsigned long diff = millis() - timer_a;
         if (diff >= TIME_OUT) {
           timer_a = millis ();
           int random_a = 0;
           for (i=0; i < CHANNEL_COUNT; i++){
             random_a = random(0, 2);
             if (random_a == 0) {
                digitalWrite(channels[i], LOW);
             }
             else {
                digitalWrite(channels[i], HIGH);
             }
           }
         }
       }
    }
    
    void testSequence(){
    
    if (MODE == NOT_INVERTED) {
     for (i=0; i < CHANNEL_COUNT; i++){
          digitalWrite(channels[i], HIGH);
         delay (500);
          digitalWrite(channels[i], LOW);
     }
    }
    
    else {
     for (i=0; i < CHANNEL_COUNT; i++){
          digitalWrite(channels[i], LOW);
         delay (500);
          digitalWrite(channels[i], HIGH);
       }
     }
    }

  2. #2
    Join Date
    Dec 2012
    Location
    Hudson MA
    Posts
    3,075
    Post Thanks / Like

    Default Re: arduino with vixen 3 and fpp

    You are using an almost good sketch. However, you have no code to to sync a header so even if you fix the output section, there is no way you can stay in sync with the serial stream.

    Next: WS281x devices do NOT take PWM as an input. You do not have anything that converts the Vuxen serial data to a ws281x bit stream. Many people use a fastled library to do this.

    With all that said, I would not use an arduino to drive pixels. The serial link is very limited in its ability to deliver pixel data. Look at RonPs pi hat or something similar. Two Pixel outputs that can drive at least 1200 pixels. Supposed to do more. That is all I have tested.


    2018 - Moving and going to visit my Daughter in New Zealand. Most likely I will be dark or nearly dark, Some static stuff that is simple to put up.

  3. #3
    Join Date
    Oct 2018
    Location
    ohio
    Posts
    9
    Post Thanks / Like

    Default Re: arduino with vixen 3 and fpp

    Ok so the arduino is better set up for just driving relays right? I will look at finding something different then.

  4. #4
    Join Date
    Dec 2012
    Location
    Hudson MA
    Posts
    3,075
    Post Thanks / Like

    Default Re: arduino with vixen 3 and fpp

    lots of people drive pixels using arduino. they just avoid using the serial port to deliver the data to the arduino if you want more then 200 pixels.


    2018 - Moving and going to visit my Daughter in New Zealand. Most likely I will be dark or nearly dark, Some static stuff that is simple to put up.

  5. #5
    Join Date
    Oct 2018
    Location
    ohio
    Posts
    9
    Post Thanks / Like

    Default Re: arduino with vixen 3 and fpp

    can you point me in the right direction on how that is done.

  6. #6
    Join Date
    Nov 2016
    Location
    Washington State
    Posts
    135
    Post Thanks / Like

    Default Re: arduino with vixen 3 and fpp

    Yep Arduino works great for getting started with pushing pixels from Vixen.
    Here is an old code that worked for me a couple of years ago. I eventually moved on to teensy 3.1 with an ws2811 octo. and espixel sticks because of Arduino's limitations.

    Code:
    /*
    
    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 controller 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 400
    
    // Sets the pin which is used to connect to the LED pixel strip
    #define DATA_PIN 5
    
    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!
        }
    }
    Last edited by tecnageek; 10-23-2018 at 11:39 PM. Reason: Place code in wrong place

  7. #7
    Join Date
    Dec 2012
    Location
    Hudson MA
    Posts
    3,075
    Post Thanks / Like

    Default Re: arduino with vixen 3 and fpp

    technically the esp pixel sticks were developed using the arduino code libraries. it is the serial link that becomes a bottleneck.


    2018 - Moving and going to visit my Daughter in New Zealand. Most likely I will be dark or nearly dark, Some static stuff that is simple to put up.

  8. #8
    Join Date
    Oct 2018
    Location
    ohio
    Posts
    9
    Post Thanks / Like

    Default Re: arduino with vixen 3 and fpp

    Quote Originally Posted by tecnageek View Post
    Yep Arduino works great for getting started with pushing pixels from Vixen.
    Here is an old code that worked for me a couple of years ago. I eventually moved on to teensy 3.1 with an ws2811 octo. and espixel sticks because of Arduino's limitations.

    Code:
    /*
    
    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 controller 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 400
    
    // Sets the pin which is used to connect to the LED pixel strip
    #define DATA_PIN 5
    
    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!
        }
    }
    Ok i compiled and uploaded sketch to arduino. Just a couple questions. Comments says to hook up data wire to pin 6 but code says define data pin 5. which pin do i use? The lights i have , have 50 nodes(these are the string lights) so is 1 node =3 channels so 50 nodes=150 channels. If i understand right 1 pixel consist of a red led, blue led, green led controlled by 1 chip. From what i can see the string of lights use 1 full range rbg bulb controlled by 1 chip. So am i right to think that the node is the same as a pixel.

  9. #9
    Join Date
    Oct 2018
    Location
    ohio
    Posts
    9
    Post Thanks / Like

    Default Re: arduino with vixen 3 and fpp

    Quote Originally Posted by tecnageek View Post
    Yep Arduino works great for getting started with pushing pixels from Vixen.
    Here is an old code that worked for me a couple of years ago. I eventually moved on to teensy 3.1 with an ws2811 octo. and espixel sticks because of Arduino's limitations.

    Code:
    /*
    
    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 controller 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 400
    
    // Sets the pin which is used to connect to the LED pixel strip
    #define DATA_PIN 5
    
    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!
        }
    }
    ok i uploaded the sketch with no problem. Just a couple quick questions. Comment section says pin 6 but code says pin 5. Which pin did you use? For the channels it says add 3 x pixels for channels. Doe that mean i set channels to 150 because i have a string with 50 nodes on it? I understand a pixel has 1 red, ble,green led controlled by 1 chip but the string of lights has 50 nodes which uses 1 full range led. Am i on the right track so far?

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
  •