Home / Projects / Arduino Projects / Clap Switch for RGB LEDs using Arduino
Arduino clap switch for RGB

Clap Switch for RGB LEDs using Arduino


This week’s Arduino project is a classic one and ideal for beginners. Here I will be showing how to build a simple clap switch for a RGB LED strip. Basically, a microphone captures the sound of the clap and converts it to a voltage. The Arduino processes that voltage then changes the color of the RGB LED strip.

What You’ll Need

Wiring Diagram

Arduino clap switch for RGB

The condenser microphone converts sound to an analog voltage. My Arduino microphone tutorial covers the basics of how condenser microphones work. The voltage from the microphone is read by the ADC of the Arduino, and converts it to a digital value.

You can use the analogReadSerial sketch (File> Examples>Basics) first to know the value of your clap sound. After that, replace the value of the threshold variable in the sketch below.

This clap switch project listens to three claps 1 second apart. When this condition is met, the RGB LED strip changes color. Moreover, the sequence of colors follows R-O-Y-G-B-V.

A particular LED turns on when the voltage drop across it is zero. For example, a high pulse from Arduino’s D9 will turn on the transistor resulting in the green LED turning on. The 2N2222A transistor in this project was enough to handle the current requirements of the LED strip.

You can use a 5V or a 12V LED strip as long as you have the power source for it. My diagram uses a 12V LED strip so I needed to have a separate supply for the Arduino board.


Here, I set the threshold value to 200. Every time the voltage from the microphone reaches this level, a variable (clap_counter) increments. When this variable reaches a value of three, the function to change color is invoked and another variable (color_counter) increments. The color_counter variable is used for knowing which color in the sequence to be displayed.


To Follow

Check Also

Wireless Controller for Bluetooth RC Car

This project demonstrates how two bluetooth modules connect with each other. I’ll be featuring DFRobot’s …

Leave a Reply

Your email address will not be published.