ESP8266 GPIO pins info, restrictions and features

hi blynkers!

the esp8266 mcu is widely used in iot projects. however, most gpio pins on this mcu have special / multiple functionality and are not safe to use in all circumstances.

these “features” are still not well documented and not explained in a friendly manner for newbies. i see lots of cases when the “issues” are simply caused by not knowing which pins to use in which case.

here is a basic table for startup. i’ve collected the info from various sources on the internet, there could be erroneous or missing informations, so, please comment if something is off…

and here is the google sheet, with additional tables and info

edit: i’ve updated the google sheet, so in the far right it now shows the sonoff th10/16 and 4ch pin usage

19 Likes

Have you by a chance ESP32 table like the above?

not yet. though i own some esp32 and i’m interested, but yet i consider the es32 arduino core too buggy and infant for production.

if there will be at least some basic docs and a stable arduino core, i will look into that…

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