Double-clap light switch
Clap twice and the lights come on. Clap twice again to switch them off.
Shop by category
Shop all componentsSound is a pressure wave. When two 40 kHz transducers face each other at the right distance, the waves form a standing wave with still points, called nodes, about 4.3 mm apart. Small, light objects such as polystyrene beads sit in those nodes and float. An Arduino Nano makes the 40 kHz square wave with a timer interrupt and an L298N drives the transducers in opposite phase.
Do not try to levitate anything heavier than a small bead.
Disconnect the supply before you adjust the wiring.
Tick anything you already have and the total updates.
40 kHz open ultrasonic transmitter (you need two)
H-bridge that drives the transducers with up to 12 V
Matching 40 kHz receiver for measuring the wave with an oscilloscope
Another 40 kHz transmitter/receiver pair to experiment with
Follow the colours: red is power, dark grey is ground, blue is a signal.
A 9 to 12 V DC supply of 1 A (sold separately). Higher voltage gives a stronger trap but warms the transducers.
levitator.inoVerify & upload in Electrolark// 40 kHz antiphase square wave on A0 and A1 (PORTC) using Timer1
byte pattern = 0b10101010;
void setup() {
DDRC = 0b11111111; // PORTC (A0-A5) as outputs
noInterrupts();
TCCR1A = 0; TCCR1B = 0; TCNT1 = 0;
OCR1A = 200; // 16 MHz / 200 = 80 kHz interrupts -> 40 kHz wave
TCCR1B |= (1 << WGM12); // CTC mode
TCCR1B |= (1 << CS10); // no prescaler
TIMSK1 |= (1 << OCIE1A);
interrupts();
}
ISR(TIMER1_COMPA_vect) {
PORTC = pattern;
pattern = ~pattern; // A0 and A1 always opposite
}
void loop() {}
Check the gap: try every half millimetre. Beads must be tiny (1 to 3 mm) and very light.
Align the transducers on one axis; even a small tilt weakens the trap.
Lower the supply voltage; open-type transducers are not made for long high-power use.
Small drops, yes, but they can wet the transducers; use beads first.
That is the resonant frequency of these transducers; they barely respond at other frequencies.
At this power it is not, but keep ears and pets away from the transducers in long sessions.
7 parts: Nano CH340 Development Board (Soldered), 2 × HYDZ HY40A16T12-1 40kHz Ultrasonic Open Transmitter 16x12mm, L298N Dual H-Bridge Motor Driver Module, HYDZ HY40A16R12-1 40kHz Ultrasonic Receiver – Open 16x12mm Plugin, Ogam Tech GSRS61 Plugin Ultrasonic Receiver & Transmitter – 40kHz, 24V, Solderless Breadboard and Dupont Jumper Wires (40 pcs). On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 3 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (levitator.ino).
About ₹600 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Standing waves and nodes; Timer interrupts for exact frequencies; Driving a load in antiphase with an H-bridge.
Do not try to levitate anything heavier than a small bead. Disconnect the supply before you adjust the wiring.
Ideas that reuse this build: Classroom noise 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.