HC-SR501 PIR Motion...
Clear all

HC-SR501 PIR Motion Detector - With Arduino & Raspberry Pi

1 Posts
1 Users
Workshop Guru Admin
Joined: 5 years ago
Posts: 990
Topic starter  

Learn to use an HC-SR501 motion sensor with an Arduino, a Raspberry Pi, and on its own!

Code & Article at https://dbot.ws/hcsr501

The HC-SR501 is a PIR (Passive Infrared) motion sensor that is very inexpensive and extremely versatile. This device can be used all on its own or with a microcontroller or microcomputer for additional functionality.

The HC-SR501 has a built-in voltage regulator so it can run with anywhere from 4.5 to 20 volts, making it ideal for battery-powered applications. The device has a sensitivity that can be adjusted from 3 to 7 meters and it can hold its output from 23 to 300 seconds.

With the addition of a light-dependent resistor (LDR), it can be set to only operate in the dark making it ideal for an emergency lighting project.

In this video, I will explain how Passive Infrared Sensors work and how to hook up the HC-SR501 to a relay to control external devices when motion from humans or animals is detected. I’ll also show you how to hook up the optional light sensor to make an effective nightlight.

We will then add an Arduino to the HC-SR501 give it some additional functionality
After that, I’ll bring out a Raspberry Pi Zero W and a Raspberry Pi Camera to construct an intruder detector that can take a picture or a video of the sneaky person who is trying to steal our jelly beans!

The video is laid out as follows:

00:00 - Introduction
01:58 - How PIR Sensors Work
03:02 - Look at HC-SR501
06:06 - Demo 1 - HC-SR501 on its own
10:47 - Demo 2 - Adding a Light Detector
14:11 - Demo 3 - HC-SR501 with an Arduino
22:36 - Demo 4 - HC-SR501 with Raspberry Pi & Camera
31:15 - Project - Motion sensor taking a picture
41:37 - Project - Motion Sensor taking video

As always you’ll find a detailed article and all of the code you need (including in downloadable format) on the website at https://dbot.ws/hcsr501

And if you haven’t already PLEASE SUBSCRIBE!

Now let’s get moving!

"Never trust a computer you can’t throw out a window." — Steve Wozniak