Double-clap light switch
Clap twice and the lights come on. Clap twice again to switch them off.
Shop by category
Shop all componentsA loudness sensor gives a voltage that rises with sound level. The Nano takes the peak over short windows, lights a traffic-light bar and, if the room stays in the red for three seconds, triggers an ISD1820 voice module to play a message you recorded, such as "Let's use our indoor voices". A knock sensor on the desk lets the teacher silence it.
Keep the volume comfortable for the room; the aim is a reminder, not a fright.
Tick anything you already have and the total updates.
Grove loudness sensor with adjustable gain
ISD1820 record and playback module
8 ohm cavity speaker for the voice module
Piezo knock sensor: tap the desk to snooze
Sound sensor module with a digital clap output
Gravity analog sound sensor, plug-in alternative
Offline voice recognition: let the class say "quiet mode" to switch it off
Ready-made sound trigger voice module, no recording needed
Follow the colours: red is power, dark grey is ground, blue is a signal.
noise_meter.inoVerify & upload in Electrolarkconst int MIC = A0, PLAY = 8, KNOCK = 2, G = 3, Y = 4, R = 5;
int QUIET = 150, LOUD = 350; // set from the Serial Plotter
unsigned long redSince = 0, snoozeUntil = 0, lastPlay = 0;
int peak50ms() {
int lo = 1023, hi = 0;
unsigned long t = millis();
while (millis() - t < 50) { int v = analogRead(MIC); lo = min(lo, v); hi = max(hi, v); }
return hi - lo;
}
void setup() {
Serial.begin(115200);
pinMode(PLAY, OUTPUT); pinMode(KNOCK, INPUT);
pinMode(G, OUTPUT); pinMode(Y, OUTPUT); pinMode(R, OUTPUT);
}
void loop() {
if (digitalRead(KNOCK) == HIGH) snoozeUntil = millis() + 60000UL;
int level = peak50ms();
Serial.println(level);
bool red = level > LOUD, yellow = !red && level > QUIET;
digitalWrite(G, !red && !yellow); digitalWrite(Y, yellow); digitalWrite(R, red);
if (red) { if (!redSince) redSince = millis(); } else redSince = 0;
bool longLoud = redSince && millis() - redSince > 3000;
if (longLoud && millis() > snoozeUntil && millis() - lastPlay > 20000UL) {
digitalWrite(PLAY, HIGH); delay(50); digitalWrite(PLAY, LOW); // edge starts playback
lastPlay = millis(); redSince = 0;
}
}
The sketch above runs here on a simulated Arduino Nano. Move the sliders for the sensors and buttons it reads, and watch the Serial monitor, display and outputs change.
Turn the gain trimmer on the loudness sensor up; check SIG is on A0.
Use the 8 ohm speaker on the ISD1820, not a 4 ohm one, and keep the supply in range.
Raise LOUD and keep the speaker facing away from the sensor so it does not hear itself.
No. It shows a relative level. A calibrated sound level meter is needed for dB readings.
About 10 seconds; some boards allow up to 20 seconds with a resistor change, at lower quality.
Yes, set QUIET and LOUD lower and skip the voice message.
14 parts: Nano CH340 Development Board (Soldered), Seeed Studio Studio Grove Loudness Sensor – Analog Output, Gain Adjustable, ISD1820 Voice Recording Module with Speaker Support – 10-20s Audio Playback, Waveshare 8 Ohm Cavity Speakers (2030 2W and 5W), Elecrow Crowtail-Knock Sensor Module – Piezoelectric Vibration Detection, Through-Hole LED Pack (Pack of 10), Resistor Assortment Kit (30 Values), HS-S53P Sound Sensor Module – PH2.0 4P Interface, DFRobot Gravity Analog Sound Sensor for Arduino – Plug-and-Play Module, ACEBOTT Voice Recognition Module V2.0 Broadcast Easy-Plug – ESP32/Arduino Compatible, plus 4 more. On this page you can tick the parts you already have and add only the rest to your cart.
Yes. The Run it panel under the code runs this exact sketch on a simulated board. Move the sliders or press the buttons for the sensors it reads, and the Serial monitor, display and outputs react as they will on the real build. It is a simulation, so real readings depend on your parts and wiring.
About ₹4,209 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Peak detection on an analog audio signal; Triggering a record/playback chip; Using a piezo as a knock input.
Keep the volume comfortable for the room; the aim is a reminder, not a fright.
Ideas that reuse this build: Relaxation meter. They are listed under Take it further on this page.
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.
Learning project. Check every circuit and the datasheet of each part before you power it up.
2 2 2 2 2 2 2 2 2
A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.