Room Defender

Let GoPiGo defend your room from unauthorized intruders.

7. 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:

Remove the obstacle in front of the ultrasonic sensor. There should be plenty of space in front of it now, enough to trigger the attack mode.

Are you getting the appropriate reactions?


    1. Yelling can be heard through the speaker
    2. A loud noise comes out from the buzzer
    3. A photo is taken, it is saved to your Pi Desktop
    4. The two LEDs on the GoPiGo blink
    5. The wheels on the GoPiGo turn (and if the GoPiGo wasn’t on its back, it would be going forward)

Tags: