TinySkiff ESP32-S3 Lab · Day 10 of 30

Give the board
a voice

Today the board makes sound. You wire an active buzzer through a small transistor, add a push button, and upload a sketch that beeps the moment you press — a doorbell you built yourself. The transistor is the new trick: it lets a gentle pin switch a load the pin could never drive alone.

About 25 minutesArduino firstMicroPython optionalNo electronics assumed
Agent assist code TSK-DAY10-BUZZER

Hand this to an agent so it can pull the lesson packet and coach you step by step.

01 First, know the pieces

What you need

Nine things, most of them tiny. Tap Define on any part you haven't met — the answer opens as a field note you can read and dismiss without losing your place.

Official manual photo of the ESP32-S3 development board.
Manual photo

ESP32-S3 board

The brain that runs your uploaded sketch.

Official manual image of the ESP32-S3 GPIO extension board.
Manual photo

GPIO extension board

Spreads the pins into rows you can reach and label.

Official manual photo of a small round active buzzer.
Manual photo

Active buzzer

Makes one fixed tone whenever it gets power.

Official manual photo of an NPN transistor with three legs.
Manual photo

NPN transistor

A tiny switch the pin controls to drive the buzzer.

Official manual photo of a four-pin push button switch with its pin pairs labelled 1 and 2.
Manual photo

Push button

A four-pin switch that closes the circuit when pressed.

Official manual photo of a resistor with coloured value bands.
Manual photo

1 kΩ resistor

Sits between the pin and the transistor's base to keep the current gentle.

Official manual photo of a resistor with coloured value bands.
Manual photo

2 × 10 kΩ resistors

Hold the button's pin at a steady level until you press.

Official manual image of a jumper wire.
Manual photo

Jumper wires

Temporary, solder-free connections.

Official manual screenshot of the Arduino IDE interface.
Manual screenshot

Arduino IDE

Uploads the sketch to the board.

02 Make the physical circuit

Chart the circuit

The official Freenove diagram is your chart — schematic on top, the same circuit built on a breadboard below. Click it to enlarge. Each connection tells you where the wire goes and why.

Official Freenove circuit — C Tutorial, Chapter 6 (Buzzer), page 80.
Buzzer + 5V rail The buzzer draws more current than a pin can give so it runs off 5V.
Transistor base (via 1 kΩ) GPIO 14 The pin switches the buzzer through the transistor.
Push button GPIO 21 The board reads this pin to catch the press.
10 kΩ resistor 3.3V Holds GPIO 21 HIGH until a press pulls it LOW.

Mind the transistor's legs. The transistor's three legs have their own jobs — emitter, base, and collector — so get them the right way round against the chart. Unplug USB before you move any wire.

03 One action at a time

Build it

This is the main path — you can finish the day without opening a single field note. Tap each step as you go to keep your place.

0 / 8 done
  1. Seat the ESP32-S3 on the GPIO extension board and keep USB unplugged while you wire.

  2. Place the transistor on the breadboard and note its three legs — emitter, base, and collector.

  3. Wire the buzzer's + pin to the 5V rail and its other pin down to the transistor.

  4. Connect the transistor's base to GPIO 14 through the 1 kΩ resistor.

  5. Wire the push button so one side reaches GPIO 21, then add its 10 kΩ pull-up to 3.3V.

  6. Compare every wire to the chart before you plug in USB.

  7. Open Sketch_06.1_Doorbell.ino in Arduino IDE and upload it.

  8. Press the button and listen.

The board can speak.

Press for a beep, release for silence — your first doorbell. Head to Test & debug to confirm the sound.

04 Read just enough code

Read the code

The whole sketch is short. Two lines set the pins up; the loop just asks the button and answers with the buzzer. Switch to MicroPython if you'd rather see the same idea in Python — the wiring never changes.

Sketch_06.1_Doorbell.ino
#define PIN_BUZZER 14
#define PIN_BUTTON 21

void setup() {
  pinMode(PIN_BUZZER, OUTPUT);
  pinMode(PIN_BUTTON, INPUT);
}

void loop() {
  if (digitalRead(PIN_BUTTON) == LOW) {
    digitalWrite(PIN_BUZZER, HIGH);   // pressed -> beep
  } else {
    digitalWrite(PIN_BUZZER, LOW);    // released -> silent
  }
}
digitalRead(PIN_BUTTON) == LOWTrue only while the button is held — a press pulls GPIO 21 LOW.
digitalWrite(PIN_BUZZER, HIGH)Sends the pin HIGH, which switches the buzzer on through the transistor.
ledcWriteTone(channel, freq)The passive-buzzer variant (Sketch_06.2_Alertor) uses ledcWriteTone to choose the pitch and sweep a siren.

05 Understand, don't memorise

Active buzzers, passive buzzers, and the transistor

There's no trick here — the pin does the deciding, and a small transistor does the heavy lifting the pin can't.

Sense

Button in

digitalRead checks GPIO 21 many times a second.

Trickle

Weak pin

The pin can only supply a trickle of current on its own.

Switch

Transistor

The transistor uses that trickle to switch the 5V buzzer.

Silence

Release

Let go and the transistor opens so the buzzer goes silent.

The model press → transistor switches 5V → buzzer sounds

Active vs passive buzzers

An active buzzer has its own oscillator and plays one fixed tone. A passive buzzer is silent until you feed it a changing signal, so you choose the pitch.

What the transistor is for

The pin can't supply the buzzer's current. The transistor lets the small pin signal switch the larger 5V current on and off.

06 Know it worked

Test & debug

Nothing prints to the screen today — the proof is the sound under your finger.

What you should hear
Buzzer
  • Press and hold the button — a steady beep sounds at once.
  • Let go — silence.
  • Every press sounds the same note, for as long as the board has power.

An active buzzer plays one fixed tone — choosing the pitch is the passive-buzzer variant's job.

If it doesn't
  • No sound at all? Check the transistor legs are the right way round, and that the buzzer + goes to 5V.
  • Always sounding? The button or its 10 kΩ pull-up is likely miswired on GPIO 21.
  • Very faint? The buzzer may be on 3.3V instead of 5V — move it to the 5V rail.
  • Upload fails? Swap in a data-capable USB cable.

07 Make the idea yours

Try this: invent a signal

Same working circuit, one new idea: giving a sound a meaning. It fits inside today's 30 minutes.

Invent a signal

Design a two-beep pattern — short-short, or short-long — and write down what it means. Press it out by hand and see if a listener can read it.

Hear a siren

Swap in the passive buzzer and upload Sketch_06.2_Alertor.ino to hear a siren instead of a single note. Notice how choosing the pitch changes everything.

Logbook

08 Learn it with a hand on the tiller

Coach me through it

Every lesson ships with a code and a machine-readable packet, so an agent can guide you with full context.

Lesson code

TSK-DAY10-BUZZER

How the agent should behave: guide one physical connection at a time, wait for you to confirm, explain terms on request, and always check the transistor orientation, wiring, board, port, and USB before changing code.

Field note

Shortcut

Prompt copied