The material you need prepare is:
1 X HC-SR505 Motion Sensor
1 X DIYmall UNOR3 with USB cable
1 X 3P Male to Female Jumper Wire
1 X LED
Wiring Connection:
HC-SR505 to DIYmall UNOR3:
– to GND
out to D7
+ to 5V
LED to DIYmall UNOR3:
Red LED long pin to D13
Red LED short pin to GND
Code example:
int SR505=7;
int LED=13;
void setup()
{
pinMode(LED,OUTPUT);
pinMode(SR505,INPUT);
Serial.begin(9600);
}
void loop()
{
if(digitalRead(SR505)==HIGH)
{
Serial.println(“Enter The Sensing Area “);
digitalWrite(LED,HIGH);
delay(10);
digitalWrite(LED,LOW);
delay(10);
}
else
{
Serial.println(“NO Man”);
digitalWrite(LED,LOW);
}
delay(500);
}
Running the code, and get the result like below picture:
Purchase link:
HC-SR505 mini PIR motion sensor:
https://www.diymalls.com/HC-SR501-HC-SR505-AM312-PIR-Sensor-Module-HC-SR501-Mounting-Bracket
DIYmall UNOR3:
https://www.diymalls.com/DIYmallUNO-R3-Development-Board-ATmega328P-Microcontroller
*************************************************************************************
*************************************************************************************