How to make a Clap control table lamp with the Arduino

How to make a Clap control table lamp with the Arduino

Hello guys, welcome back to my SriTu Hobby blog. In more than 20 of my previous articles, we have explained the basics of the Arduino. I believe you have acquired that knowledge. Today we are going to use that knowledge to create a very useful project. That is, we make a clap control table lamp. This creation is very helpful for your house. You can also use it for wall lamps if desired. Also, it is a specialty that we can do at home at a low cost. OK let’s see how does work this table lamp. As you know from the title, this project is activating from clap sound. Yes, this lamp works by detecting sound. But applause is not necessary. You can use any other sound. But this is not active for normal sounds. For that, the sound has to be presented in a special way. For example, when clapping control. This is activated by two claps. But this must be done in a timely manner. Also, It also requires two applause to deactivate it. Therefore, this table lamp does not activate sounds in the environment. For that, I mainly used the sound-sensitive sensor. A full description of this sensor is given in a previous article. Please read it using this link. So it does not need to be described here. Also, In addition to this sensor, a relay module is used. We can ON or OFF a bulb through this relay module. But you have to remember to provide less current than the current mentioned on the top of the relay. Please click this link for the full description of this relay. The Arduino Uno board is used to control all this. But you can use the Arduino Nano or pro mini boards. Also, I used cardboard to make the table lamp cover. You can use other suitable materials for this cover. So, we talked a lot about this project. Let’s go do this project.

The required components are listed below and can be easily purchased through the links provided.

Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.

Step 1

First time let’s identify these components.

Step 2

Now, cut out the cardboard pieces using the measurement below. You do not need to use this measurement. Change it as you like.

Step 3

Drill a single piece of cardboard for the Arduino Uno board connection ports. Then paste it as shown below. For that, I use a hot glue gun. But you can use any method.

How to make a Clap control table lamp with the Arduino

Step 4

Then attach the relay module near the Arduino board. You can add it to suit this project.

How to make a Clap control table lamp with the Arduino

Step 5

After, connect the relay module to the Arduino board using the circuit diagram below and cover it with another cardboard piece.

Step 6

Ok now attach the sound sensor to the cardboard piece and paste it to the main cardboard piece. Look at the picture below.

How to make a Clap control table lamp with the Arduino

Step 7

After, connect this sensor to the Arduino board using the above circuit diagram.

Step 8

Now connect wires to the Relay module. For that, use Common and Normally open terminals, and after, cover that side using a cardboard piece.

Step 9

After even, Put a piece of wire and another piece of wire that normally connects to the open terminal and paste the piece of cardboard on top. Then connect it to the bulb holder.

Step 10

Ok finally, Attach the connecting bar to the common terminal and to the end of the wires attached to the bulb holder. It is through this that we provide the potential needed to turn on the bulb.

Step 11

Right now, connect this table lamp to the computer to upload the appropriate program.

How to make a Clap control table lamp with the Arduino

Step 12

Let’s look at the code below.

  • The complete program of this project – Download
/*sound-activated table lamp.
 *--------230v AC power. You must carefully---------
 *created by the SriTu Tech team.
 *Read the code below and use it for any of your creation
bool sound;
byte inputsound = 0;
long soundOne = 0;
long soundTwo = 0;
bool light = false;
void setup() {
  pinMode(2, INPUT);//define sensor pin
  pinMode(3, OUTPUT);//define relay pin
void loop() {
  sound = digitalRead(2);//read sensor value and put it veriable
  if (sound == 0) {
    if (inputsound == 0) {
      soundOne = soundTwo = millis();
    else if (inputsound > 0 && millis() - soundOne >= 50) {
      soundOne = millis();
  if (millis() - soundTwo >= 400) {
    if (inputsound == 2) {
      if (!light) {
        light = true;
        digitalWrite(3, HIGH);//bulb on
      } else if (light) {
        light = false;
        digitalWrite(3, LOW);//bulb off
    inputsound = 0;

This code is very easy for beginners. Please read and understand this code. For the first time, five variables have been created to help this code. Later, the sensor pin is defined as the input pin, and the relay pin as the output pin, which is included in the void setup function. Void loop code includes relay on/off functions. Ok, the program is over.

Step 13

Now, select the board and port. After, upload this code to the Arduino board.

Ok, this project is complete. Now power this table lamp. To do this, supply the Arduino board with a voltage of 5 to 12 DC and a potential that matches the bulb we are using. If you use an AC voltage, please be careful ok.

Now we can test this project. Use two clapping sounds. Below is the full video of this project. Please watch it.  I think this project may have helped your life a lot. The full video guide is below. OK, we will meet in the next project. Have a good day.

Clap control table lamp with the Arduino

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart
Select your currency
USD United States (US) dollar
EUR Euro
Scroll to Top