A first build on the expansion base
An LED and a push button on three jumper wires, all at the top of the left strip: GPIO 4 blinks the LED, GPIO 5 reads the button with its internal pull-up, and ground is the hole between them and the supply.
Two pins and a ground
Seat the board first, with its USB sockets over the boxes printed USB, as the first page of this chapter says. Then wire the build before the cable goes in.
Everything sits at the top of the left strip. Counting holes down from the display connector, hole 1 is 3V3, hole 2 is GND, hole 3 is GPIO 4 and hole 4 is GPIO 5. The ground is next to the signals, so the jumpers are short.
The strips are 2.54 mm, so a breadboard takes jumper wires from them and nothing else is needed. Each hole is on two strips at once, so use whichever your wire end fits. The 3D model draws the outer strip as pins and the inner as a socket; look at your own board.
Why these two pins
Not every pin on a strip is a good first choice. GPIO 19 and 20 are the native USB port, GPIO 48 is the RGB LED, and GPIO 3 is read at boot, so a wire there can change how the board starts. 0, 35 to 37 and 43 to 46 are the ones that stop on the socket and never reach a strip. GPIO 4 and 5 are free on all counts.
The sketch
The LED half is the whole of step one: pinMode(LED_PIN, OUTPUT) and a
digitalWrite HIGH and LOW with a delay between. The resistor is not optional.
A GPIO is not meant to drive an LED straight, and without one the LED draws more
than the pin should give.
Step two adds pinMode(BUTTON_PIN, INPUT_PULLUP). That switches on a resistor
inside the chip between the pin and 3V3, so the pin reads HIGH on its own. The
button joins it to ground, and the read goes LOW while it is held. The base has
no pull-ups of its own, so without that line the pin floats and reads noise.
Before you upload, set Tools -> Board to ESP32S3 Dev Module, USB CDC On Boot to Enabled, Flash Size to 16MB and PSRAM to OPI PSRAM. The same list is at the top of the sketch, so it travels with the file.
The code
Blinks an LED on GPIO 4 once a second. Hold a button on GPIO 5 and it blinks five times as fast, and the Serial Monitor says so.
// ESP32-S3 Expansion Base: blink an LED, speed it up with a button.
//
// Seat the ESP32-S3 with its two USB sockets over the boxes printed
// USB on the base, then plug a cable into either socket.
//
// Wiring, left strip, holes counted from the display connector:
// hole 3 (GPIO 4) -> 330 ohm resistor -> LED long leg
// LED short leg -> GND rail
// hole 4 (GPIO 5) -> one side of the push button
// other side -> GND rail
// hole 2 (GND) -> GND rail
//
// Arduino IDE, Tools menu:
// Board ESP32S3 Dev Module
// USB CDC On Boot Enabled (Disabled: UART socket)
// Flash Size 16MB (128Mb)
// PSRAM OPI PSRAM
// Serial Monitor 115200
// No library needed.
const int LED_PIN = 4;
const int BUTTON_PIN = 5;
void setup() {
Serial.begin(115200);
pinMode(LED_PIN, OUTPUT);
pinMode(BUTTON_PIN, INPUT_PULLUP); // reads LOW while pressed
}
void loop() {
bool pressed = digitalRead(BUTTON_PIN) == LOW;
int wait = pressed ? 100 : 500; // milliseconds on, and off
digitalWrite(LED_PIN, HIGH);
delay(wait);
digitalWrite(LED_PIN, LOW);
delay(wait);
if (pressed) Serial.println("button held: blinking fast");
}Both pins are on the left strip and neither is used by anything on the ESP32-S3 board or read at boot. The button needs no resistor: INPUT_PULLUP turns on a pull-up inside the chip, so the pin reads HIGH until the button joins it to ground.
When it does not work
Turn the LED round: the long leg goes to the resistor and the short leg to ground. Then check the jumper is in hole 3 of the left strip, counted from the display connector, and that the ground jumper is in hole 2. A pin that is not in the sketch's list does nothing.
The button reads LOW when pressed, so one side goes to GPIO 5 and the other to ground. A button wired to 3V3 instead never pulls the pin low. A wire loose in hole 4 leaves the pin floating, which can look like random presses.
That is the ESP32-S3 and the cable, not the base. Check the Port in the Tools menu, try the other USB socket, and if it still fails hold BOOT, press and release RST, then release BOOT and upload again.
Check which strip you are using. The 3D model draws the outer strip as pins and the inner as a yellow socket, so a jumper with a socket end goes on the outer strip and one with a pin end goes in the inner. Both strips are the same copper.
The pluggable terminal base: the same board, the same warning, a different way in for the wires.
Seat the board first →Edit this page — content/books/esp32s3-base/expansion-first-build.mdx
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.