2

I am using a device with an ESP 8266 microcontroller. I have discovered that setting LED_BUILTIN to HIGH turns the built-in LED off and setting LED_BUILTIN to LOW turns the built-in LED on. This seems to be because the microcontroller can sink more current than it can source.

Before I start using this microcontroller, I would like to know which other pins have this reverse behaviour. I've looked up datasheets for the ESP 8266 but I don't see how to discern this information. I would simply write a sketch to test, but I'm not sure what I might damage, and I'm not sure how to determine when an output pin is in the high-impedance state anyway.

On the ESP 8266, how to know which pins are HIGH -> 0v and which pins are HIGH -> 5v? Are the HIGH -> 0v pins necessarily LOW -> 5v? Where is this documented?

12
  • the pin is not reversed. the attached circuit with the LED reverses the signal.
    – Juraj
    Commented Apr 22, 2020 at 19:09
  • @Juraj: Thank you. The pin is not reversed, but the behaviour (on this board and others) is. Are you saying that the issue is board-specific, so won't be relevant to all ESP 8266 boards? This is the board that I'm using.
    – dotancohen
    Commented Apr 22, 2020 at 19:12
  • it is a Wemos D1 R1
    – Juraj
    Commented Apr 22, 2020 at 19:14
  • the behaviour is not reversed ... a HIGH does not necessarily mean LED on ... a HIGH only means high output
    – jsotola
    Commented Apr 22, 2020 at 19:15
  • Yes, or at lease a clone of one. I see mention on forums of people having this issue with other ESP 8266 boards as well.
    – dotancohen
    Commented Apr 22, 2020 at 19:15

1 Answer 1

3

The esp8266 must have a pull-up on io 2 for boot configuration. The Wemos D1 boards put the LED in series with the pull-up resistor on io 2. This creates the 'reversed' LED behavior.

enter image description here

The large D1s are retired and it is hard to find a good and readable schematics. The cut out is from D1 mini schematics.

2
  • I see now, thank you! I take it that this is common, but not necessary, on ESP 8266 boards.
    – dotancohen
    Commented Apr 22, 2020 at 19:51
  • I've found the explanation of the boot configuration and it is lucky that I did, as it is non-trivial and very important. Thank you Juraj!
    – dotancohen
    Commented Apr 22, 2020 at 19:59

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.