ESP32 bases/Pins and power/07. The pins that come out
Pins and power · 07 of 10

The pins that come out

The ESP32 has thirty-two GPIOs. No base brings out more than twenty-four, and the two terminal bases stop at twenty and nineteen. Here is which ones, and why each of the missing is missing.

Thirty-eight pins, twenty-four you can use

Count the pins on the dev board and you get thirty-eight: thirty-two GPIOs, two supply pins, three grounds and EN. Count the GPIOs at the edge of an expansion base and you get twenty-four.

Which pins reach the edge
24 of 32 GPIOs
Base
GPIOs out
24
Never out
8
Missing here
0
Twenty-four of the thirty-two, which is all a base can offer. The other eight are spoken for on the module itself: GPIO 6 to 11 run to the flash chip under the metal can, and GPIO 1 and 3 are the serial link your computer talks over. None of the four bases brings any of them out, and a base that did would be selling you a pin you must not use.

The eight that never appear are not an omission. Six of them — GPIO 6 to 11 — run to the flash chip inside the module's metal can, where the program you just uploaded lives. A wire on any of those stops the board booting. The other two — GPIO 1 and 3, printed TX and RX — are the serial link your computer programs the board over.

A base that brought those eight out would be selling you eight pins you must not use.

The ESP32 Gold Edition board at an angle: a black board printed lonely binary GOLD EDITION, the cream WROOM module and its PCB antenna at the far end, a USB-C socket and two small buttons at the near end, and a row of male header pins soldered down each long edge with the GPIO numbers printed on the board beside them — 6, 7, 8, 15, 2, 0, 4, 16, 17, 5, 18, 19 and 21 along the near edge.
The board itself, and the thirty-eight pins a base has to catch. Six of them — GPIO 6 to 11, three on each edge at the USB end — run to the flash chip under the metal can, and no base brings any of them out.

Then the terminal bases drop five more

Twelve terminals a side is twenty-four terminals, and each block spends two of them on 3.3 volts and a ground. That leaves twenty places for twenty-four GPIOs, and something has to go.

ExpansionPinPulsePluggableScrew
GPIOs at the edge24242019
GPIO 36, 39yesyes
GPIO 0, 2yesyes
GPIO 12yesyesyes
5 V at the edgeyesyesyes

The four both terminal bases drop are the four with the most conditions attached anyway:

GPIO 36 and 39 are input-only. They can read a voltage and they can never drive one. digitalWrite on them does nothing at all.

GPIO 0 and 2 are strapping pins. The chip reads them while it boots to decide whether to run your program or wait for an upload, so anything attached to them has to be quiet for the first quarter of a second.

The screw terminal base drops a fifth, GPIO 12, which is also a strapping pin — and spends the terminal on a 5 volt output instead.

What the display connector reaches

Thirteen of the twenty-four also appear on the fifteen-way display connector, and that is true on all four bases including the terminal ones. GPIO 2 has no terminal on either terminal base, but it does have a pin on the ribbon — so a display can use it even where a screwdriver cannot.

When it does not work

My sketch uses GPIO 9 and the base has no row for it

GPIO 6 to 11 are wired to the SPI flash chip inside the module's metal can. They appear on the dev board's own header, and putting anything on one of them stops the chip booting. No base brings them out, which is the base protecting you from the dev board.

Where are TX and RX?

They are GPIO 1 and 3, and they are the serial link the USB port programs the board over. No base brings them out either. If you need a second serial port, the ESP32 can put UART1 or UART2 on almost any free GPIO — pick two from the rows that do come out.

I wired GPIO 36 as an output and nothing happens

GPIO 34, 35, 36 and 39 are input-only on the classic ESP32. No pinMode will make them drive anything. They read voltages perfectly well, which is what they are for.

My project needs GPIO 0, 2, 12, 36 or 39 and I have a terminal base

Those are exactly the five the terminal bases drop, and there is no way to reach them from a terminal. The display connector carries GPIO 0's neighbours but not GPIO 0. Either move the signal to a pin that is brought out, or use the expansion or PinPulse base, which have all twenty-four.

Where this goes next

Where the 3.3 and 5 volts come from, and which base has which.

Power out of the base

Edit this page — content/books/esp32-base/the-pins-that-come-out.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

This page covers several products. Choose yours to see the right discussions.

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum