Page 1 of 5 123 ... LastLast
Results 1 to 10 of 45

Thread: SparkFun EL Wire Sequencer Shield on Wemos D1

  1. #1
    Join Date
    Dec 2013
    Location
    Williamsburg, VA
    Posts
    917
    Post Thanks / Like

    Default SparkFun EL Wire Sequencer Shield on Wemos D1

    I thought I would move this to its own post.

    I'm able to communicate to the Wemos via wifi with E1.31 sketch below

    I need to have a static IP how can I do that? can I add a const char for the ip, gateway etc? Do I need to edit the ESP8266WiFi.h file?


    Code:
    // Wemos D1 E1.31 - 8 channel sketch for Sparkfun EL Escudo Dos shield
    //Spark Fun link https://www.sparkfun.com/products/10878
    
    #include <ESP8266WiFi.h>
    #include <E131.h> // Copyright (c) 2015 Shelby Merrick http://www.forkineye.com
    
    // ***** USER SETUP STUFF *****
    const char ssid[] = "MYWIRELESS";  // replace with your SSID.
    const char passphrase[] = "password"; // replace with your PASSWORD.
    const int universe = 1; // this sets the universe number you are using.
    
    
    // this sets the pin numbers to use as outputs.
    //for Wemos D1 R1 pins are 16,5,4,14,12,13,0,2
    //for Wemos D1 R2 pins are 16,5,4,0,2,14,12,13
    const int output_1 = 16; //the pin to use as output 1 (D0)
    const int output_2 = 5;  //the pin to use as output 2 (D1)
    const int output_3 = 4;  //the pin to use as output 3 (D2)
    const int output_4 = 14;  //the pin to use as output 4 (D3)
    const int output_5 = 12;  //the pin to use as output 5 (D4)
    const int output_6 = 13; //the pin to use as output 6 (D5)
    const int output_7 = 0; //the pin to use as output 7 (D6)
    const int output_8 = 2; //the pin to use as output 8 (D7)
    
    
    E131 e131;
    
    void setup() {
      Serial.begin(115200);
      // set the pins chosen above as outputs.
      pinMode(output_1, OUTPUT);
      pinMode(output_2, OUTPUT);
      pinMode(output_3, OUTPUT);
      pinMode(output_4, OUTPUT);
      pinMode(output_5, OUTPUT);
      pinMode(output_6, OUTPUT);
      pinMode(output_7, OUTPUT);
      pinMode(output_8, OUTPUT);
    
      // set the pins chosen above to low / off.
      digitalWrite(output_1, LOW);
      digitalWrite(output_2, LOW);
      digitalWrite(output_3, LOW);
      digitalWrite(output_4, LOW);
      digitalWrite(output_5, LOW);
      digitalWrite(output_6, LOW);
      digitalWrite(output_7, LOW);
      digitalWrite(output_8, 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 */
    }
    
    void loop() {
      /* Parse a packet */
      uint16_t num_channels = e131.parsePacket();
    
      /* Process channel data if we have it */
      if (num_channels) {
        Serial.println("we have data");
    
        digitalWrite(output_1, (e131.data[0] > 127) ? HIGH : LOW);
        digitalWrite(output_3, (e131.data[1] > 127) ? HIGH : LOW);
        digitalWrite(output_3, (e131.data[2] > 127) ? HIGH : LOW);
        digitalWrite(output_4, (e131.data[3] > 127) ? HIGH : LOW);
        digitalWrite(output_5, (e131.data[4] > 127) ? HIGH : LOW);
        digitalWrite(output_6, (e131.data[5] > 127) ? HIGH : LOW);
        digitalWrite(output_7, (e131.data[6] > 127) ? HIGH : LOW);
        digitalWrite(output_8, (e131.data[7] > 127) ? HIGH : LOW);
        }//end we have data
    
    } // end void loop
    Last edited by JCook; 09-14-2018 at 10:22 PM.

  2. #2
    Join Date
    Dec 2011
    Location
    UK S80 postcode
    Posts
    1,389
    Post Thanks / Like

    Default Re: SparkFun EL Wire Sequencer Shield on Wemos D1

    Hi, cool thatís working so far.

    Iíve not tried this:
    Add 4 lines to the user setup just under const int universe.
    Code:
    IPAddress ip (<your IP address>);  // xx,xx,xx,xx
    IPAdderss netmask (<your subnet>);  //255,255,255,0 is common
    IPAddress gateway (<your gateway address>);  // xx,xx,xx,xx normally your router / access piont IP address
    IPAddress dns(<your dns>); //  // xx,xx,xx,xx normally your router / access point IP address
    Then change
    Code:
      /* 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 */
    To
    Code:
      /* Choose one to begin listening for E1.31 data */
      e131.begin(ssid, passphrase, ip, netmask, gateway, dns);               /* via Unicast on the default port */
      // e131.beginMulticast(ssid, passphrase, universe, ip, netmask, gateway, dns); /* via Multicast for Universe 1 */
    As I say I have never tried this but it has one of two chances.

  3. Thanks JCook thanked for this post
  4. #3
    Join Date
    Dec 2013
    Location
    Williamsburg, VA
    Posts
    917
    Post Thanks / Like

    Default Re: SparkFun EL Wire Sequencer Shield on Wemos D1

    Woo hoo...

    The edits for static ip worked.
    I was able to turn on the correct outputs. For now I was only testing the outputs with a meter as I'm waiting on my EL Wire board.

    next step will be to test with the board and then 3 of these

    Here is the final code as I had a couple small typos (missed an output)

    Code:
    // Wemos D1 E1.31 - 8 channel sketch for Sparkfun EL Escudo Dos shield
    //Spark Fun link https://www.sparkfun.com/products/10878
    
    #include <ESP8266WiFi.h>
    #include <E131.h> // Copyright (c) 2015 Shelby Merrick http://www.forkineye.com
    
    // ***** USER SETUP STUFF *****
    const char ssid[] = "MYWIRELESS";  // replace with your SSID.
    const char passphrase[] = "PASSWORD"; // replace with your PASSWORD.
    const int universe = 1; // this sets the universe number you are using.
    IPAddress ip (192,168,1,221);  // xx,xx,xx,xx
    IPAddress netmask (255,255,255,0);  //255,255,255,0 is common
    IPAddress gateway (192,168,1,1);  // xx,xx,xx,xx normally your router / access piont IP address
    IPAddress dns (192,168,1,1); //  // xx,xx,xx,xx normally your router / access point IP address
    
    // this sets the pin numbers to use as outputs.
    //for Wemos D1 R1 pins are 16,5,4,14,12,13,0,2
    //for Wemos D1 R2 pins are 16,5,4,0,2,14,12,13
    const int output_1 = 16; //the pin to use as output 1 (D2)
    const int output_2 = 5;  //the pin to use as output 2 (D3)
    const int output_3 = 4;  //the pin to use as output 3 (D4)
    const int output_4 = 14;  //the pin to use as output 4 (D5)
    const int output_5 = 12;  //the pin to use as output 5 (D6)
    const int output_6 = 13; //the pin to use as output 6 (D7)
    const int output_7 = 0; //the pin to use as output 7 (D8)
    const int output_8 = 2; //the pin to use as output 8 (D9)
    
    
    E131 e131;
    
    void setup() {
      Serial.begin(115200);
      // set the pins chosen above as outputs.
      pinMode(output_1, OUTPUT);
      pinMode(output_2, OUTPUT);
      pinMode(output_3, OUTPUT);
      pinMode(output_4, OUTPUT);
      pinMode(output_5, OUTPUT);
      pinMode(output_6, OUTPUT);
      pinMode(output_7, OUTPUT);
      pinMode(output_8, OUTPUT);
    
      // set the pins chosen above to low / off.
      digitalWrite(output_1, LOW);
      digitalWrite(output_2, LOW);
      digitalWrite(output_3, LOW);
      digitalWrite(output_4, LOW);
      digitalWrite(output_5, LOW);
      digitalWrite(output_6, LOW);
      digitalWrite(output_7, LOW);
      digitalWrite(output_8, LOW);
      
      /* Choose one to begin listening for E1.31 data */
     // e131.begin(ssid, passphrase);               /* via Unicast on the default port */
      e131.begin(ssid, passphrase, ip, netmask, gateway, dns);               /* via Unicast on the default port */
      // e131.beginMulticast(ssid, passphrase, universe); /* via Multicast for Universe 1 */
    }
    
    void loop() {
      /* Parse a packet */
      uint16_t num_channels = e131.parsePacket();
    
      /* Process channel data if we have it */
      if (num_channels) {
        Serial.println("we have data");
    
        digitalWrite(output_1, (e131.data[0] > 127) ? HIGH : LOW);
        digitalWrite(output_2, (e131.data[1] > 127) ? HIGH : LOW);
        digitalWrite(output_3, (e131.data[2] > 127) ? HIGH : LOW);
        digitalWrite(output_4, (e131.data[3] > 127) ? HIGH : LOW);
        digitalWrite(output_5, (e131.data[4] > 127) ? HIGH : LOW);
        digitalWrite(output_6, (e131.data[5] > 127) ? HIGH : LOW);
        digitalWrite(output_7, (e131.data[6] > 127) ? HIGH : LOW);
        digitalWrite(output_8, (e131.data[7] > 127) ? HIGH : LOW);
        }//end we have data
    
    } // end void loop

  5. #4
    Join Date
    Dec 2011
    Location
    UK S80 postcode
    Posts
    1,389
    Post Thanks / Like

    Default Re: SparkFun EL Wire Sequencer Shield on Wemos D1

    Hi, great news. Don’t be a stranger, keep us posted on the rest of the build.

  6. Likes JCook liked this post
  7. #5
    Join Date
    Dec 2013
    Location
    Williamsburg, VA
    Posts
    917
    Post Thanks / Like

    Default Re: SparkFun EL Wire Sequencer Shield on Wemos D1

    Quote Originally Posted by Barnabybear View Post
    Hi, great news. Don’t be a stranger, keep us posted on the rest of the build.
    I will. In between testing the sketches and order some parts I've managed to sequences couple songs. thanks for all of the help

  8. #6
    Join Date
    Dec 2013
    Location
    Williamsburg, VA
    Posts
    917
    Post Thanks / Like

    Default Re: SparkFun EL Wire Sequencer Shield on Wemos D1

    OK, I received my El Scudo Dos shield from Sparkfun.

    There is a very weird behavior, here is what's happening.

    When I plug the shield into the Wemos D1 board and power everything up, the first output (A) D2/Pin16 and last (H) D9/Pin2 output turn on. Also the Wifi led is off and it does not connect.

    Here is what I did to isolate the issue. Using Wires I connected the shield "remote" I unplugged wires and kept repowering the board to see which connection was causing the issue.

    I isolated it down to two pins. and the issue they cause is slightly different. I tried this on two Wemos boards and had the same issue.

    Pin 0 /D8 connects to Channel 7 (Outoput A on the shield) when this pin is connected, it turns on the two outputs D2/D9 and kills the wifi
    Pin 2 /D9 connects to Channel 8 (Output H on the shield) when this pin is connected, it turns on the two outputs D2/D9 and the wifi will connect.

    Any thoughts?

  9. #7
    Join Date
    Dec 2011
    Location
    UK S80 postcode
    Posts
    1,389
    Post Thanks / Like

    Default Re: SparkFun EL Wire Sequencer Shield on Wemos D1

    Hi, not wholly unexpected. The pins that the El Scudo uses where picked to work with Nano outputs, it was just fortunate that the also landed on ESP outputs. They weren’t the outputs I would have used by choice, worst case we can change the pins but you’ll have to use wires to link the two boards. I know this is going to be a wearable so let’s see if we can get it working plugged in.

    The connection to GPIO 0 is causing the ESP to go into program mode at boot so the code never runs, hence no wifi.

    Does it run as expected with no connection on pins 0 & 2?

    I have to go out this morning but I’ll be about later.

  10. #8
    Join Date
    Dec 2013
    Location
    Williamsburg, VA
    Posts
    917
    Post Thanks / Like

    Default Re: SparkFun EL Wire Sequencer Shield on Wemos D1

    I forgot to add this.

    If I have the wires on o/2 removed at power up, it functions normally. Also If I plug them in after power up they too function normally.
    Last edited by JCook; 09-15-2018 at 07:29 AM.

  11. #9
    Join Date
    Dec 2013
    Location
    Williamsburg, VA
    Posts
    917
    Post Thanks / Like

    Default Re: SparkFun EL Wire Sequencer Shield on Wemos D1

    the board I'm testing on is a Wemos D1 R1 , not knowing there was a R2 out there. I've ordered R2 boards for my project. Do you think that will fix it?

    Here is a comparison of the two boards.
    comparison-of-wemos-r2-vs-r1-pinouts.png

    or what about the Mini, If I have to use wires, this might be better.
    Wemos_Mini.jpg
    Last edited by JCook; 09-15-2018 at 08:59 AM.

  12. #10
    Join Date
    Dec 2011
    Location
    UK S80 postcode
    Posts
    1,389
    Post Thanks / Like

    Default Re: SparkFun EL Wire Sequencer Shield on Wemos D1

    Hi, you'll have to use jumper wires but the code below should get you going for the moment. There might be some slight flicker at boot but it should boot ok. It uses GPIOs 1 and 3 insted of 0 and 2, they are normaly Tx and Rx but they can be converted back to GPIOs.
    Code:
    pinMode(1, FUNCTION_3);
    See how that goes. I'm looking for a schematic for the El Scudo then I see if there is a better plan.

    Code:
    // Wemos D1 E1.31 - 8 channel sketch for Sparkfun EL Escudo Dos shield
    //Spark Fun link https://www.sparkfun.com/products/10878
    
    #include <ESP8266WiFi.h>
    #include <E131.h> // Copyright (c) 2015 Shelby Merrick http://www.forkineye.com
    
    // ***** USER SETUP STUFF *****
    const char ssid[] = "MYWIRELESS";  // replace with your SSID.
    const char passphrase[] = "PASSWORD"; // replace with your PASSWORD.
    const int universe = 1; // this sets the universe number you are using.
    IPAddress ip (192,168,1,221);  // xx,xx,xx,xx
    IPAddress netmask (255,255,255,0);  //255,255,255,0 is common
    IPAddress gateway (192,168,1,1);  // xx,xx,xx,xx normally your router / access piont IP address
    IPAddress dns (192,168,1,1); //  // xx,xx,xx,xx normally your router / access point IP address
    
    pinMode(1, FUNCTION_3);  //***** EDIT by Banabybear *****
    pinMode(3, FUNCTION_3);  //***** EDIT by Banabybear *****
    
    // this sets the pin numbers to use as outputs.
    //for Wemos D1 R1 pins are 16,5,4,14,12,13,0,2
    //for Wemos D1 R2 pins are 16,5,4,0,2,14,12,13
    const int output_1 = 16; //the pin to use as output 1 (D2)
    const int output_2 = 5;  //the pin to use as output 2 (D3)
    const int output_3 = 4;  //the pin to use as output 3 (D4)
    const int output_4 = 14;  //the pin to use as output 4 (D5)
    const int output_5 = 12;  //the pin to use as output 5 (D6)
    const int output_6 = 13; //the pin to use as output 6 (D7)
    //const int output_7 = 0; //the pin to use as output 7 (D8)  //***** EDIT by Banabybear *****
    //const int output_8 = 2; //the pin to use as output 8 (D9)  //***** EDIT by Banabybear *****
    
    const int output_7 = 1; //the pin to use as output 7 (D8)  //***** EDIT by Banabybear *****
    const int output_8 = 3; //the pin to use as output 8 (D9)  //***** EDIT by Banabybear *****
    
    E131 e131;
    
    void setup() {
      Serial.begin(115200);
      // set the pins chosen above as outputs.
      pinMode(output_1, OUTPUT);
      pinMode(output_2, OUTPUT);
      pinMode(output_3, OUTPUT);
      pinMode(output_4, OUTPUT);
      pinMode(output_5, OUTPUT);
      pinMode(output_6, OUTPUT);
      pinMode(output_7, OUTPUT);
      pinMode(output_8, OUTPUT);
    
      // set the pins chosen above to low / off.
      digitalWrite(output_1, LOW);
      digitalWrite(output_2, LOW);
      digitalWrite(output_3, LOW);
      digitalWrite(output_4, LOW);
      digitalWrite(output_5, LOW);
      digitalWrite(output_6, LOW);
      digitalWrite(output_7, LOW);
      digitalWrite(output_8, LOW);
      
      /* Choose one to begin listening for E1.31 data */
     // e131.begin(ssid, passphrase);               /* via Unicast on the default port */
      e131.begin(ssid, passphrase, ip, netmask, gateway, dns);               /* via Unicast on the default port */
      // e131.beginMulticast(ssid, passphrase, universe); /* via Multicast for Universe 1 */
    }
    
    void loop() {
      /* Parse a packet */
      uint16_t num_channels = e131.parsePacket();
    
      /* Process channel data if we have it */
      if (num_channels) {
        Serial.println("we have data");
    
        digitalWrite(output_1, (e131.data[0] > 127) ? HIGH : LOW);
        digitalWrite(output_2, (e131.data[1] > 127) ? HIGH : LOW);
        digitalWrite(output_3, (e131.data[2] > 127) ? HIGH : LOW);
        digitalWrite(output_4, (e131.data[3] > 127) ? HIGH : LOW);
        digitalWrite(output_5, (e131.data[4] > 127) ? HIGH : LOW);
        digitalWrite(output_6, (e131.data[5] > 127) ? HIGH : LOW);
        digitalWrite(output_7, (e131.data[6] > 127) ? HIGH : LOW);
        digitalWrite(output_8, (e131.data[7] > 127) ? HIGH : LOW);
        }//end we have data
    
    } // end void loop

Page 1 of 5 123 ... 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
  •