100% found this document useful (1 vote)
4K views

Raspberrypi With Pir Sensor

This document discusses using a PIR (passive infrared) sensor with a Raspberry Pi to detect motion and control an electrical appliance. It provides instructions on connecting the PIR sensor to the Raspberry Pi, writing a Python script to read the PIR sensor, and running the script to detect motion and control an output. The PIR sensor detects temperature changes to sense movement and is well-suited for security and alarm systems.

Uploaded by

Praveen Kumar R
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
4K views

Raspberrypi With Pir Sensor

This document discusses using a PIR (passive infrared) sensor with a Raspberry Pi to detect motion and control an electrical appliance. It provides instructions on connecting the PIR sensor to the Raspberry Pi, writing a Python script to read the PIR sensor, and running the script to detect motion and control an output. The PIR sensor detects temperature changes to sense movement and is well-suited for security and alarm systems.

Uploaded by

Praveen Kumar R
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

2012

PIR sensor with Raspberry Pi

Author: Praveen Kumar


Introduction:
The Raspberry Pi is a credit-card sized computer board that plugs into a TV and a keyboard.
It’s a miniature ARM-based PC which can be used for many of the things that a desktop PC
does, like spread sheets, word-processing and games. It also plays High-Definition video. In
this lesson, we will concentrate on sensing movement and controlling led.
Real-time application:
Using this concept we will build on this security sensing to have the Pi use a digital output to
control the power to an electrical appliance when movement is detected.
Alaram system
Robot sensing system
Controlling Electrical Appliance
Prerequisites
 Raspberry Pi 512 MB
 USB cable micro
 8SD card class 4
 PIR Sensor

PIR sensor

PIR sensor

# 9/3, 2nd floor, Sree Laksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085,
Email: info@tenettech.com, Phone: 080 - 26722726
Passive Infra-Red (PIR) sensors basically detect temperature changes between sections of a
viewing range. This means if a person (a source of heat) moves between two sectors within the
sensors field of ‘vision’ – this is detected as movement. PIR sensors are well used in alarm
sensors. The great thing about being based on temperature is that they work in the dark and
ideally suited for sensing people. The overlap with security systems can be annoying. I found fairly
good selection of PIR sensors which would work within the 3.3v-5v range the Pi can
support. They come in a few varieties, but each has a fairly decent range (2.5-10m).

Step 1:

Open the LXterminal and the type the following command.


Step 2:
Enter the following command to open a nano window with the filename.
sudo nano pir.py
Step 3:
So here’s the Python script I wrote, using the RPi.GPIO library . Type the following program

# 9/3, 2nd floor, Sree Laksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085,
Email: info@tenettech.com, Phone: 080 - 26722726
Circuit Connection:

The red lead goes to 5V, the black to GND and the yellow to GPIO Pin.

# 9/3, 2nd floor, Sree Laksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085,
Email: info@tenettech.com, Phone: 080 - 26722726
Step 4:
Run the program as superuser using the command:
Sudo python pir.py

For queries:
info@tenettech.com
For placing an order:
http://www.tenettech.com/product/2184/tenet-technetronicsraspberry-pi
http://www.tenettech.com/product/2583/pir-sensor-standard-motion-detection-module

# 9/3, 2nd floor, Sree Laksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085,
Email: info@tenettech.com, Phone: 080 - 26722726

You might also like