How to Use PIR Sensor With Arduino Nano
by STEAM-DIY in Circuits > Arduino
120 Views, 0 Favorites, 0 Comments
How to Use PIR Sensor With Arduino Nano
Welcome back to my blog. We have described the ultrasonic sensor in the previous post. If you have not read it, Today we are going to talk about the motion sensor (PIR) in the post. It is really easy to use and this sensor is very cheap in the market.
Supplies
let’s do the project step by step using the PIR sensor. The required components are as follows.
- Arduino Nano board —
- PIR sensor —
- LED bulb —
- 1K resistor —
- Jumper wires
Firstly, identify these components.
connect the Arduino Nano board, LED bulb, and Resistor to the breadboard.
connect these components to the Arduino nano board.
Connect the anode pin of the LED bulb to the D2 pin using a 1k resistor and the cathode pin to the GND pin. On the Arduino board, connect the D2 pin to the center pin on the sensor. Connect the other pins to the GND and VIN pins.
Now, copy and paste the following program to the Arduino IDE.
- The complete program of this project
This code is prepared as a D2 pin input pin and D3 pin output pin. Also, the serial monitor is enabled.
A Boolean variable is created and ‘value’ is used as its name. The sensor reads the digital value and puts it into that variable.
This code checks if the digital value is equal to 1 or 0. If the digital reading is 1, the LED bulb turns ON. Otherwise, the LED bulb turns OFF. You can see this process on the serial monitor.
Now, you can test this project. The full video guide is below. So, we hope to see you in the next project or tutorial. Have a good day.
Please subscribe my youtube channel . https://www.youtube.com/@steam-diy
Thanks