Close

ESP8285 GPIO

A project log for One Tube Nixie Clock

It is time to take my nixie hardware testbed from the breadboard stage to something that doesn't have wires sprouting everywhere.

paul-andrewsPaul Andrews 11/26/2017 at 02:100 Comments

Theoretically the ESP8285 has 17 GPIO pins and one ADC pin. The bad news is that many of these are already assigned to specific functions. Some of them are still usable, with restrictions, some aren't usable at all.

First here are GPIO states for various boot modes:

GPIO0GPIO2GPIO15
Normal startup110
Programming010
Boot from SD001

Because these pins have to be in a specific state at startup, they can't be used as inputs. We also need to be aware that GPIO0 might change state if we are using it as an output - i.e., whatever hardware is connected to that pin needs to be able to handle that.

After startup, we can do whatever we want with these pins.

GPIO6, GPIO7, GPIO8 and GPIO11 are completely unuseable.

GPIO16 is used by 'wake from deep sleep', and I would like to play with that.

So, that leaves nine completely unused GPIO pins. We want the following pins:

In addition, I want to play with USB charge detect, so I also want:

That is all nine free pins. However I would also like, if possible to give access to I2C for expansion - that is an additional two pins.

Fortunately, if we are careful, we can also use the three boot pins (GPIO0, GPIO2 and GPIO15).

So, this is the plan:

Pin FunctionRestrictionsClock Use
0Boot mode selectCan't be used as an input. State during boot is dependent on boot mode.Neopixel data
1TX0During boot, debug is output on this pin.SDA
2Boot mode select/TX1Can't be used as an input. There is an external pull-up on this pin, so it also can't be used for applications that require Hi-Z (such as I2C).HV Enable
3RX0During boot, while debug is being output on GPIO1, this is held high. So, if we use GPIO1 as SDA and this as SCL, no data will make it to any slaves.SCL
4SDAThis is the default SDA pin, we moved I2C to GPIO1 and GPIO3 because it can handle the noise at boot, so it frees up this pin.HV Adjust
5SCLThis is the default SCL pin. But we need it for, we moved I2C to GPIO1 and GPIO3 because it can handle the noise at boot, so it frees up this pin.CHRen
6-8FlashOn the ESP8266 these are used to interact with the flash memory. Unfortunately, they are not freed up in the ESP8285.-
9FlashOn the ESP8266, this is used for flash, but on the ESP8285 it is free. Yay!CHR1
10FlashOn the ESP8266, this is used for flash, but on the ESP8285 it is free. Yay!CHR0
11FlashStill not available on the ESP8285-
12MISOSPI Master in/slave out. We don't need it for that...Latch Enable
13MOSISPI Master out/slave inMOSI
14SCKSPI clockSCK
15Boot mode selectCan't be used as an input. There is an external pull-down on this pin.Free
16Wake from sleepThis is used by the deep-sleep mechanism, should we want to use it.Free
A0ADCThis is used for analog in. We attach a LDR to it.LDR

By leaving two pins for I2C, I have an easy way to add more GPIO (including ADC) plus a whole host of peripherals like a little OLED screen for debug.

All control of the clock will be via WiFi, including setting the time, so there is no immediate need to add buttons and switches, but I2C GPIO expansion could be used if more are needed.

Discussions