Motion Sensor | Arduino Tutorial
Maybe your like
About HC-SR501 Motion Sensor
HC-SR501 PIR sensor is a sensor that can detect the motion of humans (or animals). It's widely used to detect the presence of humans in many applications (automatically turning ON/OFF light bulb, opening/closing the door, activating/deactivating escalator, detecting an intruder ...)
Pinout
The HC-SR501 motion sensor has 3 pins:
- GND pin: needs to be connected to GND (0V)
- VCC pin: needs to be connected to VCC (5V)
- OUTPUT pin: is an output pin: LOW when no motion is detected, HIGH when motion is detected. This pin needs to be connected to Arduino's input pin.
The HC-SR501 also has one jumper and two potentiometers, which are used to adjust the sensor's setting. Firstly, keep the default setting. The detail is described in the Advanced Uses section.
How It Works
The HC-SR501 sensor detects motion based on the change of infrared radiation from the moving object. To be detected by the HC-SR501 sensor, the object must meet two conditions:
- Is moving or shaking
- Is emitting the infrared way.
So:
- If an object is moving but NOT emitting the infrared ray (e.g, robot or vehicle toy), it is NOT detected by the sensor.
- If an object is emitting infrared ray but NOT moving (e.g, a person stands still without moving), it is NOT detected by the sensor.
Humans and animals naturally emit the infrared. Therefore, the sensor can detect the movement of humans and animals.
OUTPUT pin's state:
- When there is NO human (or animal) moving in the detected range of the sensor, the OUTPUT pin of sensor is LOW.
- When there is human (or animal) moving into the detected range of the sensor, the OUTPUT pin of sensor is changed from LOW to HIGH (⇒ motion detected).
- When there is human (or animal) going away from the detected range of the sensor, the OUTPUT pin of sensor is changed from HIGH to LOW (⇒ motion ended).
The above video illustrates how the motion sensor works in principle. In practice, the motion sensor works a little bit different, depending on the sensor setting (described in the Advanced Uses section)
Detect the Presence of Human
The sensor itself does NOT detect the presence of humans, the sensor just detects the motion. We use Arduino (or MCU) to deduce the presence of humans basing on motion detection from the sensor, according to the following rule:
- If motion is detected, the humans are present
- If motion is NOT detected, the humans are NOT present
This rule is incorrect in a practical case: the humans are present in sensor range but NOT moving. The motion is NOT detected. The Arduino (or MCU) deduces that human is NOT present.
For example, your meeting room uses the motion sensor to automatically turn on/off light, the light is turned on automatically when people move into the room. During the meeting time, if everybody sits still without moving, motion is NOT detected ⇒ human is NOT present ⇒ light is turned off automatically. To turn on the light, someone needs to move.
However, this issue is NOT serious and the sensor is cheap. Therefore, The sensor's widely used to detect the human in many application.
Arduino - HC-SR501 Motion Sensor
When an Arduino's pin is configured as a digital input, It can read the state (LOW or HIGH) of anything it connected to.
By connecting the Arduino's pin with the OUTPUT pin of the HC-SR501 sensor, we can use the Arduino code to check the value of the OUTPUT pin to detect the motion.
Tag » Arduino Ir Motion Sensor Detection
-
PIR Motion Sensor: How To Use PIRs W/ Arduino & Raspberry Pi
-
Arduino With PIR Motion Sensor
-
Interfacing Arduino Uno With PIR Motion Sensor
-
Arduino With PIR Motion Sensor - Random Nerd Tutorials
-
Arduino With PIR Motion Sensor - YouTube
-
Using A PIR W/Arduino | PIR Motion Sensor - Adafruit Learning System
-
How To Interface PIR Motion Detection Sensor With Arduino Uno
-
How HC-SR501 PIR Sensor Works & How To Interface It With Arduino
-
Arduino - PIR Sensor - Tutorialspoint
-
PIR Motion Sensor With Arduino In Tinkercad - Instructables
-
Arduino Motion Sensor
-
PIR Motion Sensor And Arduino UNO - 2022
-
Arduino Motion Sensor - JavaTpoint