Skip to content
esp-labsESP32-S3 bench guide
ESP32-S3 DevKitC pinoutThis lesson uses: VCC on 3V3, BLK on 7, RES on 8, DC on 9, CS on 10, SDA on 11, SCL on 12, GND on GND, BTN on 5, BOOT on 0.ESP32-S3WROOM-1 N16R8BOOTRSTRGBUSBCOM3V3VCC3V3RST45BTN67BLK151617188RES3469DC10CS11SDA12SCL13145VGNDGNDGNDTX 43RX 441242414039383736350BOOT454847212019GNDGND
  • used in this lesson
  • safe GPIO
  • avoid
  • power
  • ground
  • button input
  • RC522
Between lessons
  1. Ctrl+C closes the monitor on the Mac only. The board keeps running.
  2. Unplug USB: this is what stops the program and the screen
  3. Rewire while off
  4. Check VCC is on 3V3, no loose ends
  5. Plug in, flash the next lesson

Never unplug during Writing at 0x…. Pin changing from output to input? Flash first, then wire.

Lesson B3

Bluetooth LE · lesson 3 of 8

Your phone connects, reads and writes

built, not flashed

Advertising is shouting; a connection is a private conversation. The phone (the central) connects to the board (the peripheral), and from then on they meet on a fixed beat, the connection interval, hopping over 37 data channels. On the board sits a small database, the GATT table: the Bench service with LED, Message, Button, Temperature and Uptime. From nRF Connect or LightBlue you write the LED's colour, put a message on the screen, read the chip's temperature and subscribe to the button.

Goal

Control the board from your phone over Bluetooth, and see every operation arrive on the gatt view.

You're done when

  • nRF Connect (or LightBlue) shows Bench B3, connects, and lists the Bench service with five named characteristics plus Device Information and Battery.
  • Writing FF5000 to LED turns the on-board LED orange, and the LED row flashes blue on the gatt view.
  • Writing text to Message shows it big on the message view.
  • After you subscribe to Button, every click on the board arrives on the phone as a notification; the Temperature notifies every 2 s.
  • The link view shows the connection interval, MTU and RSSI, and params slow visibly changes the interval.

You will learn

  • central & peripheral
  • GATT: services & characteristics
  • UUIDs (16 & 128-bit)
  • read · write · notify
  • CCCD (subscribing)
  • MTU
  • connection interval
uv run pio run -d labs/ble-lab-b3 -e ble-lab-b3 -t upload
Open this lab's code on GitHubesp-labs / labs / ble-lab-b3 (opens in a new tab)

Parts required

Parts library
  • ESP32-S3-DevKitC-1 + USB-C data cable
  • 1.9″ ST7789 screen
  • Smartphone (Bluetooth)
  • Optional: Push button

From advert to conversation, step by step

