-->
Page 1 of 2

How many GPIO inputs can I get?

PostPosted: Mon Feb 06, 2017 9:22 am
by SteveBaker
I'm trying to build a project that reads 8 GPIO inputs. On paper, it looks like I have enough pins - but in practice, only maybe 3 of them work.

I'm using a ESP-12F module.

I suspect I have to do some setup to turn off stuff like HSPI - to free up those pins - but I don't know how.

Which of these can I actually use?

GPIO_0 : Used during boot
GPIO_1 : The is the TXD0 pin by default
GPIO_2 : AVAILABLE
GPIO_3 : This is the RXD0 pin by default
GPIO_4 : AVAILABLE
GPIO_5 : AVAILABLE
GPIO_6 : Used to access flash memory or something?
GPIO_7 : ditto
GPIO_8 : ditto
GPIO_9 : ditto
GPIO_10 : ditto
GPIO_11 : ditto
GPIO_12 : This is the HSPI MISO pin
GPIO_13 : This is the HSPI MOSI pin
GPIO_14 : This is the HSPI CLK pin
GPIO_15 : Seems to have to be grounded for the machine to boot.
GPIO_16 : This is the ADC pin

Re: How many GPIO inputs can I get?

PostPosted: Mon Feb 06, 2017 1:49 pm
by GengusKahn
Hi there, look at the link for more detail, the pins 1,3,4,5,12,13,14 can All be used as you wish but ADC, Pin 0,2,15,16 have limitations but can still be used.

Pin 10 on an ESP8266-12E can be used in DIO Mode(In the IDE)....

https://github.com/esp8266/Arduino/blob/master/doc/reference.md#digital-io

Re: How many GPIO inputs can I get?

PostPosted: Mon Feb 06, 2017 2:19 pm
by SteveBaker
GengusKahn wrote:Hi there, look at the link for more detail, the pins 1,3,4,5,12,13,14 can All be used as you wish but ADC, Pin 0,2,15,16 have limitations but can still be used.

Pin 10 on an ESP8266-12E can be used in DIO Mode(In the IDE)....

https://github.com/esp8266/Arduino/blob/master/doc/reference.md#digital-io


I guess I hadn't thought of using 1 and 3 because those are also TxD and RxD, which are really handy for debugging and flashing! But I guess I could debug over WiFi and put a couple of switches in there to disconnect them while I'm flashing.

Pin 2 seems to work OK too - so long as it can float high during startup. But I can work around that...so I guess that gets me 1,2,3,4,5,12,13,14 - which is just enough. It would have been nice to have TxD and RxD still...but that's life.

Re: How many GPIO inputs can I get?

PostPosted: Mon Feb 06, 2017 2:42 pm
by martinayotte
If you need more GPIOs, you can use I2C GPIO Expander such MCP23017, which provides new 16 IOs, and attach it to an I2C using GPIO2/GPIO0, which are perfect match because those pins requires PullUps and I2C bus also, and you can still go into Upload mode by pressing GPIO0 button.