We would like to thank the ECE department of IIITD for their kind support and for supplying us with the essentials. Also, credit goes to Ms. Jyoti V. Sinha, without whom this project wouldn't have been possible.


This project is about understanding the working of a motion sensor. A motion sensor, is something that is able to detect motion or movement. The end product is that your device responds to motion as an input and gives out a LED on or alarm on as output.

There are many types of motion detector or sensor. They are divided on how they exactly find out if an object in there range is undergoing motion. The types are passive infrared, microwave, ultrasonic, tomographic and so on.

For this project we have chosen to work with a PIR (Passive Infrared) Sensor
As the name suggests a PIR sensor, which is sensitive to a person’s skin temperature uses light in the IR range in contrast to the emission in the background.
We have made the PIR sensor with an Arduino Uno board with input for the boar as the sensor and output as led lights




“The Arduino Uno is a microcontroller board based on the ATmega328 (datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with an AC-to-DC adapter or battery to get started.”

Arduino makes computers. With the appropriate sensors, the device you have made is capable of sensing your surroundings in a way that a simple desktop computer never can.


Arduino is very simple to use. Everything is beautifully detailed in an look at it and it is easy to spot Vcc Gnd Output and input pins among other thing. For a person with no experience of microcontroller boards, the Arduino’s system can be understood in seconds. The code part, which tell the Arduino what to do with the input lines an output lines, is extremely easy to understand and a matter of minutes to implement


int ledPin0 = 13;
int ledPin1 = 12; //setting inputs
int ledPin2 = 11;
int inputPin = 2;
int pirState = LOW;
int val = 0;

void setup() {
pinMode(ledPin0, OUTPUT);
pinMode(ledPin1, OUTPUT); // declare LED as output
pinMode(ledPin2, OUTPUT);
pinMode(inputPin, INPUT); // declare sensor as input


void loop(){
val = digitalRead(inputPin);
if (val == HIGH) {
//make LEDs blink
digitalWrite(ledPin0, HIGH);
digitalWrite(ledPin1, HIGH);
digitalWrite(ledPin2, HIGH);
digitalWrite(ledPin0, LOW);
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin0, HIGH);
digitalWrite(ledPin1, HIGH);
digitalWrite(ledPin2, HIGH);

if (pirState == LOW) {
pirState = HIGH;
else {
digitalWrite(ledPin0, LOW);
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, LOW);
if (pirState == HIGH){
pirState = LOW;

the following code snippet can be added to connect the motion sensor to a buzzer

void playTone(long duration, int freq) {
duration *= 1000;
int period = (1.0 / freq) * 1000000;
long elapsed_time = 0;
while (elapsed_time < duration) {
delayMicroseconds(period / 2);
digitalWrite(pinSpeaker, LOW);
delayMicroseconds(period / 2);
elapsed_time += (period);


For a motion sensor, we need a sensor to detect told earlier, there are many types of sensor available, but we chose a PIR Sensor


A PIR sensor uses infrared light to detect motion. Every living thing emits heat in the form of IR radiation. The term passive in PIR (passive infrared radiation) refers to the fact that the sensor doesn’t emit any heat radiation for detection purposes. The hemispherical surface in front of the sensor is the face. The cover acts to maximize the sensors field of view. Inside it lies a pyroelectric material that generates energy when exposed to heat.

The HC-SR501

Color: White + Green

Dimension: 3.2cm x 2.4cm x 1.8cm (approx.)

Infrared sensor with control circuit board

The sensitivity and holding time can be adjusted

Working Voltage Range: DC 4.5V- 20V

Current drain:<60uA

Voltage Output: High/Low level signal: 3.3V TTL output

Detection distance: 3—7M (can be adjusted)

Detection range: <140°

Delay time: 5-200S (can be adjusted, default 5s +-3%)

Blockade time: 2.5 S (default)

Trigger: L: Non-repeatable trigger H: Repeat Trigger (default)

Work temperature:-20-+80°C

Trigger Method: L unrepeatable trigger / H repeatable trigger

LDR & Thermistor attachable


Current Drain: The current taken from a voltage source by a load(also known as resistance) is known as current drain.

Delay Time: It is the time taken by the sensor to reset after it has been triggered

Blockade Time : Time for which the sensor does not take any input


Keeping check on children
If you’re concerned about the safety of your walkabout kids or pets, then PIRs can be used to tip you off if someone breaches a specific area. Perhaps you have a swimming pool or pond that you don’t want your children to go near unattended.

Video Motion Sensors
Video motion sensors are a great option for anyone who wants to see what is happening in their home while they are away. Recording for long periods of time, such as when a homeowner is at work, requires a large amount of storage. Using a video camera controlled by a motion sensor allows users to capture important events without as much storage space.

Burglar Alarm
For optimum protection, homeowners may choose to install contact motion sensors on all windows and doors leading outside so their alarm triggers any time a door or window opens. When the alarm is not armed, many alarm systems can be set to beep when a door or window opens. This feature can alert homeowners to individuals coming and going, which could protect little ones from slipping outside unattended and teenagers from sneaking out of the house.

Approximate Speed
If we use two PIR sensors, and place them at a distance of 1m from each other, then we can easily find the time taken by a vehicle or any object to travel that distance. The average spped for this 1m will be given by
speed = 1/time m/s


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License