Chapter 2: Trial Run

Day 5: Alien Piinko Detector

On the fifth day of your mission, you encounter an unexpected challenge: tracking the movements of the ship’s alien rats, known as Piinkos. These small, cute creatures have made their home aboard the Nebula Raider, and while they don’t cause any harm, it’s essential to

monitor their activity to ensure they don’t get into sensitive areas. Your task is to build an Alien Piinko Detector using a motion sensor to track these endearing stowaways.


This project involves setting up a motion sensor system with the Raspberry Pi Pico WH Microcontroller and an HC-SR501 PIR Motion Sensor. The sensor will detect the presence of Piinkos, and an LED will light up to indicate their movement. This simple yet effective system will help the crew keep an eye on the Piinkos and ensure they stay out of trouble.


Components Needed:


Raspberry Pi Pico WH Microcontroller

HC-SR501 PIR Motion Sensor

LED (any color)

Resistors

Breadboard

Jumper wires

Instructions:


Set Up the Circuit:


Connect the HC-SR501 PIR Motion Sensor to the Raspberry Pi Pico (Output pin to GP2, VCC to 3.3V, GND to GND).


Connect the LED to a GPIO pin on the Raspberry Pi Pico (e.g., GP3) with an appropriate resistor.


Use jumper wires to make all necessary connections on the breadboard, ensuring a secure and organized setup.

Circuit Diagram

Write the Code:


Open your coding environment and write the following Python code to create the motion detection system.

Test the System:

Upload the code to the Raspberry Pi Pico and run it.

Observe the LED lighting up when the motion sensor detects movement, indicating the presence of Piinkos.

Ensure the system accurately tracks the movements of the Piinkos.


Learning Outcomes:


Microcontroller Programming: Develop skills in writing code to control input and output devices using the Raspberry Pi Pico.

Sensor Integration: Gain hands-on experience in setting up and connecting a motion sensor to detect movement.

Problem Solving: Enhance problem-solving abilities by creating a practical solution for monitoring the ship’s adorable Piinkos.


By completing this project, you will successfully build an Alien Piinko Detector that helps the crew monitor the movements of these cute alien rats. Your efforts will ensure the Piinkos remain harmless and out of sensitive areas, contributing to the smooth operation of the Nebula Raider.