Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 35

Thread: Xlights with ESP2866 NodeMCU

  1. #21
    Join Date
    Oct 2011
    Location
    Batesburg, SC
    Posts
    89
    Post Thanks / Like

    Default Re: Xlights with ESP2866 NodeMCU

    I've been following your progress. I am impressed. I am wondering how many universes you can push out of multiple outputs before any noticable slowdowns.

    Last year, I had 5 mini-trees, each with 50 pixels, all running from an Arduino Nano. FastLED split the outputs up among 5 outputs. I had that max485 convertor, and a cheap 485 serial adapter on the PC. It ran fine, but I've been trying to adapt and upgrade.

    I'd like to start with a program like this, but split each universe into 3 outputs(50 each for my mini trees). My other option is to daisy-chain the trees in groups of 3.

    Please share your completed code.

    Sent from my XT1254 using Tapatalk

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

    Default Re: Xlights with ESP2866 NodeMCU

    Quote Originally Posted by jcasterline View Post
    I've been following your progress. I am impressed. I am wondering how many universes you can push out of multiple outputs before any noticable slowdowns.

    Last year, I had 5 mini-trees, each with 50 pixels, all running from an Arduino Nano. FastLED split the outputs up among 5 outputs. I had that max485 convertor, and a cheap 485 serial adapter on the PC. It ran fine, but I've been trying to adapt and upgrade.

    I'd like to start with a program like this, but split each universe into 3 outputs(50 each for my mini trees). My other option is to daisy-chain the trees in groups of 3.

    Please share your completed code.

    Sent from my XT1254 using Tapatalk
    A fellow DiYc member pointed out that the wemos d1 is a better and cheaper option than the nodemcu . I switched and have been impressed with it's smaller size and performance so far .
    If you plan to go wireless I recommend them also .
    Your tree setup would be quite straight forward with 300 pixels over 2 universes using only 2 outputs .

    The 1st code in post #7 would be sufficient for your trees .
    Last edited by angus40; 08-17-2019 at 11:14 PM.

  3. #23
    Join Date
    Oct 2011
    Location
    Batesburg, SC
    Posts
    89
    Post Thanks / Like

    Default Re: Xlights with ESP2866 NodeMCU

    Thanks for your reply.
    I've got a few D1 mini's. They are neat.
    Also have the UNO version, and a bunch of the ESP01's.

    I just ordered a bunch of the NodeMCU's from a guy on eBay. They were part of a PS4 firmware hack that got abandoned. I ordered 8 for less than $4 each, free shipping. Considering getting some more.


    Sent from my XT1254 using Tapatalk

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

    Default Re: Xlights with ESP2866 NodeMCU

    That is a great buy . Have you programmed and put the D1 or 01's to use ?
    With the use of Forkineye's firmware and examples , you can't go wrong .
    Absolutely fun to experiment with .
    Last edited by angus40; 08-18-2019 at 03:25 PM.

  5. #25
    Join Date
    Oct 2011
    Location
    Batesburg, SC
    Posts
    89
    Post Thanks / Like

    Default Re: Xlights with ESP2866 NodeMCU

    I have a D1 mini and an UNO sized(D1 R2?) In enclosures with small power supplies.
    I got a batch of 01's with the weird flash chip, so they are gonna end up in my home-automation projects.


    Sent from my XT1254 using Tapatalk

  6. #26
    Join Date
    Oct 2015
    Location
    Hastings, New Zealand
    Posts
    42
    Post Thanks / Like

    Default Re: Xlights with ESP2866 NodeMCU

    Time for an update

    I still had issues with the channel numbers so I decided to do this:
    Have the code in the sketch like this
    new channel code.png

    Then the universe config like this:
    new channel code 2.png

    And xlights like this:
    lights universes.png

    and I tested with all 4 sets of LED strips and the star and it worked perfect, save for some power injection.

    I did notice it was a little laggy on some on the effects, so just for the fun of it I used my D1 mini and if fixed the lag.
    This little board performs better than the Node MCU (as it was mentioned above) I think especially for the longer runs of lights.

  7. #27
    Join Date
    Dec 2011
    Posts
    6,010
    Post Thanks / Like

    Default Re: Xlights with ESP2866 NodeMCU

    I corrected post #20 lack of accounting for unused pixels .

  8. #28
    Join Date
    Oct 2011
    Location
    Batesburg, SC
    Posts
    89
    Post Thanks / Like

    Default Re: Xlights with ESP2866 NodeMCU

    I'm still wrapping my head around the code here....
    The channel_start variable, is that an absolute channel? Or just the first channel in that particular universe?
    If I were to use this code, starting at universe 11, would my start_channel be 1 or more like 5101?

    Sent from my XT1254 using Tapatalk

  9. #29
    Join Date
    Dec 2011
    Posts
    6,010
    Post Thanks / Like

    Default Re: Xlights with ESP2866 NodeMCU

    You can always start at channel 1 if you like for each universe , unless you are spanning universes with a long chain of pixels and a single controller's output.

    It comes down to how your actual lights are wired , the sequencer would liked keep track of configuration 1 >>> xxxxxxxxxx.

    1 universe =170 pixels =510 channels >> in universe 2 in consecutive order is channel 511 for example .
    unless serial/dmx then = 512 channels

    example: if you only use 150 pixels in universe 1 = 450 channels the remaining 60 channels need accounting for .

    I am probably not explaining this clearly , but if you have some pixels just connect up 2 outputs and experiment .
    Its a great learn
    Last edited by angus40; 08-21-2019 at 10:32 PM.

  10. #30
    Join Date
    Oct 2015
    Location
    Hastings, New Zealand
    Posts
    42
    Post Thanks / Like

    Default Re: Xlights with ESP2866 NodeMCU

    I'm still working with this and expanding the code. (incase someone finds it useful)
    I've added support to convert the RX and TX pins into output channels. Known as G and H in the code.
    I also added Mac address output for the serial output to use in my router.


    If compiled without errors, so hopefully it works in real life with the extra pins.
    I'll let you know when I test them.

    The only issue I have is the static IP won't stick. The Ip keeps changing in the serial output. (I'm using Unicast. Should I be using multi cast?)
    Router settings:
    router settings.png

    Code:
     
    /*
    * ESP8266_NeoPixel.ino - Simple sketch to listen for E1.31 data on an ESP8266
    * and drive WS2811 LEDs using the NeoPixel Library
    *
    * == Requires Adafruit_NeoPixel - http://github.com/adafruit/Adafruit_NeoPixel
    *
    * Project: E131 - E.131 (sACN) library for Arduino
    * Copyright (c) 2015 Shelby Merrick
    * http://www.forkineye.com
    *
    * This program is provided free for you to use in any way that you wish,
    * subject to the laws and regulations where you are using it. Due diligence
    * is strongly suggested before using this code. Please give credit where due.
    *
    * The Author makes no warranty of any kind, express or implied, with regard
    * to this program or the documentation contained in this document. The
    * Author shall not be liable in any event for incidental or consequential
    * damages in connection with, or arising out of, the furnishing, performance
    * or use of these programs.
    *
    */
    
    #include <ESP8266WiFi.h>
    #include <E131.h>
    #include <Adafruit_NeoPixel.h>
    
    #define LOG_PORT Serial /* Serial port for console logging */
    #define CONNECT_TIMEOUT 15000 /* 15 seconds */
    
    #define NUM_PIXELS_A 600 /* roof Number of pixels */
    #define UNIVERSE 1 /* Universe to listen for */
    #define CHANNEL_START_A 1 /* Channel to start listening at */
    #define DATA_PIN_A 5 /* Pixel output - GPIO5 / nodeMCU D1 */
    
    #define NUM_PIXELS_B 123/* star Number of pixels */
    #define UNIVERSE 5 /* Universe to listen for */
    #define CHANNEL_START_B 1/* Channel to start listening at */
    #define DATA_PIN_B 4 /* Pixel output - GPIO4 / nodeMCU D2 */
    
    #define NUM_PIXELS_C 150 /* Veranda Number of pixels */
    #define UNIVERSE 6/* Universe to listen for */
    #define CHANNEL_START_C 1 /* Channel to start listening at */
    #define DATA_PIN_C 14 /* Pixel output - GPI14 / nodeMCU D5 */
    
    #define NUM_PIXELS_D 150 /* Number of pixels */
    #define UNIVERSE 7 /* Universe to listen for */
    #define CHANNEL_START_D 2620 /* Channel to start listening at */
    #define DATA_PIN_D 12 /* Pixel output - GPI12 / nodeMCU D6 */
    
    #define NUM_PIXELS_E 150 /* Number of pixels */
    #define UNIVERSE 8 /* Universe to listen for */
    #define CHANNEL_START_E 3070 /* Channel to start listening at */
    #define DATA_PIN_E 13 /* Pixel output - GPI13 / nodeMCU D7 */
    
    #define NUM_PIXELS_F 150 /* Number of pixels */
    #define UNIVERSE 9 /* Universe to listen for */
    #define CHANNEL_START_F 3601 /* Channel to start listening at */
    #define DATA_PIN_F 15 /* Pixel output - GPI15 / nodeMCU D8 */
    
    #define NUM_PIXELS_G 150 /* Number of pixels */
    #define UNIVERSE 10 /* Universe to listen for */
    #define CHANNEL_START_G 3601 /* Channel to start listening at */
    #define DATA_PIN_G 1 /* Pixel output - GPI01 / nodeMCU TX */
    
    #define NUM_PIXELS_H 150 /* Number of pixels */
    #define UNIVERSE 11 /* Universe to listen for */
    #define CHANNEL_START_H 3601 /* Channel to start listening at */
    #define DATA_PIN_H 3 /* Pixel output - GPI03 / nodeMCU RX */
    
    const char ssid[] = "HIDDEN)"; /* Replace with your SSID */
    const char passphrase[] = "HIDDEN)"; /* Replace with your WPA2 passphrase */
    
    IPAddress ip(HIDDEN); //set static ip
    IPAddress gateway(HIDDEN)); //set getteway
    IPAddress subnet(255, 255, 255, 0);//set subnet
    
    E131 e131;
    
    Adafruit_NeoPixel pixels_a = Adafruit_NeoPixel(NUM_PIXELS_A, DATA_PIN_A, NEO_BRG + NEO_KHZ800);
    Adafruit_NeoPixel pixels_b = Adafruit_NeoPixel(NUM_PIXELS_B, DATA_PIN_B, NEO_BRG + NEO_KHZ800);
    Adafruit_NeoPixel pixels_c = Adafruit_NeoPixel(NUM_PIXELS_C, DATA_PIN_C, NEO_BRG + NEO_KHZ800);
    Adafruit_NeoPixel pixels_d = Adafruit_NeoPixel(NUM_PIXELS_D, DATA_PIN_D, NEO_BRG + NEO_KHZ800);
    Adafruit_NeoPixel pixels_e = Adafruit_NeoPixel(NUM_PIXELS_E, DATA_PIN_E, NEO_BRG + NEO_KHZ800);
    Adafruit_NeoPixel pixels_f = Adafruit_NeoPixel(NUM_PIXELS_F, DATA_PIN_F, NEO_BRG + NEO_KHZ800);
    Adafruit_NeoPixel pixels_g = Adafruit_NeoPixel(NUM_PIXELS_G, DATA_PIN_G, NEO_BRG + NEO_KHZ800);
    Adafruit_NeoPixel pixels_h = Adafruit_NeoPixel(NUM_PIXELS_H, DATA_PIN_H, NEO_BRG + NEO_KHZ800);
    
    int initWifi() {
    /* Switch to station mode and disconnect just in case */
    WiFi.mode(WIFI_STA);
    WiFi.disconnect();
    delay(secureRandom(100,500));
    
    
    LOG_PORT.println("");
    LOG_PORT.print(F("Connecting to "));
    LOG_PORT.println(ssid);
    WiFi.begin(ssid, passphrase);
    { 
       Serial.begin(115200);
       delay(500); 
       Serial.println();
       Serial.print("MAC: ");
       Serial.println(WiFi.macAddress());
     
    }
    
    uint32_t timeout = millis();
    while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    LOG_PORT.print(".");
    if (millis() - timeout > CONNECT_TIMEOUT) {
    LOG_PORT.println("");
    LOG_PORT.println(F("*** Failed to connect ***"));
    break;
    }
    }
    
    if (WiFi.status() == WL_CONNECTED) {
    LOG_PORT.println("");
    LOG_PORT.print(F("Connected with IP: "));
    LOG_PORT.println(WiFi.localIP());
    
    //e131.begin(E131_MULTICAST, UNIVERSE_A, UNIVERSE_B - UNIVERSE_A + 1);
    }
    
    return WiFi.status();
    }
    
    void setup() {
        Serial.begin(115200);
        delay(10);
    
        // Initial pin states
        pinMode(DATA_PIN_A, OUTPUT);
        digitalWrite(DATA_PIN_A, LOW);
        pinMode(DATA_PIN_B, OUTPUT);
        digitalWrite(DATA_PIN_B, LOW);
        pinMode(DATA_PIN_G, OUTPUT);
        digitalWrite(DATA_PIN_G, LOW);
        pinMode(DATA_PIN_H, OUTPUT);
        digitalWrite(DATA_PIN_H, LOW);
        
      //********************* CHANGE PIN FUNCTION **********************
    
        pinMode(DATA_PIN_G, FUNCTION_3); //GPIO 1 swap the pin to a GPIO.
        pinMode(DATA_PIN_H, FUNCTION_3); //GPIO 3 swap the pin to a GPIO.
      //****************************************************************
        
    
    /* Choose one to begin listening for E1.31 data */
    e131.begin(ssid, passphrase); /* via Unicast on the default port */
    //e131_a.beginMulticast(ssid, passphrase, UNIVERSE_A); /* via Multicast for Universe 1 */
    initWifi();
    
    /* Initialize output */
    pixels_a.begin();
    pixels_a.show();
    pixels_b.begin();
    pixels_b.show();
    pixels_c.begin();
    pixels_c.show();
    pixels_d.begin();
    pixels_d.show();
    pixels_e.begin();
    pixels_e.show();
    pixels_f.begin();
    pixels_f.show();
    pixels_g.begin();
    pixels_g.show();
    pixels_h.begin();
    pixels_h.show();
    }
    
    void loop() {
    /* Parse a packet and update pixels */
    if(e131.parsePacket())
    {
    if (e131.universe == 1) {
    for (int i = 0; i < NUM_PIXELS_A; i++) {
    int j = i * 3 + (CHANNEL_START_A - 1);
    pixels_a.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2]);
    }
    pixels_a.show();
    }
    if (e131.universe == 5) {
    for (int i = 0; i < NUM_PIXELS_B; i++) {
    int j = i * 3 + (CHANNEL_START_B - 1);
    pixels_b.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2]);
    }
    pixels_b.show();
    }
    if (e131.universe == 6) {
    for (int i = 0; i < NUM_PIXELS_C; i++) {
    int j = i * 3 + (CHANNEL_START_C - 1);
    pixels_c.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2]);
    }
    pixels_c.show();
    }
    if (e131.universe == 7) {
    for (int i = 0; i < NUM_PIXELS_D; i++) {
    int j = i * 3 + (CHANNEL_START_D - 1);
    pixels_d.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2]);
    }
    pixels_d.show();
    }
    if (e131.universe == 8) {
    for (int i = 0; i < NUM_PIXELS_E; i++) {
    int j = i * 3 + (CHANNEL_START_E - 1);
    pixels_e.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2]);
    }
    pixels_e.show();
    }
    if (e131.universe == 9) {
    for (int i = 0; i < NUM_PIXELS_F; i++) {
    int j = i * 3 + (CHANNEL_START_F - 1);
    pixels_f.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2]);
    }
    pixels_f.show();
    }
    if (e131.universe == 10) {
    for (int i = 0; i < NUM_PIXELS_G; i++) {
    int j = i * 3 + (CHANNEL_START_G - 1);
    pixels_g.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2]);
    }
    pixels_g.show();
    }
    if (e131.universe == 11) {
    for (int i = 0; i < NUM_PIXELS_H; i++) {
    int j = i * 3 + (CHANNEL_START_H - 1);
    pixels_h.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2]);
    }
    pixels_h.show();
    }
    }
    }
    Last edited by nzchristmas.nz; 08-27-2019 at 07:14 AM.

Page 3 of 4 FirstFirst 1234 LastLast

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
  •