I'm having some trouble with this ESP8266, to switch UP, DOWN, OFF dual relay, using Arduino code and a physical 3 states switch.

The code defines input GPIOs 12,14 as INPUT_PULLUP to avoid cases that from time to time ( say once a day ), I get a phenomena that is typically for not using a pull-up resistor.

What can cause such a thing? Can it be that GPIO12, GPIO14 does not HAVE a pull-up resistor on-board?

Relevant code (that defines inputs and outputs):

void setup() {


        pinMode(switchUpPin, INPUT_PULLUP);
        pinMode(switchDownPin, INPUT_PULLUP);
        pinMode(relayUpPin, OUTPUT);
        pinMode(relayDownPin, OUTPUT);


2 Answers 2


No, GPIO12 and GPIO14 have internal pull-up resistors (see table below). If they are properly setup in software I would suggest looking at the output (relay control circuit). Since you provided no information about the relay or how you control it I can't give a better answer.

ESP8266 pull-up table

Table from here


The NodeMcu has no pull-up on pins 12 and 14. The esp8266 has internal pull-up and you activate it with pin mode INPUT_PULLUP. Without activated internall pull-up, there is no pull-up for this pns.

  • \$\begingroup\$ As you can see in my code, it IS initiated with INPUT_PULLUP but the behaviour, scarcely, seems it does not have any. \$\endgroup\$
    – guyd
    Nov 3, 2018 at 18:07
  • \$\begingroup\$ you say that the internall pullup doesn't help? \$\endgroup\$
    – Juraj
    Nov 3, 2018 at 18:12
  • \$\begingroup\$ I say that, I had some occurrences that erratic triggering happened ... \$\endgroup\$
    – guyd
    Nov 3, 2018 at 18:14
  • \$\begingroup\$ ...while already using internal pull-up. I was not sure how to understand the question. So voltage drops while WiFi consumes too much power? \$\endgroup\$
    – Juraj
    Nov 3, 2018 at 18:17
  • \$\begingroup\$ you know I have my language limitations :) - Yes, it happened when PULLUP was already defined in code. I'm using a 2A DC adaptor, I doubt if the esp8266 consumes power in that scale. \$\endgroup\$
    – guyd
    Nov 3, 2018 at 18:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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