ESP32-S3 bases/The screw terminal base/14. A first build on the screw terminal base
The screw terminal base · 14 of 22

A first build on the screw terminal base

An LED on GPIO 4 and a button on GPIO 5, wired into the screw blocks one wire at a time. The LED goes on the right block and the button on the left, because GPIO 4 is on the right block and GPIO 5 is on the left.

What goes where

You need an LED, a resistor of a few hundred ohms (330 Ω here), a push button and four short wires. Seat the ESP32-S3 first, with its USB sockets over the boxes printed USB, and leave the cable out while you wire.

The two circuits are on different blocks, and that is the lesson of this base.

WireFromTo
1Right block, 4 (tenth way)Resistor, one end
2Resistor, other endLED, long leg
3LED, short legRight block, GND (second way)
4Left block, 5 (third way)Button, one leg
5Button, other legLeft block, GND (second way)
Which wire goes in which terminal
LED on the right block
Step
GPIO 4 is set to
Terminal for GPIO 4
right block, way 10
Terminal for GND
right block, way 2
LED
lit
The LED is on the right block because GPIO 4 is. The resistor sits in series with the LED, from GPIO 4 to ground. Without it the pin pushes more current through the LED than either is meant to carry.

GPIO 4 is on the dev board's left row and on the right block. GPIO 5 is on the left row and on the left block. Wire by the number printed beside the screw, not by the row.

Stripping a wire and tightening a screw

Strip enough insulation that bare copper fills the clamp and none of the insulation is under it. Back the screw out until you can see the clamp open, put the copper in, and tighten until the wire will not pull out by hand. Then stop: the thread is small. Tug the wire. A screw that has closed on insulation feels tight and tests dead.

Solid wire holds better than fine stranded wire that can splay. If the wire is stranded, twist the strands together first so none of them is left outside.

Why these pins

The list of pins to leave alone is 43 and 44 (serial), 19 and 20 (native USB), 35 to 37 (the PSRAM of an N16R8 module) and 48 (the RGB LED). This base does not bring out 43, 44 or 35 to 37, and GPIO 19 and 20 are the right block's last two ways. GPIO 4 and 5 are on none of those lists and are not read at boot, so the first sketch cannot upset the board.

They are also two of the display plug's spare contacts. With a display fitted, choose two other ways: the display shares the wires.

The sketch

INPUT_PULLUP turns on a weak resistor inside the chip that holds the pin HIGH. The button, when pressed, joins the pin to ground and wins, so the pin reads LOW. That is why the sketch tests == LOW.

millis() / 500 counts half seconds since the sketch started, and % 2 makes it flip between 0 and 1 every half second. The sketch never stops to wait, so it reads the button every pass of the loop.

Reading the result

Open the Serial Monitor at 115200. You get pressed and released as you hold and let go. The two failures separate: nothing printed means the sketch is not running; printed but the LED is dark means the LED wiring.

The code

screw_first_build.ino

Blinks an LED on GPIO 4 once a second. While the button on GPIO 5 is held down, the LED stays lit, and the sketch prints each press and release.

// ESP32-S3 Screw Terminal Base: blink an LED, read a button.
//
// Wiring, one wire per line:
//   Right block, GPIO 4 (tenth way) -> 330 ohm resistor -> LED long leg
//   LED short leg -> right block, GND (second way)
//   Left block, GPIO 5 (third way)  -> button, one leg
//   Button, other leg -> left block, GND (second way)
//
// Seat the ESP32-S3 with its USB sockets over the boxes printed USB
// first, then plug in the cable.
//
// Arduino IDE, Tools menu:
//   Board             ESP32S3 Dev Module
//   USB CDC On Boot   Enabled (Disabled if cable in UART socket)
//   Flash Size        16MB (128Mb)
//   PSRAM             OPI PSRAM
// No library needed.

const int LED = 4;     // right block
const int BUTTON = 5;  // left block

bool wasPressed = false;

