Motion Detector using Arduino, HC-SR501 PIR Motion Sensor, LED and Buzzer

Description:

This is a simple motion detector using Arduino. Here a motion of body or any object is detected by HC-SR501 PIR Motion Sensor and output is shown by a glowing LED and Buzzer sound. Everything is controlled by Arduino Nano.

Circuit Diagram:

Motion Detector using Arduino, HC-SR501 PIR Motion Sensor, LED and Buzzer
Motion Detector using Arduino, HC-SR501 PIR Motion Sensor, LED and Buzzer

Components:

SR. NO.COMPONENTPINOUT DIAGRAMBUY
1Arduino Nano (Other Arduinos can be used too)
2LED x 1
3Buzzer x 1
4HC-SR501 PIR Motion Sensor
5330 Ohm Resistor x 1
Arduino Nano
Arduino Nano

Arduino Nano

Arduino Nano is a type of microcontroller board based on the ATmega328P microcontroller. It is a compact, small form-factor version of the Arduino Uno board and is commonly used in projects where space is a constraint. In this project, the Arduino Nano is used as the brain of the motion detector. It is responsible for controlling the other components, including the HC-SR501 PIR motion sensor, the LED and the buzzer. The Arduino Nano reads the input from the PIR sensor and determines when motion is detected. It then sends a signal to turn on the LED and the buzzer, providing the user with both a visual and auditory indication of motion detection.

LED
LED

LED

An LED, or Light Emitting Diode, is a type of semiconductor device that emits light when an electric current is passed through it. In this project, the LED is used to indicate motion detection. When motion is detected by the HC-SR501 PIR motion sensor, the Arduino Nano sends a signal to turn on the LED. This visual cue allows the user to easily see when motion has been detected. Additionally, in this project, the LED is used in conjunction with the buzzer to provide an audible and visual indication of motion detection. LEDs are widely used in a variety of devices and applications due to their efficiency, long lifespan, and fast switching capabilities. They can be found in everything from electronic devices, to automotive lighting and even in street lights.

Buzzer
Buzzer

Buzzer

A buzzer, also known as an electronic sounder, is an audio signaling device that produces a buzzing or beeping sound when an electric current is applied to it. In this project, the buzzer is used in conjunction with the LED to provide an audible indication of motion detection. When motion is detected by the HC-SR501 PIR motion sensor, the Arduino Nano sends a signal to turn on both the LED and the buzzer. This provides the user with both a visual and auditory cue of motion detection. Buzzers are commonly found in a wide range of applications, including alarm systems, doorbells, and timers. They are also often used in industrial and manufacturing settings as a warning signal for machinery or equipment.

HC-SR501 PIR Motion Sensor
HC-SR501 PIR Motion Sensor

HC-SR501 PIR Motion Sensor

The HC-SR501 PIR motion detector is a widely used sensor that detects the presence of infrared radiation (heat) emitted by objects and humans. In this motion detector project, the HC-SR501 is used to detect movement within a certain area. The sensor has a wide range of detection and can be adjusted to detect motion within a specific range. The sensor works by continuously measuring the infrared radiation levels in its field of view, and when it detects a change in the radiation levels, it sends a signal to the Arduino Nano, which in turn triggers the LED and the buzzer to indicate motion detection. This sensor can operate for long periods of time on a single battery. It is also easy to use and has adjustable sensitivity, which can be set to suit the specific needs of the project. Additionally, the HC-SR501 PIR motion detector is widely available and relatively inexpensive, making it a popular choice for DIY projects and home security systems.

Resistor
Resistor

Resistor

A resistor is an electronic component that is used to limit current flow and voltage in a circuit. In this motion detector project, the 330 ohm resistor is used in conjunction with the LED to control the current flowing through the LED. The resistance value of a resistor is measured in ohms (Ω) and the 330 ohm resistor is used to limit the current flowing through the LED to a safe level, protecting the LED from burning out.

Steps and Info:

1. Get correct components as given. You can buy online or offline. I buy electronics components mostly from Amazon.

2. Start connecting the components. If you are new to connecting components in an electronic circuit, then use a Breadboard or you can straight up make connections using Jumper wires but it will create problem when there will be two or more connections needed at one pin (for example two or more different sensors 5V connection to Arduino’s 5V pin). But before soldering components on a PCB or printing a PCB for your circuit, better try using breadboard so that any errors and mistakes can be observed on breadboard and not after soldering. Or do connections in your way.

3. Now after building the circuit, download the Arduino IDE from https://www.arduino.cc/ website.

4. If you are new to Arduino IDE software, then watch this video we made specially for beginners about Arduino IDE.

5. If you know Arduino IDE then straight up copy the code we given and paste it into the Arduino IDE sketch.

6. Connect the Arduino to your Computer/device. Select a proper port, proper Arduino type and whatever other settings are. Here it is Arduino UNO. (If you don’t know what this all is then watch our video: ).

7. Compile the code and Upload it.

8. If any error occurs then try to troubleshoot it by finding/copy-pasting it into our Solve Errors page https://electronicsprojects.in/solve-errors/, or you can straight up paste the error on Internet and you know the rest. Also check if there are no spelling/syntax errors in the code. Compile the code again once to check if errors are fixed. I have given proper connections and code but still nothing is perfect.

9. Once code compiles and uploads smoothly, you can start testing the working of your circuit/project.

10. To test the circuit, put your hand or object or yourself infront of the PIR Motion Sensor, the sensor will detect any motion happening, this will make the Buzzer to make sound and LED will glow. If it doesn’t then check connections and code. Also you can talk with me and the community through discord. All the links to social is given at the right side of this page.

Program Code:

/* https://www.electronicsprojects.in Motion Detector using Arduino, HC-SR501 PIR Motion Sensor, LED and Buzzer */

void setup() {
  pinMode(2, INPUT);
  pinMode(3, OUTPUT);
}
void loop() {
  if (digitalRead(2) == HIGH)
  {
  digitalWrite(3, HIGH);
  delay(150); 
  digitalWrite(3, LOW);
  delay(150);
  }
}

Download:

Links:

More: