Results 1 to 9 of 9

Thread: config for Nodemcu with multiple strands on same pin

  1. #1
    Join Date
    Jan 2019
    Posts
    4
    Post Thanks / Like

    Default config for Nodemcu with multiple strands on same pin

    Hi, new member here with a basic question. I setup a nodemcu with a 5v WS8212B strip of 150 pixels using the following code:

    Code:
    #include <ESP8266WiFi.h>
    #include <E131.h>
    #include <Adafruit_NeoPixel.h>
    
    #define NUM_PIXELS 150   /* Number of pixels */
    #define UNIVERSE 1   /* Universe to listen for */
    #define CHANNEL_START 1   /* Channel to start listening at */
    #define DATA_PIN 2  /* Pixel output - GPIO 2 */
    
    const char ssid[] = "xxx";   /* Replace with your SSID */
    const char passphrase[] = "xxx";    /* Replace with your WPA2 passphrase */
    
    E131 e131;
    
    Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUM_PIXELS, DATA_PIN, NEO_GRB + NEO_KHZ800);
    Adafruit_NeoPixel pixels_b = Adafruit_NeoPixel(NUM_PIXELS_B, DATA_PIN_B, NEO_GRB + NEO_KHZ800);
    
    void setup() {
        Serial.begin(115200);
        delay(10);
    
        // Initial pin states
        pinMode(DATA_PIN, OUTPUT);
        digitalWrite(DATA_PIN, LOW);
         
    
        /* Choose one to begin listening for E1.31 data */
        e131.begin(ssid, passphrase);   /* via Unicast on the default port */
    
        /* Initialize output */
        pixels.begin();
        pixels.show();
    }
    
    void loop() {
        /* Parse a packet and update pixels */
        if(e131.parsePacket()) {
            if (e131.universe == 1) {
                for (int i = 0; i < NUM_PIXELS; i++) {
                    int j = i * 3 + (CHANNEL_START - 1);
                    pixels.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2]);
                }
                pixels.show();
     
            }
        }
    }

    I added the network setup to xLights and run a successful test chase to verify all pixels light up.

    Annotation 2019-12-04 213223.jpg

    That part works great! However what I'd like to do is run 2 strips of 150 pixels each off a single port on the nodemcu, but I'm not sure what needs to be done in code on the nodemcu and xLights to support that. I tried changing the NUM_PIXELS to 300, but that didn't work out. I tried specifying another universe (2), but couldn't get the settings right to make it work. Can someone point me in the right direction?

    Thanks,
    Doug

  2. #2
    Join Date
    Dec 2011
    Posts
    6,100
    Post Thanks / Like

    Default Re: config for Nodemcu with multiple strands on same pin

    Hi , I haven't tested this but it does compile

    Code:
    #include <ESP8266WiFi.h>
    #include <E131.h>
    #include <Adafruit_NeoPixel.h>
    
    #define NUM_PIXELS 150   /* Number of pixels */
    #define UNIVERSE 1   /* Universe to listen for */
    #define CHANNEL_START 1   /* Channel to start listening at */
    
    #define NUM_PIXELS_B 150   /* Number of pixels */
    #define UNIVERSE 2   /* Universe to listen for */
    #define CHANNEL_START 451   /* Channel to start listening at */
    
    #define DATA_PIN 2  /* Pixel output - GPIO 2 */
    
    const char ssid[] = "xxx";   /* Replace with your SSID */
    const char passphrase[] = "xxx";    /* Replace with your WPA2 passphrase */
    
    E131 e131;
    
    Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUM_PIXELS, DATA_PIN, NEO_GRB + NEO_KHZ800);
    Adafruit_NeoPixel pixels_b = Adafruit_NeoPixel(NUM_PIXELS_B, DATA_PIN, NEO_GRB + NEO_KHZ800);
    
    void setup() {
        Serial.begin(115200);
        delay(10);
    
        // Initial pin states
        pinMode(DATA_PIN, OUTPUT);
        digitalWrite(DATA_PIN, LOW);
         
    
        /* Choose one to begin listening for E1.31 data */
        e131.begin(ssid, passphrase);   /* via Unicast on the default port */
    
        /* Initialize output */
        pixels.begin();
        pixels.show();
        pixels_b.begin();
        pixels_b.show();
    }
    
    void loop() {
        /* Parse a packet and update pixels */
        if(e131.parsePacket()) {
            if (e131.universe == 1) {
                for (int i = 0; i < NUM_PIXELS; i++) {
                    int j = i * 3 + (CHANNEL_START - 1);
                    pixels.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2]);
                }
                pixels.show();
          
               }
          
            if (e131.universe == 2) {
                for (int i = 0; i < NUM_PIXELS; i++) {
                    int j = i * 3 + (CHANNEL_START - 451);
                    pixels_b.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2]);
                }
                pixels_b.show();
          
            }
        }
    }

  3. #3
    Join Date
    Jan 2019
    Posts
    4
    Post Thanks / Like

    Default Re: config for Nodemcu with multiple strands on same pin

    Thanks for trying, unfortunately it didn't work. It keeps flashing the first string, and doesn't light up the second string.

  4. #4
    Join Date
    Dec 2011
    Posts
    6,100
    Post Thanks / Like

    Default Re: config for Nodemcu with multiple strands on same pin

    take 2 , this may need a universe count added.
    unfortunately I haven't tried to get more than one universe on a single pin.
    You could load EspixelStick firmware .

    Code:
    #include <ESP8266WiFi.h>
    #include <E131.h>
    #include <Adafruit_NeoPixel.h>
    
    #define NUM_PIXELS 300   /* Number of pixels */
    #define UNIVERSE 1   /* Universe to listen for */
    #define CHANNEL_START 1   /* Channel to start listening at */
    
    
    #define UNIVERSE 2   /* Universe to listen for */
    #define CHANNEL_START 451   /* Channel to start listening at */
    
    #define DATA_PIN 2  /* Pixel output - GPIO 2 */
    
    const char ssid[] = "xxx";   /* Replace with your SSID */
    const char passphrase[] = "xxx";    /* Replace with your WPA2 passphrase */
    
    E131 e131;
    
    Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUM_PIXELS, DATA_PIN, NEO_GRB + NEO_KHZ800);
    
    void setup() {
        Serial.begin(115200);
        delay(10);
    
        // Initial pin states
        pinMode(DATA_PIN, OUTPUT);
        digitalWrite(DATA_PIN, LOW);
         
    
        /* Choose one to begin listening for E1.31 data */
        e131.begin(ssid, passphrase);   /* via Unicast on the default port */
    
        /* Initialize output */
        pixels.begin();
        pixels.show();
    
    }
    
    void loop() {
        /* Parse a packet and update pixels */
        if(e131.parsePacket()) {
            if (e131.universe == 1) {
                for (int i = 0; i < NUM_PIXELS; i++) {
                    int j = i * 3 + (CHANNEL_START - 1);
                    pixels.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2]);
                }
                pixels.show();
          
               }
          
            if (e131.universe == 2) {
                for (int i = 0; i < NUM_PIXELS; i++) {
                    int j = i * 3 + (CHANNEL_START - 451);
                    pixels.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2]);
                }
                pixels.show();
          
            }
        }
    }
    Last edited by angus40; 12-05-2019 at 12:13 AM.

  5. #5
    Join Date
    Dec 2011
    Posts
    6,100
    Post Thanks / Like

    Default Re: config for Nodemcu with multiple strands on same pin

    Try Multicast . I added it in your code , also a correction


    Code:
    #include <ESP8266WiFi.h>
    #include <E131.h>
    #include <Adafruit_NeoPixel.h>
    
    #define NUM_PIXELS 150   /* Number of pixels */
    #define UNIVERSE 1   /* Universe to listen for */
    #define CHANNEL_START 1   /* Channel to start listening at */
    
    #define NUM_PIXELS_B 150   /* Number of pixels */
    #define UNIVERSE 2   /* Universe to listen for */
    #define CHANNEL_START 451   /* Channel to start listening at */
    
    #define DATA_PIN 2  /* Pixel output - GPIO 2 */
    
    const char ssid[] = "xxx";   /* Replace with your SSID */
    const char passphrase[] = "xxx";    /* Replace with your WPA2 passphrase */
    
    E131 e131;
    
    Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUM_PIXELS, DATA_PIN, NEO_GRB + NEO_KHZ800);
    Adafruit_NeoPixel pixels_b = Adafruit_NeoPixel(NUM_PIXELS_B, DATA_PIN, NEO_GRB + NEO_KHZ800);
    
    void setup() {
        Serial.begin(115200);
        delay(10);
    
        // Initial pin states
        pinMode(DATA_PIN, OUTPUT);
        digitalWrite(DATA_PIN, LOW);
         
    
        /* Choose one to begin listening for E1.31 data */
      //  e131.begin(ssid, passphrase);   /* via Unicast on the default port */
       e131.beginMulticast(ssid, passphrase, (UNIVERSE)); /* via Multicast for Universe 1 */
        /* Initialize output */
        pixels.begin();
        pixels.show();
        pixels_b.begin();
        pixels_b.show();
    }
    
    void loop() {
        /* Parse a packet and update pixels */
        if(e131.parsePacket()) {
            if (e131.universe == 1) {
                for (int i = 0; i < NUM_PIXELS; i++) {
                    int j = i * 3 + (CHANNEL_START - 1);
                    pixels.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2]);
                }
                pixels.show();
    			
    	    }
    			
            if (e131.universe == 2) {
                for (int i = 0; i < NUM_PIXELS_B; i++) {  // I forgot the _B
                    int j = i * 3 + (CHANNEL_START - 451);
                    pixels_b.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2]);
                }
                pixels_b.show();
    			
            }
        }
    }
    Last edited by angus40; 12-05-2019 at 01:58 AM.

  6. #6
    Join Date
    Jan 2019
    Posts
    4
    Post Thanks / Like

    Default Re: config for Nodemcu with multiple strands on same pin

    I was able to get the ESPixelStick firmware installed and that is working great- it sees both universes. Thank you for your help!

  7. #7
    Join Date
    Nov 2015
    Posts
    33
    Post Thanks / Like

    Default Re: config for Nodemcu with multiple strands on same pin

    Were you able to find a How to? ESPixelStick firmware to NodeMCU? I can't seem to find anything on it.

    Quote Originally Posted by dhenning View Post
    I was able to get the ESPixelStick firmware installed and that is working great- it sees both universes. Thank you for your help!

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

    Default Re: config for Nodemcu with multiple strands on same pin

    ESPixelStick code is an arduino sketch designed to run on ESP8266 based platforms. The nodeMCU devices I have seen are typically ESP8266-12 based platforms. As long as you are using an ESP8266 based platform, the ESPixelStick sketch can be compiled to work on it.


    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

  9. #9
    Join Date
    Jan 2019
    Posts
    4
    Post Thanks / Like

    Default Re: config for Nodemcu with multiple strands on same pin

    I don't remember where I found the info, but here are the steps I took. I am on a Windows 10 PC, not sure what changes are required if any for a Mac or other OS. I used the pre-compiled firmware on a stock NodeMCU V3 so I didn't have to compile anything, and it worked fine.

    1. Download the firmware from the Github page: https://github.com/forkineye/ESPixel...eases/tag/v3.0

    You only need to download the zip file (ESPixelStick_Firmware-3.0.zip), then extract to a directory.

    2. Plug in your NodeMCU with the USB cable to your PC (hold down the "Flash" button as you plug it in to put it into flash mode.)

    3. From a command prompt, run the EspFlashTool that's in the root of the unzipped directory (make sure you have java installed):

    java -jar ESPSFlashTool.jar

    4. It will open a dialog box- fill in your wifi info, hostname, etc. It should fill in the Firmware and Serial Port automatically.

    5. When you're ready, just click "Upload". It should take about a minute to flash, then check the Serial Output window to find the IP address it assigned.

    6. Open up that IP in your browser, and you should see a ESPixelStick status page. Use the Device Setup tab to configure your pixel setup.

    That's it!

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
  •