Day 16: It’s A TRAPPP!


As the Nebula Raider approaches a treasure trove rumored to be protected by space pirates, it’s crucial to navigate safely around any traps. Your task is to build a system that can detect potential hazards and help guide the crew around them. This project marks the beginning of the Treasure Hunt chapter, ensuring the safety of the crew while they secure the valuable treasure.

Components Needed:

Raspberry Pi Pico WH Microcontroller
HC-SR04 Ultrasonic Sensor
PIR Motion Sensor (HC-SR501)
LEDs (Green, Red)
Buzzer
Resistors
Breadboard
Jumper wires
Instructions:

Set Up the Circuit:

Connect the HC-SR04 Ultrasonic Sensor to the Raspberry Pi Pico (Trigger pin to GP2, Echo pin to GP3, VCC to 5V, GND to GND).
Connect the PIR Motion Sensor to the Raspberry Pi Pico (Output pin to GP4, VCC to 5V, GND to GND).
Connect the Green LED to a GPIO pin on the Raspberry Pi Pico (e.g., GP5) with an appropriate resistor.
Connect the Red LED to a GPIO pin on the Raspberry Pi Pico (e.g., GP6) with an appropriate resistor.
Connect the buzzer to a GPIO pin on the Raspberry Pi Pico (e.g., GP7).
Use jumper wires to make all necessary connections on the breadboard, ensuring a secure and organized setup.


Write the Code:

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

Test the System:

default

Upload the code to the Raspberry Pi Pico and run it.
Test the ultrasonic sensor by placing objects at different distances to ensure it accurately measures and triggers the red LED and buzzer when an object is detected within 20 cm.
Test the PIR motion sensor by moving in front of it to ensure it detects motion and triggers the red LED and buzzer.
Learning Outcomes:

Sensor Integration: Learn how to connect and use ultrasonic and motion sensors with the Raspberry Pi Pico.
Hazard Detection: Understand how to create a system to detect potential hazards and provide alerts.
Microcontroller Programming: Develop skills in writing code to integrate multiple sensors and output devices.
Extension Ideas:

Additional Sensors: Add more sensors to detect other types of hazards, such as temperature sensors for detecting fire or gas sensors for detecting harmful gases.
Data Logging: Implement data logging to record the times and locations of detected hazards for further analysis.
Advanced Navigation: Create a more advanced navigation system that can provide directional guidance to avoid detected hazards.
By completing this project, you will have built a crucial system for detecting and avoiding traps, ensuring the safety of the crew during the treasure hunt. This project will help the crew navigate safely and secure the valuable treasure while avoiding potential dangers.

Post a comment

Leave a Comment

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