What happens when you tap Connect in nRF Connect, and when you write the LED or the board notifies a click. Each step shows the real ATT bytes: the first byte is the opcode, the next two the handle (the row number in the board's table), the rest the value.

BLE GATT client-server interaction sequence covering connection, MTU exchange, service discovery, Read, Write, and Notify. What happens when you tap Connect in nRF Connect, and when you write the LED or the board notifies a click. Each step shows the real ATT bytes: the first byte is the opcode, the next two the handle (the row number in the board's table), the rest the value.

  • Key concepts: central & peripheral, GATT: services & characteristics, UUIDs (16 & 128-bit), read · write · notify, CCCD (subscribing), MTU, connection interval.
  • Signals & pins: 3V3 (VCC), GPIO7 (BLK), GPIO8 (RES), GPIO9 (DC), GPIO10 (CS).

Interactive diagram loads after page initialization.

The Bench service, live

The board's GATT table as nRF Connect shows it. Press an operation to send it: the packet crosses over, the board's row lights like on the gatt view, and the bytes are decoded underneath.

GATT attribute table layout showing Service UUIDs, Characteristic handles, properties, and CCCD descriptors. The board's GATT table as nRF Connect shows it. Press an operation to send it: the packet crosses over, the board's row lights like on the gatt view, and the bytes are decoded underneath.

  • Key concepts: central & peripheral, GATT: services & characteristics, UUIDs (16 & 128-bit), read · write · notify, CCCD (subscribing), MTU, connection interval.
  • Signals & pins: 3V3 (VCC), GPIO7 (BLK), GPIO8 (RES), GPIO9 (DC), GPIO10 (CS).

Interactive diagram loads after page initialization.

What the screen shows

Four views. A click goes to the next view; every gesture (click, double-click, long press) is also sent to a subscribed phone as a Button notification. A double-click on the gatt and message views sends an extra click.

Gallery of ST7789 screens shown across the ESP32-S3 Bluetooth LE labs. Four views. A click goes to the next view; every gesture (click, double-click, long press) is also sent to a subscribed phone as a Button notification. A double-click on the gatt and message views sends an extra click.

  • Key concepts: central & peripheral, GATT: services & characteristics, UUIDs (16 & 128-bit), read · write · notify, CCCD (subscribing), MTU, connection interval.
  • Signals & pins: 3V3 (VCC), GPIO7 (BLK), GPIO8 (RES), GPIO9 (DC), GPIO10 (CS).

Interactive diagram loads after page initialization.

Commands, in order

Type these in the serial monitor (uv run pio device monitor) unless the grey tag says otherwise. The coloured tag says what should be near the board while it runs.

  1. uv run pio run -d labs/ble-lab-b3 -e ble-lab-b3 -t uploadMac terminalno phone needed
    Does
    Builds lab B3 and writes it to the board.
    You should see
    The gatt view with five rows; the radio icon shows rings: advertising.
    If not
    “Failed to connect”: hold BOOT, tap RST, release BOOT, run it again.
  2. uv run pio device monitorMac terminalno phone needed
    Does
    Opens the serial monitor.
    You should see
    - advertising as "Bench B3", then the command list.
  3. nRF Connect → Scanner → Bench B3 → Connecton your phonephone: scanner app open
    Does
    Your phone connects. Install nRF Connect for Mobile (Nordic, free; iPhone and Android) or LightBlue. On iPhone, never connect from Settings → Bluetooth: apps do it.
    You should see
    Monitor: + connected: 5A:3C:… and - interval 30.00 ms …, soon - MTU 255: 252 bytes of data per packet. The radio icon turns into two rings, the LED steady blue.
    If not
    Bench B3 not listed: scroll, or filter by name “Bench”. Still nothing: adv on.
  4. LED → write → 0xFF5000 (byte array)on your phonephone connected
    Does
    Writes 3 bytes: red FF, green 50, blue 00.
    You should see
    < write LED FF 50 00; the on-board LED glows orange; the LED row flashes blue and shows the colour swatch.
    If not
    LED wants 3 bytes, got 1: choose Byte Array, not Text or UINT8.
  5. Message → write → Text “hello bench”on your phonephone connected
    Does
    Writes UTF-8 text (up to 40 bytes).
    You should see
    < write Message "hello bench"; click to the message view: big text, “written 3s ago”.
    If not
    Accents show as boxes: the screen font is plain ASCII.
  6. Button → subscribe (the ↓↓↓ / bell icon), then click the board's buttonon your phonephone connected
    Does
    Subscribing writes 01 00 into the Button's CCCD. Each gesture then pushes a 3-byte value: gesture, count (2 bytes).
    You should see
    < subscribe Button (CCCD = 1), then per click > notify Button: click #3; the phone shows 01-03-00. A bell appears on the Button row.
    If not
    (nobody subscribed) in the monitor: subscribe first.
  7. Temperature → read, then subscribeon your phonephone connected
    Does
    Reads 2 bytes (°C × 100, little-endian). The 2904 descriptor tells apps how to show it.
    You should see
    nRF Connect shows 41.42 °C (raw 2E-10); subscribed, it updates every 2 s.
  8. params slow, then params fastserial monitorphone connected
    Does
    Asks the phone for a 100-200 ms interval (and to let the board skip 4 events), then for 15-30 ms. The phone decides.
    You should see
    - new params: 112.50 ms, latency 4; the dot on the link view slows down. Notifications now arrive in bursts.
    If not
    params rejected or ignored: iPhones refuse some values; try again after a few seconds.
  9. disconnectserial monitorphone connected
    Does
    Hangs up. The board advertises again by itself.
    You should see
    ! disconnected 0x16: we hung up; the link view keeps the reason.

Steps

0 of 6 ticked. Ticks are saved in this browser.

Anyone nearby can connect to Bench B3 and change the LED: there is no pairing yet, everything travels in plain text. That's B4. iPhones cache a device's GATT table: if a later lab changes the table and the iPhone shows old rows, turn Bluetooth off and on. The ESP32-S3 has one radio: B3 doesn't use Wi-Fi, so there is no coexistence to worry about.

Preview: what you should see

Interactive BLE scanner and GATT monitor simulating NimBLE advertising discovery and characteristic updates.

  • Key concepts: central & peripheral, GATT: services & characteristics, UUIDs (16 & 128-bit), read · write · notify, CCCD (subscribing), MTU, connection interval.
  • Signals & pins: 3V3 (VCC), GPIO7 (BLK), GPIO8 (RES), GPIO9 (DC), GPIO10 (CS).

Interactive diagram loads after page initialization.

ESP32-S3 peripherals used in this lab

Open interactive GPIO pinout

Explore the hardware blocks, pin rules, and registers behind this experiment.

  • GPIO and IO MUX

    45 pins, and a matrix that routes almost any signal to almost any pin

  • SPI

    Fast four-wire bus for screens, card readers and flash

  • Bluetooth LE

    Bluetooth 5 Low Energy: beacons, phones, keyboards, MIDI

  • Temperature sensor

    Measures the die's own temperature

  • UART

    Three serial ports, the one you see in the serial monitor

  • CPU

    Two Xtensa LX7 cores at up to 240 MHz

Troubleshooting & hardware gotchas

See all 17 ESP32-S3 hardware gotchas
What if it does not work or behaves unexpectedly?
Anyone nearby can connect to Bench B3 and change the LED: there is no pairing yet, everything travels in plain text. That's B4. iPhones cache a device's GATT table: if a later lab changes the table and the iPhone shows old rows, turn Bluetooth off and on. The ESP32-S3 has one radio: B3 doesn't use Wi-Fi, so there is no coexistence to worry about.
If “uv run pio run -d labs/ble-lab-b3 -e ble-lab-b3 -t upload” does not work
“Failed to connect”: hold BOOT, tap RST, release BOOT, run it again.
If “nRF Connect → Scanner → Bench B3 → Connect” does not work
Bench B3 not listed: scroll, or filter by name “Bench”. Still nothing: adv on.
If “LED → write → 0xFF5000 (byte array)” does not work
LED wants 3 bytes, got 1: choose Byte Array, not Text or UINT8.
If “Message → write → Text “hello bench”” does not work
Accents show as boxes: the screen font is plain ASCII.
If “Button → subscribe (the ↓↓↓ / bell icon), then click the board's button” does not work
(nobody subscribed) in the monitor: subscribe first.
If “params slow, then params fast” does not work
params rejected or ignored: iPhones refuse some values; try again after a few seconds.
Four pins are read at reset
GPIO0, GPIO3, GPIO45 and GPIO46 are sampled the moment the chip comes out of reset: they pick the boot mode, the flash voltage, the ROM log and the JTAG source. Anything wired to them must not pull them the wrong way at power-up. After reset they are normal pins again.
GPIO3 has no pull resistor at reset
GPIO0 has a weak pull-up and GPIO45/46 weak pull-downs, but GPIO3 floats. When the eFuses make it choose the JTAG source, an outside circuit has to hold it at a clear level.
GPIO47 and 48 run at 1.8 V on R16V modules
Modules with the ESP32-S3R16V chip set the flash voltage to 1.8 V, and GPIO47/48 share that supply. A 3.3 V part on those pins sees the wrong levels.
The pins are not 5 V tolerant
A high input may go up to the pin's supply plus 0.3 V, so about 3.6 V on a 3.3 V board, and the power pins are rated to 3.6 V at most. 5 V from a sensor or an Arduino can damage the chip: use a level shifter or a divider.