Hackster is hosting Hackster Holidays, Finale: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Tuesday!Stream Hackster Holidays, Finale on Tuesday!
Electorials Electronics
Published © GPL3+

Project 004: Arduino PIR Motion Sensor Project

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

BeginnerProtip12 minutes24,742
Project 004: Arduino PIR Motion Sensor Project

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
You could use any other Arduino board as well. The Keyestudio Uno is used in this example.
×1
Grove - PIR Motion Sensor
Seeed Studio Grove - PIR Motion Sensor
Any 3-pin digital PIR motion sensor can work fine.
×1
Jumper wires (generic)
Jumper wires (generic)
3 Male to Female Jumper Wires.
×3
LED (generic)
LED (generic)
A LED of any colour.
×1
USB-A to B Cable
USB-A to B Cable
Depends on the Arduino.
×1
NextPCB
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Circuit Diagram

Schematics

Code

Arduino PIR Motion Sensor Project Code

C/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);
}

Credits

Electorials Electronics
85 projects • 64 followers
I'm an electronic hobbyist interested in anything, from Arduino to drones. I plan to educate people with the content on my website.

Comments