HC SR501 Pir Motion Sensor Gerak

Persiapan Part: #

– Raspberry Pi Pico / Pico W
– HC SR501 Pir Motion Sensor
– Breadboard
– 3x Kabel Jumper Male to Female
– Kabel Micro USD
– Aplikasi Thonny IDE

Wiring HC SR501 Ke Raspberry Pi Pico
– connect the VCC (power) pin of the sensor with a 5V pin (red wire)
– connect the OUTPUT pin of the sensor to GP22 (yellow wire)
– connect the GND of the sensor to a GND (ground) pin (black cable)

Sample Code #

from machine import Pin
import time
pir = Pin(22, Pin.IN, Pin.PULL_DOWN)
n = 0
print('Starting up the PIR Module')
while True:
     if pir.value() == 1:
          n = n+1
          print('Motion Detected ',n)

Hasil yang di tampilkan #

Powered by BetterDocs

Leave a Reply

Your email address will not be published. Required fields are marked *

Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
What are you looking for in Partdo?
× How can I help you?