void setup() {
  Serial.begin(115200);
  pinMode(LED, OUTPUT);
  pinMode(BUTTON, INPUT_PULLUP);  // HIGH open, LOW pressed
}

void loop() {
  bool pressed = digitalRead(BUTTON) == LOW;
  bool blinkOn = (millis() / 500) % 2 == 0;
  digitalWrite(LED, (pressed || blinkOn) ? HIGH : LOW);

  if (pressed != wasPressed) {
    Serial.println(pressed ? "pressed" : "released");
    wasPressed = pressed;
  }
}

The button reads LOW when pressed, because it joins the pin to ground and INPUT_PULLUP holds the pin HIGH the rest of the time. GPIO 4 and 5 are on no list of pins to avoid: not USB, not PSRAM, not read at boot.

When it does not work

The LED does not light

Check the wire is on the right block's tenth way, labelled 4, and not on the left block, which has no GPIO 4. Then check the LED's long leg is on the resistor side. An LED the wrong way round stays dark and is not damaged by it.

The LED stays dark and nothing prints

The sketch is not running, so look at the board and the upload before the wiring. Check the board is seated with its USB sockets over the boxes printed USB, and that the upload finished. If the red LED on the ESP32-S3 is off, unplug at once: it may be end for end.

The Serial Monitor prints pressed all the time

The button is wired between GPIO 5 and ground, so the pin should read HIGH when it is open. If it reads LOW all the time, a leg of the button is shorted across, which happens when both wires go to the same side of a four-legged button. Use one leg from each side.

A wire pulls out even though the screw is tight

The clamp has closed on insulation, or beside the copper. Back the screw out until you can see the clamp open, put bare copper under it with no insulation inside the clamp, tighten until the wire will not move, and tug it.

Where this goes next

The PinPulse: every GPIO on a pin and a socket, with a light on each.

What the shield does →

Edit this page — content/books/esp32s3-base/screw-first-build.mdx

Questions people ask first

  • Which way round does the ESP32-S3 go on the base?

    Its USB sockets go over the two boxes printed USB, at the bottom of the base, with the antenna end at the top under the display connector.

    Nothing stops the other way: the two sockets are identical, so the board seats just as firmly end for end. Put in backwards, its 3.3 V regulator output ends up wired to ground, and the board can be damaged for good. Seat the board first and plug the USB cable in second, every time.

  • Where does the power for my sensors come from?

    The base has no regulator, no battery connector and no power input. It is powered through the ESP32-S3's own USB sockets, and every power way on it is one of that board's pins carried out.

    The 3V3 ways are the output of the regulator on the ESP32-S3. The 5V ways are the board's 5V pin: about 4.6 V with a USB cable plugged in, and nothing without one. Nothing on the way is switched, fused or filtered.

  • Can I run a motor, relay or LED strip from the base?

    Not from its power ways. Motors, relays, servos and long LED strips need their own supply, with its ground joined to a GND way on the base, because the ESP32-S3's regulator is small and is also running your sketch.

    Small sensors and a display can take 3V3 and ground from the base. No current rating is quoted for the ways, because none has been checked.

  • How many GPIOs does the Pluggable Terminal Base bring out?

    24 of the ESP32-S3 Gold's 36 GPIOs, once each, on two 12-way push-in blocks, plus two 4-way power blocks.

    Twelve do not come out: 0, 1, 2, 3, 4, 35, 36, 37, 43, 44, 45 and 46, and the RST pin. GPIO 1, 2 and 4 reach the display connector and nothing else. All of the I²C and SPI pins are on the left block, and GPIO 19 and 20 (the native USB pair, on the right block) should be left alone while a sketch is using USB.

  • How many GPIOs does the Screw Terminal Base bring out?

    26 of the ESP32-S3's GPIOs, once each, on two 15-way screw terminal blocks, with 3V3 on the left block and 5V on the right. Ten GPIOs do not come out.

    The native USB pins (GPIO 19 and 20) are on the right block: a wire on either one shares the USB lines with the computer, so leave them alone unless the sketch is not using native USB.

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 →