PIR Sensors and the Raspberry Pi LAB1
รายการอุปกรณ์
-ชุด Raspberry pi
-SD Card 4G Class4 ขั้นต่ำ
-OS Raspbian "2013-09-25-wheezy-raspbian.zip" http://www.raspberrypi.org/downloads
-PIR Sensor
-WIFI USB / LAN Wires
-Breadboard+Jumper Wires
-Mount+Keyboard
เซ็นเซอร์ PIR เป็นเซ็นเซอร์ตรวจจับความเคลื่อนไหว โดยการเชื่อมต่อกับ Raspberry pi โดยการเชื่อมต่อกับสายโดยต่อที่พอร์ต GPIO ของ Rapberry pi

รูปแบบการเชื่อมต่อระหว่า PIR กับ Rapberry pi


เราสามารถปรับค่าได้สองค่าด้วยกันที่ PIR
ทางซ้ายมือเป็นการปรับค่า ความไว ในการการตรวจจับความเคลื่อนไหว
ทางขวามือเป็นการปรับค่า เวลา ในการตรวจจับบความเคลื่อนไหว

Python Script ประมาณนี้ครับ http://www.raspberrypi-spy.co.uk/archive/python/pir_1.py
ต่อมาเป็นการทดสอบ Python Script ก่อนอื่นจะต้องโหลดมาเก็บที่เครื่องของ Raspberry pi ก่อนเปิด terminal ขึ้นมาจากนั้นใช้คำสั่งดังงนี้ โดยจำเป็นต้องมีการเชื่อมต่ออินเตอร์เน็ตก่อน
จากนั้นทดสอบรันไฟล์ pit_1.py ด้วย
#sudo python pir_1.py

ขอแถมอีก Python Script ประมาณนี้ครับ http://www.raspberrypi-spy.co.uk/archive/python/pir_2.py
โดยการดาวน์โหลดด้วย
จากนั้นทดสอบรันไฟล์ pit_2.py ด้วย
#sudo python pir_2.py

**การหยุดไฟลืที่รันอยู่โดยกด ctrl+c หรือ ctrl+z**
PIR Sensors and the Raspberry Pi LAB1