Sound-Activated Light Switch

TL;DR

Switch turns lamp on and off when clapping twice.

Sound-Activated Light Switch preview

Motivation

At about 17 years old, inspired by a YouTube tutorial, I wanted to create a practical device that would allow me to conveniently control my room's lighting directly from my bed. I disliked getting up to flip the manual switch each night, so the idea of using simple sound commands was appealing.

Objectives & Goals

My goal was to develop a safe and reliable clap-detection mechanism to toggle lights on and off, while gaining practical experience in electronics, microcontroller programming, and basic audio signal processing.

Solution & Implementation

I began prototyping the system with an Arduino connected to a salvaged microphone from old electronics, later transitioning to an ATtiny45 microcontroller for a compact final solution. I used a relay to control the lamp power, powered the system with a recycled 5-volt power supply, and constructed a simple PCB for reliability. The audio circuit included voltage dividers and capacitors to filter noise and improve signal stability.

The firmware detected two distinct acoustic peaks (claps) within a defined temporal window, reliably distinguishing intended commands from ambient noise. Although simple, this method was sufficient for daily usage and consistently accurate.

Results & Achievements

The device was successfully implemented and reliably operated in my room over a sustained period. Friends and family who saw it in action were notably impressed by its effectiveness and ingenuity, reinforcing my interest in engineering practical solutions.

Learnings & Reflections

This project provided foundational insights into electronic prototyping, microcontroller programming, and simple audio processing. It sparked my interest in more sophisticated solutions like voice commands leading to me initially diving into neural networks in this project.