Page 3 of 3 FirstFirst 123
Results 21 to 27 of 27

Thread: Wemos D1 as a controller?

  1. #21
    Join Date
    Dec 2012
    Location
    DFW, TX
    Posts
    23
    Post Thanks / Like

    Default Re: Wemos D1 as a controller?

    Per the schematic on page 9 of the ESPixelStick V2 Assembly and Usage Guide, Data comes out of GPIO2 and Clock out of GPIO0. On my ESP-12 (a slightly larger ESB dev board), GPIO2 = D4 and GPIO0 = D3.
    If this schematic of the Wemos D1 is correct, your pins are the same as mine.
    However: I use WS2811 pixels, which don't have a clock line. I am not having any trouble driving my string of pixels (50 in testing) straight from the output of the board in the picture I linked to in a previous post (through a 22Ohm resistor and using a 5V/10A supply).

  2. #22
    Join Date
    Oct 2011
    Location
    Batesburg, SC
    Posts
    85
    Post Thanks / Like

    Default Re: Wemos D1 as a controller?

    Quote Originally Posted by Barnabybear View Post
    https://github.com/forkineye/E131/bl...6_NeoPixel.ino

    https://github.com/forkineye/ESPixelStick

    Have some PWM code if you wan't to run a DC ssr up to 11 channels.
    I Know this topic is aging.....
    I am curious about this PWM code mentioned....
    Please share some code, or point me in the right direction...

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

    Default Re: Wemos D1 as a controller?

    Dont know about the code but the ESP8266 on the WeMos has a hardware based PWM output. You tell it what you want and it does it on its own. Software based PWM gets a bit more complicated.


    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.
    https://www.youtube.com/channel/UCyX...ttrsZNARkUce0Q

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

    Default Re: Wemos D1 as a controller?

    Quote Originally Posted by jcasterline View Post
    I Know this topic is aging.....
    I am curious about this PWM code mentioned....
    Please share some code, or point me in the right direction...
    Hi, yes aging and so is the post. If you can let me know what it is you are wanting to do, particularly the SSR (make, number of channels and quantity) you will be using I’ll get you the code.

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

    Default Re: Wemos D1 as a controller?

    It looks like the D1 mini has 10 PWM ports. Realistically, I would probably use 4 to 8. Not in a big hurry, cause this year's Christmas plan is (almost) set in stone.
    If the code was written for 9 outputs, that could handle 3 sets of dumb RGB lights.

    How difficult would it be to add a web interface? Enable or disable ports with an option box?

    You guys are awesome. I can follow the code pretty well, but I struggle with making one from scratch. Y'all drop these things out and make it look easy.

    Sent from my XT1254 using Tapatalk

  6. #26
    Join Date
    Dec 2011
    Location
    UK S80 postcode
    Posts
    1,411
    Post Thanks / Like

    Default Re: Wemos D1 as a controller?

    Hi, have a look at the code below. It could do with a refresh/re-write as it was written in 2015/17 and I’ve improved since then (in my opinion anyway).
    Code:
    // Wemos D1 Mini E1.31 - 6 channel dumb RGB led sketch over multicast.
    
    #include <ESP8266WiFi.h>
    #include <E131.h> // Copyright (c) 2015 Shelby Merrick http://www.forkineye.com
    
    // ***** USER SETUP STUFF *****
    const char ssid[] = "<YOUR_SSID>";  // replace with your SSID.
    const char passphrase[] = "<YOUR_PASSWORD>"; // replace with your PASSWORD.
    const int universe = 1; // this sets the universe number you are using.
    
    // this sets the channel number used by the output.
    const int channel_1_red = 1; // the channel number to link to output 1 red.
    const int channel_1_green = 2; // the channel number to link to output 1 green.
    const int channel_1_blue = 3; // the channel number to link to output 1 blue.
    const int channel_2_red = 4; // the channel number to link to output 2 red.
    const int channel_2_green = 5; // the channel number to link to output 2 green.
    const int channel_2_blue = 6; // the channel number to link to output 2 blue.
    
    // this sets the pin numbers to use as outputs.
    const int output_1_red = 4; // the pin to use as output 1 red (D2).
    const int output_1_green = 5; // the pin to use as output 1 green (D1).
    const int output_1_blue = 12; // the pin to use as output 1 blue (D6).
    const int output_2_red = 13; // the pin to use as output 1 red (D7).
    const int output_2_green = 14; // the pin to use as output 1 green (D5).
    const int output_2_blue = 15; // the pin to use as output 1 blue (D8).
    
    
    E131 e131;
    
    void setup() {
      Serial.begin(115200);
    
      // set the pins chosen above as outputs.
      pinMode(output_1_red, OUTPUT);
      pinMode(output_1_green, OUTPUT);
      pinMode(output_1_blue, OUTPUT);
      pinMode(output_2_red, OUTPUT);
      pinMode(output_2_green, OUTPUT);
      pinMode(output_2_blue, OUTPUT);
    
      // set the pins chosen above to low / off.
      analogWrite(output_1_red, 0);
      analogWrite(output_1_green, 0);
      analogWrite(output_1_blue, 0);
      analogWrite(output_2_red, 0);
      analogWrite(output_2_green, 0);
      analogWrite(output_2_blue, 0);
    
      /* 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");
    
        Serial.println(e131.data[channel_1_red -1]);
        Serial.println(e131.data[channel_1_green -1]);
        Serial.println(e131.data[channel_1_blue -1]);
        Serial.println(e131.data[channel_2_red -1]);    
        Serial.println(e131.data[channel_2_green -1]);
        Serial.println(e131.data[channel_2_blue -1]);
      
      // set the outputs to the data value.
      analogWrite(output_1_red, (e131.data[channel_1_red -1]) *4);
      analogWrite(output_1_green, (e131.data[channel_1_green -1]) *4);
      analogWrite(output_1_blue, (e131.data[channel_1_blue -1]) *4);
      analogWrite(output_2_red, (e131.data[channel_2_red -1]) *4);
      analogWrite(output_2_green, (e131.data[channel_2_green -1]) *4);
      analogWrite(output_2_blue, (e131.data[channel_2_blue -1]) *4);
    
      }
    }
    I’m sure a web interface can be added but I’m not your man for that. I can however add the option to enable at the point of flashing and OTA (Over The Air) re-flashing should be possible.

  7. #27
    Join Date
    Oct 2011
    Location
    Batesburg, SC
    Posts
    85
    Post Thanks / Like

    Default Re: Wemos D1 as a controller?

    Thank you. This looks like it could be easily expanded or reduced.

    Sent from my XT1254 using Tapatalk

Page 3 of 3 FirstFirst 123

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
  •