Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Which pins should I use for status led on a wemos d1 mini gateway

Which pins should I use for status led on a wemos d1 mini gateway

Scheduled Pinned Locked Moved Troubleshooting
17 Posts 4 Posters 195 Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Danielo RodríguezD Danielo Rodríguez

    Hello,
    Sorry if this has been answered before, but I could not find any answer to this particular thing.
    I have a wifi gateway built using a d1 mini. It is working great, but I want to have some feedback about what is going on, so I decided to add some status leds. I already wired all the leds to 5v, and when I was about to check wich other pins to use I realized that the information is for an arduino gateway, so, what are the pins that ai can use on the D1 mini for this?

    pw44P Offline
    pw44P Offline
    pw44
    wrote on last edited by
    #3

    @Danielo-Rodríguez good question, i'm also looking for it.

    I used D1 for include button.
    #define MY_INCLUSION_MODE_BUTTON_PIN D1

    Tried

    #define MY_DEFAULT_ERR_LED_PIN D0 // 3 // Error led pin
    #define MY_DEFAULT_RX_LED_PIN D3 // 5 // Receive led pin
    #define MY_DEFAULT_TX_LED_PIN D4 // 4 // Transmit led pin

    But did not succeed.

    1 Reply Last reply
    0
    • Danielo RodríguezD Danielo Rodríguez

      Hello,
      Sorry if this has been answered before, but I could not find any answer to this particular thing.
      I have a wifi gateway built using a d1 mini. It is working great, but I want to have some feedback about what is going on, so I decided to add some status leds. I already wired all the leds to 5v, and when I was about to check wich other pins to use I realized that the information is for an arduino gateway, so, what are the pins that ai can use on the D1 mini for this?

      BearWithBeardB Offline
      BearWithBeardB Offline
      BearWithBeard
      wrote on last edited by
      #4

      @Danielo-Rodríguez I used D0 (GPIO16), D3 (GPIO2) and D4 (GPIO4) on my NodeMCU-based GW for status LEDs. Since the pin definitions of the NodeMCU and D1 mini are the same, this should work on the D1 mini as well. Just make sure to connect them to VCC, not GND. If either D3 or D4 are pulled low, the ESP won't boot.

      pw44P 1 Reply Last reply
      1
      • BearWithBeardB BearWithBeard

        @Danielo-Rodríguez I used D0 (GPIO16), D3 (GPIO2) and D4 (GPIO4) on my NodeMCU-based GW for status LEDs. Since the pin definitions of the NodeMCU and D1 mini are the same, this should work on the D1 mini as well. Just make sure to connect them to VCC, not GND. If either D3 or D4 are pulled low, the ESP won't boot.

        pw44P Offline
        pw44P Offline
        pw44
        wrote on last edited by
        #5

        @BearWithBeard

        Just make sure to connect them to VCC, not GND. If either D3 or D4 are pulled low, the ESP won't boot.

        So, D0 to led anode and led cathode to resistor to gnd, correct?

        BearWithBeardB 1 Reply Last reply
        0
        • pw44P pw44

          @BearWithBeard

          Just make sure to connect them to VCC, not GND. If either D3 or D4 are pulled low, the ESP won't boot.

          So, D0 to led anode and led cathode to resistor to gnd, correct?

          BearWithBeardB Offline
          BearWithBeardB Offline
          BearWithBeard
          wrote on last edited by BearWithBeard
          #6

          @pw44 No, this isn't a good idea. You should have all status LEDs in either source or sink configuration, or some LEDs will be inverted (lit by default, off when there is activity).

          D3 and D4 must to be connected like this to not prevent the ESP from booting: GPIO - Resistor - LED cathode - LED anode - VCC. D0 should be connected equally, even if it doesn't matter for the ESP's functionality.

          Besides that, if you don't use I2C, you should also be able to use D1 (GPIO5) and D2 (GPIO4) for status LEDs, inclusion mode button, etc.

          pw44P 2 Replies Last reply
          1
          • Danielo RodríguezD Offline
            Danielo RodríguezD Offline
            Danielo Rodríguez
            wrote on last edited by Danielo Rodríguez
            #7

            Wow, thank you everyone! I have all the leds sink to 5v (long leg) and I was going to put a resistor on the other leg to connect them to the gpio because that is what it says on the docs, but docs are for arduino. I'm very happy that it's the same for the D1 mini. When I define the pins on the sketch should I use the same label (without the D) or should I use a different value?

            By the way, what can be the i2c used on the gateway?
            OH, and which resistor should I use? Does it need to be of an specific value or is it enough if it is within certain range?

            BearWithBeardB 1 Reply Last reply
            0
            • BearWithBeardB BearWithBeard

              @pw44 No, this isn't a good idea. You should have all status LEDs in either source or sink configuration, or some LEDs will be inverted (lit by default, off when there is activity).

              D3 and D4 must to be connected like this to not prevent the ESP from booting: GPIO - Resistor - LED cathode - LED anode - VCC. D0 should be connected equally, even if it doesn't matter for the ESP's functionality.

              Besides that, if you don't use I2C, you should also be able to use D1 (GPIO5) and D2 (GPIO4) for status LEDs, inclusion mode button, etc.

              pw44P Offline
              pw44P Offline
              pw44
              wrote on last edited by
              #8

              @BearWithBeard said in Which pins should I use for status led on a wemos d1 mini gateway:

              @pw44 No, this isn't a good idea. You should have all status LEDs in either source or sink configuration, or some LEDs will be inverted (lit by default, off when there is activity).

              D3 and D4 must to be connected like this to not prevent the ESP from booting: GPIO - Resistor - LED cathode - LED anode - VCC. D0 should be connected equally, even if it doesn't matter for the ESP's functionality.

              Besides that, if you don't use I2C, you should also be able to use D1 (GPIO5) and D2 (GPIO4) for status LEDs, inclusion mode button, etc.

              Thank you so much for your answer. Helped me a lot.

              1 Reply Last reply
              0
              • Danielo RodríguezD Danielo Rodríguez

                Wow, thank you everyone! I have all the leds sink to 5v (long leg) and I was going to put a resistor on the other leg to connect them to the gpio because that is what it says on the docs, but docs are for arduino. I'm very happy that it's the same for the D1 mini. When I define the pins on the sketch should I use the same label (without the D) or should I use a different value?

                By the way, what can be the i2c used on the gateway?
                OH, and which resistor should I use? Does it need to be of an specific value or is it enough if it is within certain range?

                BearWithBeardB Offline
                BearWithBeardB Offline
                BearWithBeard
                wrote on last edited by
                #9

                @pw44 I'm glad I could help!

                @Danielo-Rodríguez said in Which pins should I use for status led on a wemos d1 mini gateway:

                By the way, what can be the i2c used on the gateway?

                You could add any kind of I2C device to it, like a temperature sensor. A gateway is basically a regular node with some (important) extra functionality. Just be mindful to not overburden the gateway with too many secondary tasks. If it spends too much time dealing with sensors and other stuff blocking the loop, you may risk that it misses incoming messages.

                OH, and which resistor should I use? Does it need to be of an specific value or is it enough if it is within certain range?

                You can sink up to 20mA into a pin on the ESP8266. As long as you stay below that (and the current limit of the LEDs), you should be fine [R = (VCC - Vforward) / Iforward].

                220R or 330R is fine for a bright light. Use 1K or even more if you prefer a rather dim light. Or anything in between. If you connect the LEDs to 3.3V instead of 5V, you need smaller resistors for the same brightness.

                Danielo RodríguezD 1 Reply Last reply
                0
                • BearWithBeardB BearWithBeard

                  @pw44 I'm glad I could help!

                  @Danielo-Rodríguez said in Which pins should I use for status led on a wemos d1 mini gateway:

                  By the way, what can be the i2c used on the gateway?

                  You could add any kind of I2C device to it, like a temperature sensor. A gateway is basically a regular node with some (important) extra functionality. Just be mindful to not overburden the gateway with too many secondary tasks. If it spends too much time dealing with sensors and other stuff blocking the loop, you may risk that it misses incoming messages.

                  OH, and which resistor should I use? Does it need to be of an specific value or is it enough if it is within certain range?

                  You can sink up to 20mA into a pin on the ESP8266. As long as you stay below that (and the current limit of the LEDs), you should be fine [R = (VCC - Vforward) / Iforward].

                  220R or 330R is fine for a bright light. Use 1K or even more if you prefer a rather dim light. Or anything in between. If you connect the LEDs to 3.3V instead of 5V, you need smaller resistors for the same brightness.

                  Danielo RodríguezD Offline
                  Danielo RodríguezD Offline
                  Danielo Rodríguez
                  wrote on last edited by
                  #10

                  @BearWithBeard Thank you very much!
                  I'll do that

                  1 Reply Last reply
                  0
                  • Danielo RodríguezD Offline
                    Danielo RodríguezD Offline
                    Danielo Rodríguez
                    wrote on last edited by
                    #11

                    At the end I was able to use D0,D1 and D4 for status leds. Something interesting is that I can use the actual DN nomenclature because there is a header file that maps them properly. The weird thing is that such file is arduino.h (I'm using platformio) so I'm not sure if it is specific for the D1 mini or if D1 is compatible with arduino pinout.
                    I used a 220 ohm resistor and, dam it, the leds are bright as hell, haha.
                    Everything is working now, it's very pleasant to see the leds blink when I turn on other node. Thanks to all the people on this forum for the great support.

                    1 Reply Last reply
                    2
                    • BearWithBeardB BearWithBeard

                      @pw44 No, this isn't a good idea. You should have all status LEDs in either source or sink configuration, or some LEDs will be inverted (lit by default, off when there is activity).

                      D3 and D4 must to be connected like this to not prevent the ESP from booting: GPIO - Resistor - LED cathode - LED anode - VCC. D0 should be connected equally, even if it doesn't matter for the ESP's functionality.

                      Besides that, if you don't use I2C, you should also be able to use D1 (GPIO5) and D2 (GPIO4) for status LEDs, inclusion mode button, etc.

                      pw44P Offline
                      pw44P Offline
                      pw44
                      wrote on last edited by
                      #12

                      @BearWithBeard could you please confirm the correct definitions for the pins?

                      #define MY_DEFAULT_ERR_LED_PIN 3 // D0 Error led pin
                      #define MY_DEFAULT_RX_LED_PIN 5 // D3 Receive led pin
                      #define MY_DEFAULT_TX_LED_PIN 4 // D4 Transmit led pin

                      D1 = pin 1
                      D3 = pin 5
                      D4 = pin 4
                      D0 = pin 3

                      is this correct?

                      thx in advance.

                      mfalkviddM BearWithBeardB 2 Replies Last reply
                      0
                      • pw44P pw44

                        @BearWithBeard could you please confirm the correct definitions for the pins?

                        #define MY_DEFAULT_ERR_LED_PIN 3 // D0 Error led pin
                        #define MY_DEFAULT_RX_LED_PIN 5 // D3 Receive led pin
                        #define MY_DEFAULT_TX_LED_PIN 4 // D4 Transmit led pin

                        D1 = pin 1
                        D3 = pin 5
                        D4 = pin 4
                        D0 = pin 3

                        is this correct?

                        thx in advance.

                        mfalkviddM Offline
                        mfalkviddM Offline
                        mfalkvidd
                        Mod
                        wrote on last edited by
                        #13

                        @pw44 could you clarify what pin numbers you are referring to, perhaps with a picture?

                        The mapping used by the Arduino IDE can be seen at https://github.com/esp8266/Arduino/blob/master/variants/d1_mini/pins_arduino.h#L37

                        pw44P 1 Reply Last reply
                        0
                        • mfalkviddM mfalkvidd

                          @pw44 could you clarify what pin numbers you are referring to, perhaps with a picture?

                          The mapping used by the Arduino IDE can be seen at https://github.com/esp8266/Arduino/blob/master/variants/d1_mini/pins_arduino.h#L37

                          pw44P Offline
                          pw44P Offline
                          pw44
                          wrote on last edited by
                          #14

                          @mfalkvidd thx for answering.

                          i was looking for the correct mapping for:

                          #define MY_DEFAULT_ERR_LED_PIN D0 // Error led pin
                          #define MY_DEFAULT_RX_LED_PIN D3 // Receive led pin
                          #define MY_DEFAULT_TX_LED_PIN D4 // Transmit led pin

                          thx to your hint, D0 =16, D3 = 0, D4 = 2.

                          So, i shall change to:

                          #define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin
                          #define MY_DEFAULT_RX_LED_PIN 0 // Receive led pin
                          #define MY_DEFAULT_TX_LED_PIN 2 // Transmit led pin

                          1 Reply Last reply
                          0
                          • pw44P pw44

                            @BearWithBeard could you please confirm the correct definitions for the pins?

                            #define MY_DEFAULT_ERR_LED_PIN 3 // D0 Error led pin
                            #define MY_DEFAULT_RX_LED_PIN 5 // D3 Receive led pin
                            #define MY_DEFAULT_TX_LED_PIN 4 // D4 Transmit led pin

                            D1 = pin 1
                            D3 = pin 5
                            D4 = pin 4
                            D0 = pin 3

                            is this correct?

                            thx in advance.

                            BearWithBeardB Offline
                            BearWithBeardB Offline
                            BearWithBeard
                            wrote on last edited by BearWithBeard
                            #15

                            @pw44 If you are using the "big" WeMos D1 - the one in the shape of an Arduino Uno - then yes, that looks right to me. This file contains the pin definitions used for this board. But you may have to wire the LEDs to different pins in this case, because D4 / GPIO4 conflicts with the default assignment for CE when using an NRF24 transceiver and D3 / GPIO5 conflicts with DIO0 when using an RFM radio according to the Connecting the Radio guide.

                            If you want to try using the same GPIOs that worked for me on the NodeMCU (2, 4 and 16), you may connect the LEDs to D9, D14 and D2.

                            You may also want to read the book that @mfalkvidd recommended or take a look at this ESP8266 pinout reference to see what pin does what.

                            The D1 mini - the board that the OP uses - has different pin definitions, which are listed here and are similar to the NodeMCU I was using.

                            In general, I think it should be fine to use the alias D1, D2, etc for the pins. No need to use the GPIO number here.

                            pw44P 1 Reply Last reply
                            1
                            • BearWithBeardB BearWithBeard

                              @pw44 If you are using the "big" WeMos D1 - the one in the shape of an Arduino Uno - then yes, that looks right to me. This file contains the pin definitions used for this board. But you may have to wire the LEDs to different pins in this case, because D4 / GPIO4 conflicts with the default assignment for CE when using an NRF24 transceiver and D3 / GPIO5 conflicts with DIO0 when using an RFM radio according to the Connecting the Radio guide.

                              If you want to try using the same GPIOs that worked for me on the NodeMCU (2, 4 and 16), you may connect the LEDs to D9, D14 and D2.

                              You may also want to read the book that @mfalkvidd recommended or take a look at this ESP8266 pinout reference to see what pin does what.

                              The D1 mini - the board that the OP uses - has different pin definitions, which are listed here and are similar to the NodeMCU I was using.

                              In general, I think it should be fine to use the alias D1, D2, etc for the pins. No need to use the GPIO number here.

                              pw44P Offline
                              pw44P Offline
                              pw44
                              wrote on last edited by
                              #16

                              @BearWithBeard exactly what i was looking for, the pin mapping for D1 MINI.

                              Thx!

                              pw44P 1 Reply Last reply
                              0
                              • pw44P pw44

                                @BearWithBeard exactly what i was looking for, the pin mapping for D1 MINI.

                                Thx!

                                pw44P Offline
                                pw44P Offline
                                pw44
                                wrote on last edited by
                                #17

                                @pw44 and so, my first assbled gateway looks like:

                                IMG_6624.JPG

                                IMG_6623.JPG

                                IMG_6634.JPG

                                IMG_6633.JPG

                                IMG_6632.JPG

                                Now i will try a more robust version, with external antenna.

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                15

                                Online

                                11.7k

                                Users

                                11.2k

                                Topics

                                113.1k

                                Posts


                                Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • MySensors
                                • OpenHardware.io
                                • Categories
                                • Recent
                                • Tags
                                • Popular