2

I have a SparkFun ESP8266 Thing Dev board, to which I want to perform a digitalRead() on one of the GPIO ports. I'm using D15, and I'm configuring it for input like this

pinMode(15, INPUT_PULLUP);

It does seem to work as intended, and I am able to pull it down by connecting it to ground via a 4.7kΩ resistor.

But how do I know what the actual "correct" resistor would be? I can't find any specs for the internal pullup resistor online. On a related note, I first tried using D0, but it didn't seem to have an internal pullup resistor, since even using INPUT_PULLUP didn't turn it on.

Perhaps there are specs online and I'm just not able to find them, but is there any other way (measuring?) to find out which pins will work with INPUT_PULLUP and if so, what their internal resistance is?

11
  • What makes you believe that you need a resistor at all?
    – Majenko
    Commented Nov 15, 2018 at 17:12
  • 1
    You may find this edifying though: majenko.co.uk/blog/measuring-arduino-internal-pull-resistors
    – Majenko
    Commented Nov 15, 2018 at 17:17
  • Internal pullup resistor only gives the pin a definite input value (HIGH) if it is floating. If the pin is connected to ground then it will read LOW, regardless of whether a pullup resistor is used or not.
    – gandalf61
    Commented Nov 15, 2018 at 17:39
  • 1
    @gandalf61 Won't that depend on the ratio between the pullup and pulldown resistors? Of course if it's connected directly to ground, then it would definitely be low...
    – Magnus
    Commented Nov 15, 2018 at 17:44
  • 2
    @Majenko Hmm... is it safe to connect a GPIO input directly to +5V or ground, without any resistor? Won't it draw an unnecessarily high current, and/or risk damaging something in the device?
    – Magnus
    Commented Nov 15, 2018 at 17:46

2 Answers 2

1

io 0 and io 15 are with io 2 boot configuration pins of the esp8266. esp8266 dev boards have external pull-up on io 0 and io 2 and pull-down on io 15.

4
  • Thanks. Where can I find this information? The Hookup Guide I found doesn't really say much about pins 0, 4 and 15... and SparkFuns own examples seem to mostly use pin 12 as INPUT_PULLUP, which is the only one I got it to work with.
    – Magnus
    Commented Nov 15, 2018 at 18:54
  • the best source is Espressif's site (esp8266_hardware_design_guidelines_en.pdf). but the information about boot pins is on many web pages about esp8266
    – Juraj
    Commented Nov 15, 2018 at 19:04
  • Hmm, now I'm feeling a bit stupid... when I say pinMode(12, INPUT) - does the 12 refer to GPIO12 or to "pin 12", which in the Espressif Hardware Design Guidelines means GPIO13? It gets even more confusing when the SparkFun pin guideline refers to pin 12 as D12... Which one of all of these am I really interested in when calling pinMode()??
    – Magnus
    Commented Nov 15, 2018 at 23:35
  • in Sparkfun Thing the labels and the pin numbers (even if prefixed with D) correspond to gpio numbers used by Espressif. (NodeMcu and Wemos/Lolin boards have Dx comstants and labels)
    – Juraj
    Commented Nov 16, 2018 at 11:46
0

"The value of internal (built-in) pull-up resistor is between 30Kohm and 100Kohm."

Source: https://bbs.espressif.com/viewtopic.php?t=1079#p4097

1
  • 1
    did you read the accepted answer?
    – Juraj
    Commented Apr 2, 2019 at 13:42

Your Answer

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

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