0

On the ESP8266 NodeMCU I have GPIO2 , GPIO3 , GPIO1 , GPIO9 free but when I assign them to a button they do not work. I assume it is because those pins have other function behind them. When I look at the schematic I found that they are TXD1, RXD0, TXD0, and SSD2. Is there a way to still use these pins as inputs?

If not, can I use an Arduino Uno for my inputs and send signals from there to the analog pin to my ESP8266 NodeMCU for the connection to the MQTT server?

For the record all my other pins are used so I can't use any other input pin than these 4.

4
  • safest pins to use are 4, 5, 12, 13, 14 then 16. 0, 2 and 15 can be safe to use as long as you realise that normal boot should have 15 LOW, and 0 and 2 High - so, if you have a pullup resistor on 0 and 2, and the button shorts to ground when pressed, and a pulldown resistor on 15, and the button shorts to vcc when pressed, you shouldn't have any issues using these Dec 7, 2017 at 2:36
  • forgot to mention, all boards I've used (ESP07/12E/12F) have a pulldown resistor on GPIO15 already - so, check before adding another one Dec 7, 2017 at 2:57
  • @JaromandaX I used your method with the pullup resistors for pins 0 and 2 and that worked thanks a lot. I do have 1 more question about your answered in the other command about the GPIO9 and GPIO10 . The 10 works fine but the 9 doesn't, it doesn't work as an output or input. I don't need the 9 but my question is if pin GPIO10 is safe to use for a button because the 9 and 10 are both SSD pins. *All the other pins you mentioned are used I should've thought about this in the beginning of my project :D
    – achahbar
    Dec 7, 2017 at 7:33
  • The table at randomnerdtutorials.com/esp8266-pinout-reference-gpios might help Dec 16, 2021 at 12:18

1 Answer 1

1

GPIO2 is NodeMCU D4 which is U1TXD, transmit for the second UART, generally available. GPIO3 is NodeMCU U0RXD, receive for the first UART, generally available if you aren't using serial. GPIO1 is NodeMCU U0TXD, transmit for the first UART, generally available if you aren't using serial. GPIO9 is NodeMCU SPIHD and is NOT available, as it is required for the flash memory. All that is well documented in many places. You can easily use serial to move data between modules, or multiplex your input to the one module. Cannot provide much insight without more details.

4
  • Thank you for the clarfication of the pins and your answer. The problem i'm having with these pins are that when my esp8266 is in flash mode (when booting up and when uploading) there can't be a button connecting to these pins , when it is finished uploading /booting. The input pins work perfectly. Is there something in my code that i can tell the esp8266 to not check these ports while booting up. or other solutions.
    – achahbar
    Dec 6, 2017 at 21:44
  • on a nodemcu, GPIO9(11) and GPIO10(12) seem to be available - (node mcu io index number in brackets) perhaps only SDD0 and SDD1 are connected to the flash ram. Dec 7, 2017 at 2:40
  • @JaromandaX according to this pin diagram for the NodeMCU, GPIO10 is also identified as SDD3 and GPIO9 is identified as SDD2. I think those pins might be involved in commuincations with flash storage? I've seen suggestions that these can be used but nothing definitive. Would love to know myself.
    – S. Imp
    Jul 3, 2020 at 1:00
  • @S.Imp - if you use DOUT or DIO flash mode then GPIO9/10 are "available" - this is (possibly) true for ANY esp8266 dev board (that breaks out those pins, i.e. NOT ESP01) - however, I have read that they can only "reliably" be used for either OUT or IN (sorry, can't remember which, and it's been YEARS since I've worried about such things). Of course, I've also read that certain GPIO's are "best" for IN and others "best" for OUT" and yet others that can go either way - though, to be fair, as far as my experience goes, there's really no limits with any GPIO as to its direction Jul 3, 2020 at 3:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.