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.
Every part for this build comes in the Geekobot Explorer Kit box, a Geekobot exclusive, together with the parts for all 61 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.
The brain of every Explorer Kit project
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 segment
Nano I/O shield from the kit: every pin has its own S, V, G header, so modules plug in with jumpers
Follow the colours: red is power, dark grey is ground, blue is a signal.
explorer_kit_08_buzzer_beep.inoVerify & upload in Electrolarkint buzzer = 8;
int led = 9;
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 the kit's mini-USB cable, install the CH340 driver on Windows if no port appears, pick Tools > Board > Arduino Nano and try Tools > Processor > ATmega328P (Old Bootloader) if the upload times out.
Turn it round: the long leg (anode) goes to the pin side through the 220 ohm resistor, the short leg to GND.
The active buzzer has a + leg: it goes to the pin, 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 61 in the Geekobot Explorer 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 Explorer Kit project is wired on the Nano I/O shield and the breadboard with jumper wires.
7 parts: Generic Nano CH340 Development Board (Soldered), USB Cable, 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 Arduino Nano IO Expansion Shield (328P Compatible). 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 (explorer_kit_08_buzzer_beep.ino).
About ₹473 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.
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.