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() {
Serial.begin(9600);
pinMode(switchUpPin, INPUT_PULLUP);
pinMode(switchDownPin, INPUT_PULLUP);
pinMode(relayUpPin, OUTPUT);
pinMode(relayDownPin, OUTPUT);
digitalWrite(relayUpPin,HIGH);
digitalWrite(relayDownPin,HIGH);
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.
Table from here
-
\$\begingroup\$ thank you. Dual relay link added to Q, and piece of the code. \$\endgroup\$guyd– guyd2018年11月02日 10:01:46 +00:00Commented Nov 2, 2018 at 10:01
-
\$\begingroup\$ seems no document tell the internal pull-up resistor value. some blog says it about 40~60 KΩ: rayshobby.net/wordpress/tips-and-tricks-for-using-esp8266/…. \$\endgroup\$yurenchen– yurenchen2023年03月24日 20:26:35 +00:00Commented Mar 24, 2023 at 20:26
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– guyd2018年11月03日 18:07:26 +00:00Commented Nov 3, 2018 at 18:07 -
\$\begingroup\$ you say that the internall pullup doesn't help? \$\endgroup\$Juraj– Juraj2018年11月03日 18:12:28 +00:00Commented Nov 3, 2018 at 18:12
-
\$\begingroup\$ I say that, I had some occurrences that erratic triggering happened ... \$\endgroup\$guyd– guyd2018年11月03日 18:14:04 +00:00Commented 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– Juraj2018年11月03日 18:17:25 +00:00Commented 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– guyd2018年11月03日 18:41:17 +00:00Commented Nov 3, 2018 at 18:41