- Voltage: 5V – 20V
- Power Consumption: 65mA
- TTL output: 3.3V, 0V
- Adjustable delay time (0.3-300sec)
- Lock time: 0.2 sec
- Trigger methods: L – disable repeat trigger, H enable repeat trigger
- Sensing range: less than 120 degrees, within 7 meters
- Temperature: – 15 ~ +70
- Dimension: 32*24 mm, distance between screw 28mm, M2, Lens dimension in diameter: 23mm
3 pin connector, pins as follows:
- GND: 0V Ground
- OUT: PIR output (max 3,3v)
- VCC: 5V Supply (max 20v)
What does it do?
HC-SR501 PIR Motion Sensor is one of the more common types of sensors out there. Infrared light detection allows to track changes in the desired area and respond to the rapid changes. This allows us to detect movement. The sensor produces binary output (0=LOW, 1=HIGH). Sensor requires few moments to set the ambient reading before correct reading can be provided. The dials available on the sensor allow finer control over the sensitivity and the delay timing. Adjust incrementally as changes are rapid.
How to use it?
Connecting HC-SR501 PIR Motion Sensor is very simple. The first pin belongs to ground (black) and it is linked to any ground pin on RPI. Middle (blue) is an output connection and it delivers 0/1 values to the RPI. There is no need for stepping down as the voltage at HIGH is 3.3V. It is powered by 5V input which can be drawn from the RPI (red).
Also, present on the board are 2 dials to adjust your sensitivity distance (3-7m) and delay timer (0.3-300sec) turn clockwise to increase the value.
On this particular sensor, you can also notice 3 additional pins, with a jumper connector. This allows to pick retrigger setting:
(pins L) unrepeatable trigger
(pins H) repeatable trigger
You can test the sonar using a python2 code from here.[code language=”python”] import RPi.GPIO as GPIO
sensor = 24 #your GPIO on RPI
GPIO.setup(sensor, GPIO.IN, GPIO.PUD_DOWN)
current_state = False
time.sleep(0.3) #allow to set
current_state = GPIO.input(sensor)
if current_state == 0:
print ‘no movement’
print ‘You are moving’