MotionSensor (PIR) with Raspberry Pi
📖 Scenario: You have a Raspberry Pi connected to a PIR motion sensor. The sensor detects movement in a room and sends a signal to the Pi. You want to write a simple program to read the sensor's signal and print a message when motion is detected.
🎯 Goal: Build a Python program that reads input from a PIR motion sensor connected to the Raspberry Pi's GPIO pin and prints "Motion detected!" when movement is sensed.
📋 What You'll Learn
Use the
RPi.GPIO library to interact with GPIO pins.Set up the GPIO pin connected to the PIR sensor as input.
Detect when the PIR sensor output goes HIGH (motion detected).
Print
"Motion detected!" each time motion is detected.💡 Why This Matters
🌍 Real World
Motion sensors are used in home security systems, automatic lighting, and energy-saving applications to detect presence and movement.
💼 Career
Understanding how to read sensor input and control GPIO pins is essential for embedded systems, IoT development, and hardware interfacing jobs.
Progress0 / 4 steps