Connected LED Control System via Sound Detection of Hand Claps
Interactive home-automation IoT solution that sequentially controls three indicator lights (Red LED, Green LED, Yellow LED) through the acoustic detection of hand claps. Driven by an ESP8266 microcontroller and a high-se...
Interactive home-automation IoT solution that sequentially controls three indicator lights (Red LED, Green LED, Yellow LED) through the acoustic detection of hand claps. Driven by an ESP8266 microcontroller and a high-sensitivity sound sensor, the system locally switches the active light with each detected sound pulse and simultaneously sends an explicit text status report to the Cloud platform Youpilab IoT.
Problem solved
Conventional sound-controlled systems generally settle for a simple binary toggle (On/Off of a single load) and lack versatility. Moreover, they offer no remote traceability of the actual state of the actuators. This project overcomes these constraints by introducing multi-state logic management (circular sequencing across 3 distinct light outputs) combined with a rigorous acoustic
debounce filtering to avoid false triggers. At the same time, it guarantees that a descriptive text message is reported in real time to the Youpilab IoT Cloud platform.
Detailed description
Context
In modern environments, the human-machine interface (HMI) is evolving towards contactless commands (Contactless UI) that are more hygienic, accessible and ergonomic. Acoustic control is establishing itself as an effective alternative to traditional mechanical switches, particularly for people with reduced mobility or in environments requiring hands-free control (kitchens, operating rooms, workshops). Integrating these physical controls into IoT networks allows remote monitoring and centralization of equipment states.
Proposed solution
The project relies on a standalone architecture driven by an ESP32 coupled with a sound sensor module (KY-038 / noise sensor). Each time a sound pulse corresponding to a hand clap is detected, the ESP32 runs a finite state machine to cycle through the Red LED, the Green LED and the Yellow LED. In parallel with each local physical switch, the microcontroller takes advantage of its Wi-Fi connectivity to send a secure HTTP GET request with URL encoding to the Youpilab IoT API in order to report the exact state achieved.
General operation
The sound sensor continuously monitors the ambient sound level. When a clap exceeds the sensitivity threshold set on the sensor's potentiometer, a logic signal is sent to the ESP32. A software delay (acoustic debounce) is applied to ignore echoes or secondary background noise within an interval of 400 ms to 500 ms. With each validated clap, the system increments its state and applies the following behavior:
- 1st clap: Turning on the Red LED (Green and Yellow LEDs off Notification: "Clap detected: red LED on"
- 2nd clap: Turning on the Green LED (Red and Yellow LEDs off) Notification: "Clap detected: green LED on"
- 3rd clap: Turning on the Yellow LED (Red and Green LEDs off) Notification: "Clap detected: yellow LED on"
Main features
- Reactive Acoustic Detection : Precise capture of short sound pulses (hand claps) via an analog/digital comparator.
- 3-State Sequential Switching: Circular control of a trio of LEDs (Red → Green → Yellow → Red) with mutual shutdown of the other outputs.
- Software Acoustic Debounce: Filtering of resonances and ambient noise to avoid multiple switches during a single clap.
- Real-time Cloud Notification: Instant sending of an HTTP GET request to the Youpilab IoT API as soon as a clap is detected.
- Explicit Text Transmission: Dynamic URL encoding to push clear, understandable status labels directly to the Cloud dashboard.
Technologies used
Hardware
|
Component |
link to the components on Youpilab |
Pin
ESP86 |
Technical role |
|
Microcontroller
ESP8266 |
https://youpilab .com/componen
ts/product/mod
ule-wifi-esp32s |
- |
Core of the system, processing of analog data and management of the Wi-Fi network stack. |
|
Sound sensor / Noise |
https://youpilab .com/componen ts/product/capt eur-de-son-capt eur-de-bruit-po ur-arduino-ky-0 |
GPIO 34 (ADC1) |
Detection of the sudden acoustic wave of a hand clap. |
|
Red LED |
https://youpilab
.com/componen ts/product/led-r ouge-transpare
nte |
GPIO 26 |
Visual indicator of state 1 (red LED on). |
|
Green LED |
https://youpilab
.com/componen
ts/product/led-v
erte-transparente |
GPIO 27 |
Visual indicator of state 2 (green LED on). . |
|
Yellow LED
|
https://youpilab
.com/componen ts/product/led-j
aune-transparente |
GPIO 25 |
Visual indicator of state 3 (yellow LED on). |
Software & Protocols
- Language and IDE: Embedded C++ in the Arduino IDE environment.
- Key libraries: (Wi-Fi network layer management) and (REST HTTP requests).WiFi.hHTTPClient.h
- Network protocol: HTTP GET requests with URL encoding (converting spaces into) to secure the sending of character strings.
- Cloud platform : https://iot.youpilab.com/docs/index dedicated to receiving, storing and dynamically displaying the states.
Applications
- Contactless Home Automation (Smart Home): Remote control of lighting circuits or ambient lighting with a simple sound pulse, without physical contact.
- Accessibility and ergonomics: Assisting elderly people or people with reduced mobility in activating equipment without physical effort.
No comments yet. Be the first!