ESP32-C3 OLED/The board in your hand/02. The sixteen pins, and the six already spoken for
The board in your hand · 02 of 9

The sixteen pins, and the six already spoken for

Eight holes down each side, and three of the sixteen are power. Of the thirteen that are GPIOs, six are already answering to something before your sketch starts — including the two the screen sits on.

Two spellings for the same hole

The left header is easy: the number printed beside the hole is the GPIO number, from 3 at the top down to 10 at the bottom. The right header is where people lose an afternoon. TX and RX are GPIO 21 and 20. V3, GD and V5 are not GPIOs at all — they are the 3.3 V rail, ground, and USB bus voltage.

Tap a hole and switch between the three readings:

Sixteen holes, thirteen GPIOs, seven free
spoken for
Read the holes as
Printed / in code
5 → GPIO 5
Already spoken for
OLED SDA
GPIO 5 is taken: OLED SDA. It is still a hole you can solder to, and the board will not stop you — it is just already doing a job, and the job usually wins. Six of the thirteen GPIOs are like this, which leaves 7 for you.

Sixteen holes. Three are power. Of the thirteen GPIOs, six already have a job.

The six that are taken

PinTaken byWhat that costs you
GPIO 5OLED SDAShared with anything else I²C; unusable for anything else
GPIO 6OLED SCLSame
GPIO 8Blue LED, plus a 10 kΩ pull-upMust be high at reset, or uploads stop working
GPIO 9The BOO button, and a strapping pinHeld low at reset, the board waits for an upload
GPIO 21UART0 TXThe ROM boot log comes out here at every reset
GPIO 20UART0 RXHalf of the same port

None of those are forbidden. They are holes with something already on them, and the something usually wins. GPIO 5 and 6 are the interesting case: they are a bus, so another I²C device with a different address is welcome on them — that is what a bus is for — and anything that is not I²C is not.

The seven that are yours

GPIO 0, 1, 2, 3, 4, 7 and 10.

Five of the thirteen GPIOs on this chip have an ADC behind them, and they are GPIO 0 to 4. Two of those five (0 and 1) also carry the 32 kHz crystal pins on chips that have one; this board does not fit that crystal, so all five are available as analog inputs. GPIO 2 is the one to leave alone if you plan to use the battery monitor — bridging the pad on the expansion base connects the battery divider to it permanently.

That leaves GPIO 3 and 4 as the analog inputs to reach for first, and 7 and 10 as plain digital pins with nothing attached to them at all.

Boot, and the two pins that decide it

GPIO 2, 8 and 9 are strapping pins: the chip samples them once as reset is released and then forgets about them. Boot mode is read off 8 and 9 together. GPIO 9 high means "run the sketch", which is what the board's pull-up gives you. GPIO 9 low with GPIO 8 high means "wait for an upload", which is the whole of manual download mode. Both of them low is a combination the chip rejects.

The practical rule is one sentence long. Anything you attach to GPIO 2, 8 or 9 has to leave it alone for the first half second after power arrives, or you have built a board that sometimes does not start and gives no reason.

When it does not work

A module wired to pin 5 or 6 makes the screen misbehave

Those two are the display's bus. Anything else you put on them shares it, which is fine for another I²C device with a different address and fatal for anything that is not I²C at all. If you wired an LED, a button or a sensor's data line to 5 or 6, move it.

Uploads stop working once something is attached to pin 8

Download mode needs GPIO 8 high and GPIO 9 low at reset, and the board provides the first with a 10 kΩ pull-up. Anything holding GPIO 8 low at that instant — an LED to ground, a sensor that drives it — leaves the chip with both strapping pins low, which is a combination it treats as invalid. The sketch that is already flashed still runs; you just cannot replace it until the thing comes off.

TX and RX are not GPIO 20 and 21 in the IDE's pin numbering

They are, but the silkscreen prints their role rather than their number. Write 21 and 20 in code, not "TX" and "RX". If you need Serial output rather than a spare pair of pins, use the USB socket instead and leave these alone.

An analog reading on pin 7 or 10 returns nothing useful

Only GPIO 0 to 4 have an ADC behind them on this chip. analogRead on any other pin compiles, runs and returns a number that means nothing. If you need to read a voltage, it has to be one of those five, and on this board three of them are free.

Where this goes next

The base gives the board a battery and a switch, and it will seat perfectly in the orientation that destroys it. One check, and what it is checking.

The expansion board, and which way round it goes

Edit this page — content/boards/c3-oled/the-sixteen-pins.mdx

Community

Questions about this product

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

Ask a question ↗

ESP32-C3 OLED Development Board with Expansion Base

Loading 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 ESP32-C3 OLED on the forum