Double-clap light switch
Clap twice and the lights come on. Clap twice again to switch them off.
Shop by category
Shop all componentsDrive a buzzer to make alarm sounds, and hear the difference between simple beeps and varied patterns. An active buzzer contains its own oscillator, so digitalWrite() HIGH is enough to make it sound, it plays one fixed pitch and nothing else. What you can control is the pattern: how long each beep lasts and how long the silence between them is. Those two numbers alone carry a surprising amount of meaning, which is why a slow beep reads as a reminder and a fast one as an emergency.
The ESP32 is a 3.3V board: never connect a 5V signal straight to a GPIO pin.
Every part for this build comes in the Geekobot Titan Kit box, a Geekobot exclusive, together with the parts for all 120 projects, from a first blinking LED to a smart fan and a reaction game. The wiring below is the kit's own wiring.
Tick anything you already have and the total updates.
ESP32 DevKit V1 (38-pin): the brain of every Titan Kit project, with Wi-Fi and Bluetooth
Male-to-female and female-to-female leads for the modules
LEDs from the kit's red, green, yellow and blue packs
220 ohm resistors: one in series with every LED
ESP32 expansion board from the kit: every GPIO has its own S, V, G header
Follow the colours: red is power, dark grey is ground, blue is a signal.
titan_kit_008_buzzer_beep_sound.inoVerify & upload in Electrolarkint buzzer = 33;
int led = 32;
void beep(int onTime, int offTime, int count)
{
for (int i = 0; i < count; i++)
{
digitalWrite(buzzer, HIGH);
digitalWrite(led, HIGH);
delay(onTime);
digitalWrite(buzzer, LOW);
digitalWrite(led, LOW);
delay(offTime);
}
}
void setup()
{
pinMode(buzzer, OUTPUT);
pinMode(led, OUTPUT);
Serial.begin(9600);
}
void loop()
{
Serial.println("Single long beep");
beep(800, 400, 1);
delay(800);
Serial.println("Reminder - two slow beeps");
beep(200, 300, 2);
delay(1200);
Serial.println("Warning - four medium beeps");
beep(120, 120, 4);
delay(1200);
Serial.println("Emergency - rapid beeping");
beep(50, 50, 10);
delay(2000);
}
Use a micro-USB data cable (some cables only charge), install the CP210x or CH340 driver if no port appears, pick Tools > Board > ESP32 Dev Module and hold the BOOT button on the board until the upload starts.
Turn it round: the long leg (anode) goes to the GPIO side through the 220 ohm resistor, the short leg to GND.
The active buzzer has a + leg: it goes to the GPIO, the other to GND. Peel off the sticker on top if it has one.
An active buzzer contains its own oscillator, so digitalWrite() HIGH is enough to make it sound, it plays one fixed pitch and nothing else. What you can control is the pattern: how long each beep lasts and how long the silence between them is. Those two numbers alone carry a surprising amount of meaning, which is why a slow beep reads as a reminder and a fast one as an emergency.
One long beep, with the LED flashing in time. Two slower beeps as a gentle reminder. Four medium beeps as a warning.
Yes. It is project 8 of 120 in the Geekobot Titan Kit, in level 1 (Foundations). Every part on the list comes in the kit box, and you can also buy the parts one by one from the list above.
No. Every Titan Kit project is wired on the ESP32 expansion board and the breadboard with jumper wires.
8 parts: ESP32-WROOM-32 38-Pin Development Board, USB Cable, Solderless Breadboard, Dupont Jumper Wires (40 pcs), Through-Hole LED Pack (Pack of 10), Carbon Film Resistor 1/4W 5% (Pack of 10), PCB Mounted Active Buzzer Module and ESP32 38-Pin Expansion Board. On this page you can tick the parts you already have and add only the rest to your cart.
It is a beginner project and takes about 20 minutes. The build on this page has 5 steps.
No. This page has the complete, tested code (titan_kit_008_buzzer_beep_sound.ino).
About ₹740 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Sound output from a digital pin; How an active buzzer differs from a passive one; Building patterns from on-time and off-time; Using repetition rate to signal urgency.
The ESP32 is a 3.3V board: never connect a 5V signal straight to a GPIO pin.
Clap twice and the lights come on. Clap twice again to switch them off.
Plays a friendly ding-dong whenever someone walks into the shop or room.
Beeps and flashes any message in Morse, or key your own by hand.
Turn a membrane keypad into a two-octave piano.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.