Project 004: Arduino PIR Motion Sensor Project

Project 004: Arduino PIR Motion Sensor Project © GPL3+

An extremely straightforward project involving a digital PIR sensor, which can be utilised for many security and home automation uses.

  • 71 views
  • 0 comments
  • 3 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
You could use any other Arduino board as well. The Keyestudio Uno is used in this example.
×1
Grove   pir motion sensor wiqzunfogv
Seeed Grove - PIR Motion Sensor
Any 3-pin digital PIR motion sensor can work fine.
×1
11026 02
Jumper wires (generic)
3 Male to Female Jumper Wires.
×3
09590 01
LED (generic)
A LED of any colour.
×1
Adafruit industries ada62 image 75px
USB-A to B Cable
Depends on the Arduino.
×1
Pcbway qeheggiidg
PCBWay Custom PCB
×1

Apps and online services

About this project

Before starting this project...

Credits go to educ8s.tv on YouTube:https://youtube/u4bdmXqppB8

This project is one of the easiest for any maker. It includes a PIR (Passive Infrared) Motion Sensor which is a common sensor used for motion detectors. Security systems,  burglar alarms and home automation projects will include this at some point. With building this simple sensor circuit, you can add on to this to make a more advanced system. This tutorial's parts needed are:

  • 1 Arduino (the Keyestudio Uno is used in this example)
  • 1 PIR Motion Sensor
  • 3 Jumper Wires (Male to Female)
  • 1 LED (any colour)
  • 1 USB Data Cable (depends on the Arduino)

Mounting the circuit

Now, that you know a little bit about this project, let's begin with the hardware side. Remember to always unplug the power supply and disconnect any circuits from the current Arduino board. First of all, plug all three female pins to the PIR Motion Sensor. Then, connect the positive (+) pin of the sensor to 5v (+5 volts) of your Arduino, the ground (-) pin of your sensor to GND (-) on your Arduino, and the output pin of the sensor to the D9 (digital pin 9) on your Arduino. Next, connect a LED with the cathode leg going to the GND (-) on your Arduino and the anode of the LED to D13 (digital pin 13) on your Arduino. Once all of the connections have been done, you are ready to go onto the software side of this project.

About the code

The code is very easy to read because it uses an easy language and easy writing to understand. The first three lines of the Code starts with declaration of variables from hardware such as the LED uses pin 13 and the PIR Sensor uses pin 9. The value uses pin 0 because it is the receive pin. Next, is the usual void setup which indicates the first part of the Code, that describes the LED as OUTPUT (off). It also means the PIR Sensor is INPUT (on). Lastly, the void loop phrase loops the value first as we've mention in the beginning. Value in this line means that it will read the PIR Sensor and give information to the microcontroller on the next step in the process. The last line is the last step and will be repeated with the second last line. Our main line is the last line because it outputs the whole code and reacts to the information its given, the LED is turned off.

Amazing opportunities

Also, be sure to check out PCBWay, a leading manufacturer and distributor in PCB design and manufacturing. They have amazing prices and excellent quality in their services, so don't miss out on them! Plus, right now, they are having an amazing Christmas promotion, where free gifts and packages will be gifted, so make sure you check out the link below:

https://www.pcbway.com/PCBWayShoppingFestival2018.aspx

Enjoy! Contact us for any inquiries!

Code

Arduino PIR Motion Sensor Project CodeC/C++
int ledPin = 13;
int pirPin = 9;
int val = 0;
void setup()
{
  pinMode(ledPin, OUTPUT);
  pinMode(pirPin, INPUT);
}
void loop()
{
  val = digitalRead(pirPin);
  digitalWrite(ledPin, val);

if (val ==1)
  digitalWrite(ledPin, LOW);
}

Schematics

Circuit Diagram
C bwd9lf3pye
Schematics
S wv0put0dqy

Comments

Similar projects you might like

RobotGeek PIR Motion Sensor Night Light

Project tutorial by Team RobotGeek Projects Team

  • 1,503 views
  • 1 comment
  • 6 respects

PIR Sensor Tutorial - With Or Out Arduino

by Tarantula3

  • 3,667 views
  • 2 comments
  • 21 respects

HOW PIR SENSOR WORK

Project tutorial by DIY Partners

  • 9,320 views
  • 6 comments
  • 37 respects

Easy Motion and Gesture Detection by PIR Sensor & Arduino

Project tutorial by ElectroPeak

  • 26,582 views
  • 9 comments
  • 215 respects

Complete Digital Clock Including Alarm and Motion Sensor

Project tutorial by LAGSILVA

  • 13,295 views
  • 11 comments
  • 51 respects

Coolest Motion Detection Sensor ever

by remnis

  • 8,376 views
  • 2 comments
  • 9 respects
Add projectSign up / Login