I "It would be interesting if there was a mechanism to move when people passed by" I "Human sensor sells quite cheaply"
・ Raspberry Pi ·Human Sensor ・ Jumper wire ·bread board ·LED
The motion sensor looks like this
It seems that the cover can be removed (I think it is better not to remove it too much) It was sold at Sengoku Densho in Akihabara for about 800 yen. (It may be cheaper on Amazon)
If you look at the manufacturer's site, the range in which the sensor responds is ・ 3-7m ・ 120 ° starting from the sensor (https://www.seeedstudio.com/PIR-Motion-Sensor-Large-Lens-version.html)
The back side looks like this When any movement is detected, the voltage of the OUT terminal becomes High. It may be interesting to input a signal with GPIO of Raspberry Pi etc. and use it as a trigger for something
Connect to LED and test if sensor works This time I did it directly without connecting a resistor properly (If you care, you may want to add a resistor)
Terminal | color | access point |
---|---|---|
Vcc | Red | 5 V voltage source |
OUT | yellow | LED anode |
GND | black | GND |
Quite responsive
Next, connect to GPIO of Raspberry Pi
This time connect like this
Terminal | color | access point |
---|---|---|
Vcc | Red | 5 V voltage source |
OUT | yellow | GPIO 16 |
GND | black | GND |
Write a program in python that just detects the input state of GPIO
human-sensor.py
# -*- coding:utf-8 -*-
import time
import RPi.GPIO as GPIO
sensor_pin = 16
GPIO.setmode(GPIO.BCM)
GPIO.setup(sensor_pin, GPIO.IN)
while True:
if( GPIO.input(sensor_pin) == 0 ):
print ("OFF")
else:
print("ON")
time.sleep(1)
When I run the program ...
root@raspberrypi:/home/pi# python3 human-sensor.py
ON
ON
OFF
OFF
OFF
OFF
OFF
ON
ON
OFF
ON
ON
ON
OFF
ON
ON
OFF
ON
ON
I was able to acquire the GPIO input value according to the detection of the motion sensor.
In the future, I would like to combine it with something to make something interesting.
・ Sensor manufacturer's site https://www.seeedstudio.com/PIR-Motion-Sensor-Large-Lens-version.html
Thank you very much