Bringing maker education and computational thinking to the classroom.
Keep Out! Make an Electronic Safe with Remote Alarm
6 (Could work for 7 & 8)
Two 45-minute sessions
We can talk to our computers and phones to play music or send messages. Some houses and cars can send us a message if someone tries to break in. To do this, microcontrollers use sensors to gather information about the world around them and then use radio waves to send signals and messages about that information. To create their own high-tech security system, students will program their micro:bit microcontroller to detect an intruder and then send a signal to activate a remote alarm on a gator:bit board.
alarm, radio, circuit, Internet of Things, output, input, sensor, light sensor
Students should have a basic knowledge of programming the micro:bit and using a conditional block, completing activities such as the “Nametag” and “Rock, Paper, Scissors” at makecode.microbit.org. If they have not already used radio commands in previous projects, they will need instruction on where to find the radio commands in the programming environment.
After this activity, students should be able to:
Introduction / Motivation
You may have seen all sorts of ways people protect their treasures in movies - motion sensors, pressure sensors, lasers, and lots of alarms and traps. Here’s a famous one: Indiana Jones idol swap scene.
In the past, you may have needed traps, heavy iron doors, and guards to protect your treasure, but today, we can use digital electronics to design a system that will instantly let us know if someone is out to steal our stuff, even if we’re nowhere near our treasure vault. We’re going to build our own safes that use the light-detecting capability of the micro:bit to sense if someone has broken into our vault. And we’re going to program another micro:bit to sound a remote-controlled alarm that we can carry with us. (Teacher demonstrates opening the safe-box and having the musical alarm go off.)
For our project, we’ll be using the micro:bit as both a light sensor AND a radio, and we’ll use the speaker on the gator:bit board for our alarm sound. Light is sensed by the micro:bit by using the LED array. How this actually works is pretty complicated, but you can just think of the light sensor as being located in the LED array. You’ll begin by testing all of these components: the light sensor, the radio, and the speaker. Then you’ll put it all together to create a program that will sound an alarm if someone breaks into your safe.
By completing introductory activities on the Equipment Testing worksheet, students will learn the basics of using the micro:bit light sensor and radio as well as the speaker on the gator:bit board. After students have gathered light-sensor data and sent messages to each other, they’re ready to put it all together by programming an alarm system. Working in teams of two, students will design and construct a unique safe-box to house their micro:bit light detector. Then they’ll test their system to see if opening the safe-box causes the second micro:bit to trigger an audible alarm using the gator:bit board’s speaker.
Students then read about real-world alarm systems and reflect on how their own micro:bit alarm system uses the same technology as the real-world alarms.
Before the Activity
Sender Program (in box) You will need to set the light level for your own micro:bit.
Receiver Program (attached to gator:bit board)
With the Students:
“Receiver” micro:bit (in the gator:bit)
Additional options for advanced students: Scroll message, flash lights, send message to receiver to turn off alarm on button press B.
Before the Activity
With the Students:
The first (and sometimes second) light readings displayed by a micro:bit can be false readings. Often, upon start-up, the light level will read as 255 (the maximum number possible). To avoid using false readings, the student worksheet guides students to display but discard the first two readings and only use later data.