Doorbell with a Buzzer
Beginner20 minA doorbell that plays a four-note "ding-dong" on a passive buzzer when you press the button; every ring is also written to the Serial Monitor. It teaches making sound with tone(), keeping notes and their lengths in arrays and playing them with a for loop, gathering a job into its own function, and reading a button with the Arduino's built-in pull-up resistor (INPUT_PULLUP). You can make the tune your own by changing the notes in the code. No extra library needed.
Build it step by step in the appWhat you need
1 × Arduino Uno R3
1 × Breadboard 830 Points (MB-102)
1 × Passive Buzzer (Piezo)
1 × 12x12 mm Push Button
5 × Jumper Wire - Male/Male
Wiring steps
- 1
Connect the common ground (GND)

Plug a black jumper wire into the GND pin next to pin 13 on the Arduino's digital header. Connect its other end to the breadboard's top blue (−) rail. The button's and the buzzer's ground wires will go into this rail too.
- Arduino GND → the top blue (−) rail (black wire)
- 2
Add and wire the button

Seat the button over the middle gap of the breadboard: two legs in the top half and two in the bottom half, in columns 5 and 7. Connect the Arduino's pin 2 to column 5 in the bottom half with a green jumper wire (BUTTON_PIN 2). Then connect column 7 in the top half to the top (−) rail with a short black wire. Because you use two diagonal legs of the button, it works whichever way round it sits; no extra resistor is needed either, the Arduino's built-in one (INPUT_PULLUP) is enough.
- push button → across the middle gap, columns 5 and 7
- Arduino pin 2 → column 5, bottom half (green wire)
- column 7, top half → the top blue (−) rail (black wire)
- 3
Add and wire the buzzer

Plug the passive buzzer's + leg into column 15 in the top half and its other leg into column 16; the + leg is usually the longer one and the body has a + mark. Connect the Arduino's pin 8 to column 15 with an orange jumper wire (BUZZER_PIN 8). Then connect column 16 to the top (−) rail with a short black wire. A passive buzzer makes no sound on its own: tone() switches the pin on and off hundreds of times a second, and the buzzer vibrates at that rate, which is the note you hear.
- buzzer + leg → column 15, top half
- buzzer − leg → column 16, top half
- Arduino pin 8 → column 15, top half (orange wire)
- column 16, top half → the top blue (−) rail (black wire)
Arduino sketch
// The button's and the buzzer's pins
const int BUTTON_PIN = 2;
const int BUZZER_PIN = 8;
// The bell's notes (Hz): E, C, D, G
const int MELODY[] = {659, 523, 587, 392};
// How long each note lasts (ms)
const int DURATIONS[] = {400, 400, 400, 800};
const int NOTE_COUNT = 4;
int rings = 0;
void setup() {
// Pull-up: a pressed button reads LOW
pinMode(BUTTON_PIN, INPUT_PULLUP);
pinMode(BUZZER_PIN, OUTPUT);
Serial.begin(9600);
Serial.println("Doorbell ready: press the button");
}
// Plays the notes one after another
void playMelody() {
for (int i = 0; i < NOTE_COUNT; i++) {
tone(BUZZER_PIN, MELODY[i], DURATIONS[i]);
// Let it end, then a short pause
delay(DURATIONS[i] + 50);
}
noTone(BUZZER_PIN);
}
void loop() {
if (digitalRead(BUTTON_PIN) == LOW) {
rings++;
Serial.print("Ring: ");
Serial.println(rings);
playMelody();
// Wait until the button is let go
while (digitalRead(BUTTON_PIN) == LOW) {
delay(10);
}
// Let the contacts settle on release
delay(50);
}
}
What the Serial Monitor shows
Doorbell ready: press the button Ring: 1 Ring: 2 Ring: 3
What you will see
Every press makes the buzzer play a four-note "ding-dong" (E, C, D, G), and the Serial Monitor shows how many times it has rung. Holding the button down does not ring it again; let go and press again. If there is no sound at all, check that the buzzer is a passive one and its + leg is in column 15 (the same column as pin 8's wire). If text reaches the Serial Monitor but there is no sound, the problem is on the buzzer's side; if nothing happens when you press the button, check that it sits over the middle gap, the green wire is in column 5 and the black wire in column 7.
In the app, tick off every wire, match the parts to your inventory and pick up where you left off.
Build it step by step in the app