Agent KK : Defend Your Room From Unauthorized Intruders!

Siblings, siblings, siblings… Especially younger siblings… They sneak into your room, and disrupt your things, when they’re not simply taking them as their own! What you need is to call on the Guardians of the Wardrobe!

Build and program this little GoPiGo to protect your wardrobe, your closet, or even your whole room! Hide GoPiGo behind a closed door and when the door is opened, it will attack your siblings, scaring them, and even taking a picture as trespassing proof! That way, even mom will have to be on your side!

Agent KK is a young woman on a secret mission. She'll help you catch your mini intruders in the act!

A USB-powered, or battery powered, speaker (not available through Dexter Industries)

You can choose to use any of the last three items, or all of them, or none of them. The more you use, the better the protection, but if one is not available, it’s not a deal-breaker. The Guardian will guard without it.

If this is your first project with GoPiGo, take a look at the Getting Started pages before implementing this project.

Step 2: HOW TO ASSEMBLE THE GUARDIAN OF THE WARDROBE

Your mission, should you choose to accept it, is to assemble the Guardian following these steps. We will deny all knowledge of your mission (but if you have questions, feel free to contact us).

Make sure your GoPiGo is up and running and connected to your home network. Check your batteries.

Plug the ultrasonic sensor into port A1. It doesn’t need the servo, so don’t worry if you don’t have it. You do need to find a way of attaching the ultrasonic in a fairly stable position, pointing forward.

Plug in the camera module. To do so, you will have to remove the Pi board from the GoPiGo in order to access the camera port. The video above will show you how to connect the camera to the Raspberry Pi. It will also show you how to connect it to the servo, but you can connect the camera to the chassis directly.

Plug the buzzer into Port D11. D11 is underneath the red board, so you have to flip GoPiGo on its back to see it. Attach the buzzer to the GoPiGo using tie wraps, or any other method that you have available to you.

Plug the speaker into the audio plug on the Raspberry Pi itself. If it’s USB powered, you can use one of the USB ports on the GoPiGo. Otherwise, make sure its batteries are good.

Step 3: GETTING THE CODE: Scratch

The code for this project is available for both Python and Scratch. Use “DI Update Software” to get the latest versions of our projects (you can find this script on your Raspbian for Robots desktop). Don’t execute the code right away as your Guardian is not in position yet.

Scratch:

Launch Scratch through the “Scratch for Robots” interface. If you need help with this step, please follow the instructions described in this tutorial Click on File/Open (you can also use Ctrl-O for a direct access) to get the File dialog. Click on the Desktop button, then double click the GoPiGo folder.

Step 4: GETTING THE CODE: Python

The code for this project is available for both Python and Scratch. Use “DI Update Software” to get the latest versions of our projects (you can find this script on your Raspbian for Robots desktop). Don’t execute the code right away as your Guardian is not in position yet.

Python:

Open up a Terminal window.

Navigate to ~/home/pi/Desktop/GoPiGo/Projects/AgentKK

cd ~/Desktop/GoPiGo/Projects/AgentKK

f you want to see what the Python code looks like, you can:

nano agentKK.py

Step 5: TESTING

Let’s verify that everything is working, before sending our Guardian off to do its job.

Start by putting GoPiGo on its back so it won’t run off when it detects an intrusion. Be careful not to hurt the ultrasonic sensor or the camera when you do this.Place an obstacle in front of the ultrasonic sensor, less than 10 cm or 4 inches away.Launch the script.

Scratch:

click the green flag in Scratch

Python:

sudo python agentKK.py

Step 6: SENDING THE GOPIGO ON ITS MISSION

The Guardian is meant to guard a closed door against unauthorized opening.

Put it behind a door, either a closet, or a bedroom door.

Start the code remotely via your laptop

Scratch:

click the green flag

Python:

cd /home/pi/Desktop/GoPiGo/Projects/AgentKK

sudo python agentKK.py

For an ultimate test, open the door, and watch it go!

Step 7: Github Repo

The code and audio file required for this mission are available on Github.

We welcome your feedback.

Comments

Your Robot design is really appreciable, the best part is the top empty layer where one can mount other sensors or items, likewise in this tutorial with speakers, i would have loved to receive this kit, but was unsuccessful with delivery attempt last year. Anyhow i tried my robot designs like yours.