Introduction: Burglar Alarm- LinkIt One

About: Pooja Baraskar is an Intel Software Innovator,author, speaker and a passionate Software Developer, who is always willing to learn and explore new technologies. Being a programmer, she always have a solution fo…

Working with Sensors is always amazing. I am always excited when I run my first Sketch with a new type of Sensor and they always get successful in impressing me. This Sensor is one of them, it is so small yet powerful. When somebody walks into my room it notifies me, isn’t that cool? For demonstration I made a Burglar Alarm System with this. Its detecting range is upto 6 meters. It plays buzzer and light up LED when detects any intrusion in my room. Let us understand about PIR Motion Sensor and its working to create some cool stuffs like this.

Step 1: PIR Motion Sensor

“A passive infrared sensor (PIR sensor) is an electronic sensor that measures infrared (IR) light radiating from objects in its field of view.” It is also referred to PIR, “Passive Infrared”, “PID”, “Pyroelectric”, or “IR motion” sensors. These are small, inexpensive and operates on low power. PIR sensors are most commonly used to detect motion like if someone moves in or out within the Sensor’s range.

Step 2: How It Works

Everything emits some radiations if human, animal or any object passes within the Sensor’s range, the temperature at that point in the sensor’s field of view will rise from room temperature to body temperature, and then back again. The sensor will detect the change in Infrared Radiation. PIR Sensors are basically made of a “Pyroelectric sensor” which can detect levels of infrared radiation “Pyroelectricity” means- heat that generates electricity, hence these sensor converts change in Infrared Radiation to Change in Output Voltage. These sensors usually have a small plastic covering which is actually the lens which increases its sensing range. The Plastic lens have may multiple facets to focus the infrared energy onto the sensor. Each individual facet is a Fresnel lens. PIRs does not emit any Infrared and unlike other active sensors they does not send out anything hence they are called Passive Sensors. This image will help you to understand the working of PIR sensor.

For this project we are going to make a Burglar Alarm System. It will detect intrusion or any fire outbreak in your home. Let us see its working in action.

Step 3: Prerequisite

LinkIt One Board

PIR Sensor


A Buzzer

Step 4: Grove – PIR Motion Sensor

In this article I am going to use Grove’s PIR Motion Sensor and going to show its working with LinkIt One. This sensor has Grove compatible interface, you have to just connect it through the Base Shield and start programming for it. If you are not aware of Grove Sensors please go through my article

This sensor has max 6 meters of detecting range but by default it is 3 meters, you can increase or decrease it by attaching a Potentiometer to the circuit. Other Specifications are-

Step 5: Specifications

• Grove compatible interface

• Voltage range: 3V–5V

• 2.0cm x 4.0cm twig module

• Detecting angle: 120 degree

• Detecting distance: max 6m (3m by default)

• Adjustable detecting distance and holding time

Step 6: Making Connections

Since we are using Grove’s Sensors we don’t have to worry much about the
connections or polarity. Here I have placed the Base Shield on myLinkIt One board and connected the PIR Sensor to pin D2 and I also hooked up an LED to pin D4 and a Buzzer to pin D3 so in case if a motion is detected it will alert us.

Step 7: Code

void loop()


//if it detects the moving people





void turnOnBuzzer()



for (int i = 0; i < length; i++)


if (notes[i] == ' ')


delay(beats[i] * tempo);

// rest




playNote(notes[i], beats[i] * tempo);


// pause between notes

delay(tempo / 2);



void turnOffBuzzer()





The code is self-explanatory. When a motion is detected we are sending output to the Buzzer and LED.
I am including a complete working code with this article, you are free to download it and can play around that.

Step 8: Other Project Ideas With PIR Sensor

Thief-guarding System

Occupancy sensors- If somebody is in room it will turn on the lights

Motion activated outdoor flood lights (definitely will save electricity)

Automatic Doors

Arduino All The Things! Contest

Participated in the
Arduino All The Things! Contest

Make It Glow! Contest

Participated in the
Make It Glow! Contest