Arduino Code
//Defining pins
int buzz = 9;
int pir = 2;
void setup()
{
// Sets the buzzer as an OUTPUT & PIR sensor as an INPUT
pinMode(buzz, OUTPUT);
pinMode(pir, INPUT);
// Serial Communication is starting with 9600 of baudrate speed
Serial.begin(9600);
}
void loop()
{
//Read data from the sensor
int status = digitalRead(pir);
// check data from sensor if there is motion,
// if will execute otherwise else will execute
if(status == HIGH)
{
Serial.println("Motion Detected");
tone(buzz,1000,700);
delay(2000);
}
else
{
Serial.println("No one is there");
delay(1000);
}
}
Output:
How to make Motion Detection System using Arduino?
Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards can read digital & analog inputs from the sensors and The PIR sensor is a special type of sensor which is usually used for security purposes. It detects the objects by reading the Infrared radiations emitted by the objects. Any object whose temperature is above absolute zero emits radiation. This radiation is not visible to human eyes. The PIR sensor is designed to detect this Infrared radiation.
In this article, We will learn how can we make a Motion Detection System using Arduino. When the PIR Sensor will detect any motion, it will show that on the Serial Monitor and the buzzer will start.