Introduction: Motion Detector With Arduino

About: pursuing Bachelors in Electronics and Communication at Chandigarh University

In this project , we will detect motion of the body using arduino and on detecting the motion our led as well as buzzer will turn on.

With the help of PIR sensor we can calculate motion. It is a pyroelectric sensor with generate energy on heating. Here , heat is provided by human body that emit infrared rays that generate energy and as sensor do not require to transmit energy to detect motion it is known as passive infrared(PIR) or sometimes passive infrared detector(PID).

PIR will detect the whether the person have moved inside or outside the field of view of PIR sensor and based on its reading our led and buzzer will ON and OFF.

Step 1: Component Required

Step 2: Circuit Schematic

Pin 13 --> anode of led , positive terminal of buzzer

GND --> cathode of led , negative terminal of buzzer and gnd of PIR sensor.

Pin 2 --> Dout of PIR sensor

Step 3: Arduino Code

We can change the field of view and delay time of PIR sensor by adjusting the potentiometer on PIR sensor itself. We need not to write code for making such changes.

Repeatable trigger - to keep led on till the person is inside the field of view.

Non repeatable trigger -to turn led off after delay period ends even the person is inside the field of view.

we can change the trigger using jumper wire placed on the top of trigger pins on sensor itself.

Code: -

int data=0;

void setup()

{

pinMode(13, OUTPUT);

pinMode(2, INPUT);

}

void loop()

{

data =digitalRead(2);

// value will be high if person is present inside the filed of view of PIR sensor

if(data==1)

digitalWrite(13, HIGH);

else

digitalWrite(13, LOW);

}