ESP8266 GPIO pins info, restrictions and features

There is one, done by the youtuber “guy with the swiss accent”. Can’t remember his name, proper youtube profile or post a link to the website, as I am on mobile… My aging PC is misbehaving.

1 Like

Pete.

2 Likes

Thanks @PeteKnight

Found it… I think… can’t open it on mobile yet…

Yes, on the 2nd tab is the chart I was referimg to for the ESP32

https://github.com/SensorsIot/ESP32-Deep-Sleep/blob/master/ESP32.xlsx

1 Like

@Wanek: very useful, thank you!

Could you perhaps extend the xls with ‘recommended for output’ as well (for e.g. LEDs, Relays, Buzzers and that kind of stuff)?

1 Like

well, it depends what “device” it is hooked on them, i guess. there is no universal rule for that.

you have to take into consideration the pins default behaviour on startup and think about how it will affect your application: for example if you have a mosfet gate on a pin that goes high at startup for some milliseconds, and that mosfet opens your garage door, it is a bad idea… it will open your door everytime the mcu restarts.

if the mosfet just turns on a light, it is no problem if the mcu restarts and the light will be on for 100 millis.

also, if you hook up a small relay directly to a pin, and the other end of the coil is connected to vcc / gnd, that relay can act as a “pullup” / “pulldown” resistor. you have to choose carefully and avoid to change the state of the pins which must be in a specific state for proper boot.

use common sense and EXPERIMENT for yourself.
for example, in one of my projects i found out that even if gpio 2 theoretically has to be high for proper boot, it still boots properly if it pulled low. i do not know why, but it works.

1 Like

yes, I realised that when asking the question, hence I was aiming at ‘simple’ devices like led, but the garage-door is an interesting example of stuff that can go really wrong when not connected right.

But I meant more for the ESP itself, so the last part where you describe the relay that can act as a pullup/down resistor.
In short which pins are ‘safe’ to use under any (withing bounds obviously) condition, which pins are ‘reasonably safe’ and which should not be used for output (unless you really know what you are doing).

Another way would be to describe the ‘risk’ of using that pin in for output.

common sense if far too rare to use too often, hence its too often not used at all :thinking:
and yes I’ve experimented a LOT and found out that some pins used as output (or even set as output) can screw things up.

pins marked with green (safe pins) and light green (quite safe pins) are the best choice both for input and output.

the ones marked with yellow can be used as output with care and experiment.

the grey ones should be avoided. only use them if you do not have other pins left or you know what are you doing.

thnx, that helps. And is it possible that you share the original file as well? So I can add my own notes, I could type it over but thats a bit silly in this day and age. I recall its not allowed on this forum, so perhaps a (e.g. dropbox) link? Its how I share all my stuff)

You meen that link way up at the first post :wink:

please read the original post carefully, there is the google sheet.

@mikekgr recently came across this article about the best pins to use on the ESP32:
https://randomnerdtutorials.com/esp32-pinout-reference-gpios/

Mike shared the article on a private part of the forum, so I’ve added it on to this thread to enable everyone to see it, and to enable me to find it again when I want to reference it.

Pete.

2 Likes

thanks @PeteKnight, this is really usefull. unfortunately i was restricted from the lounge, because in the last months i’ve had no time to activate on this forum. so, i couldn’t read the news :slight_smile:

currently i’m very busy with some projects, but maybe i could put together a new table for the esp32 too.

all the best!

2 Likes

I thought you were there before… so I just kicked you back in :smile:

1 Like

thanks man! seems you have good memory :wink:
however, i’m not sure how active i will be. but at least i can read the new stuff.

There’s also some good info on ESP32 GPIOs in this free (if you don’t feel like paying) ebook:

The biggest problem with this ebook is that there’s just too much information!
There’s 1228 pages, but page 251 is where the GPIO info is.

Pete.

Yes, for sure it is the best of its kind, but for a fast look for the GPIO pins it is a little easier to have something the above table.

Best Regards,
Mike Kranidis

1 Like

done :wink: ESP32 GPIO pins info, restrictions and features

2 Likes

Hi, and thanks for your efforts!
With respect it seems your SCL and SDA labels need to be reversed.
I am using an SHT31 Sensor on a NodeMCU 0,9 board with an ESP8266-12S, and it is working Ok.
Pins are as follows:-
D1 GPIO5 SCL green wire
D2 GPIO4 SDA yellow wire
Hope this helps!

1 Like

GPIO2 may depends on the board, as well as how hard you pull the signal “down”. For example, pulling GPIO2 low on an ESP01S with an impedance of 10 kohm will cause boot to fail. GPIO2 behaves similar to GPIO1 on an ESP01S with micropython loaded. One difference is GPIO2 has 1 or 2 kohm resistor and LED on GPIO2 on the ESP01S, which prevents the 100 k pulldown from bring the input lower than about 1 V - although, that appears to still read as 0 for input, but may not have much noise immunity.

1 Like