Simple Scratch intruder alarm

Here’s a really simple Raspberry Pi project I’m going to try in my Year 6 Code Club. They’ve used Scratch before but never done any physical computing. Some of them have unused Raspberry Pis at home and this might inspire them to fire them up.

It’s based on the excellent Raspberry Pi education resource Physical Computing with Scratch, and shows you how you could extend this project slightly further to teach a few more design and coding ideas.

It uses any old Raspberry Pi with Raspbian and some parts you’d find in a CamJam EduKit or similar: an LED, a resistor, a push-button switch, a buzzer and a Passive Infra Red (PIR) movement sensor wired up like this:

You then create a variable in Scratch called ‘movement’ and assemble blocks like this:

The idea is that you stop the alarm being too sensitive by counting the amount of movement. You can set a threshold (in this case 50) to trigger the buzzer sounding. The LED will light whenever it detects movement, much as the burglar alarm sensors do in your home.

When then alarm triggers, you can reset it by pressing the button – it gives you a generous 5 seconds to get out again! You can vary this and the movement threshold numbers and experiment with positioning the sensor.

This entry was posted in education, ICT, Raspbian and tagged , , , . Bookmark the permalink.

Leave a Reply