Nakshatra401
Published © GPL3+

Clap Controlled DC Motor

You can use different appliances. This project will turn the DC motor on or off by clapping.

EasyFull instructions provided1,153
Clap Controlled DC Motor

Things used in this project

Hardware components

Dual H-Bridge motor drivers L298
SparkFun Dual H-Bridge motor drivers L298
×1
Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
SparkFun Sound Detector (with Headers)
SparkFun Sound Detector (with Headers)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
9V battery (generic)
9V battery (generic)
×1
9V Battery Clip
9V Battery Clip
×1
DC motor (generic)
×1
5 mm LED: Green
5 mm LED: Green
×1
Resistor 220 ohm
Resistor 220 ohm
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Schematics for clap switch

Code

Code

C/C++
/*For this project you will have to connect external power supply of 9V or 5V to the 12V pin of driver.*/
int soundSensor=2; //This is the input pin connected to digital output of sound sensor
int LED=4; //This pin is connected to led for indication and input to motor driver
int stat = 5; //This pin is used as input to verify that LED pin is on or off
void setup() {
 pinMode(soundSensor,INPUT);
 pinMode(LED,OUTPUT);
 pinMode(stat,INPUT);
}

void loop() {
 stat = digitalRead(5);
  int SensorData=digitalRead(soundSensor); 
  //Now to turn on
  if(SensorData==1) //If the sensor detected any sound
  {
     if(stat==false) //And if Led pin is false or off
     {
       
        digitalWrite(LED,HIGH);//We will turn onn the input pin for H-Bridge driver and LED
       
digitalWrite(8, LOW);//This is to ensure that our DC motor rotates in one direction
     }
    }
  
   
  //Now to turn off
   if(SensorData==1) //If the sensor detected any sound
   {

    if(stat==true) //And if Led pin is true or on
    {
     
        digitalWrite(LED,LOW); //Now the dc motor won't work as there is no input to the driver
       
    
   
    }
  
 } 
}
  

Credits

Nakshatra401

Nakshatra401

1 project • 1 follower

Comments