Materials
-
micro:bit Tilt alarm instructions
https://microbit.org/projects/make-it-code-it/tilt-alarm/ -
Radio tilt alarm introduction video
https://youtu.be/NFbiR3tWk5E?si=hY9NZhEEbc221miM -
Radio Tilt alarm coding video
https://youtu.be/zNUPZ_fwR00?si=_TBYPnv4dQbjrNwW -
Example MakeCode
https://makecode.microbit.org/#pub:_4tuW6Mg3kRwR
Activity Instructions
- Introduce the Activity
- Discuss:
- How do security systems know when something has been moved?
- What should happen if someone touches something valuable?
- How could we be alerted from far away?
- Today, we will be building your own motion-triggered alarm system using the BBC micro:bit.
- Introduce the System
- This project uses TWO micro:bits working together.
- Explain the roles of the two micro:bits:
- One detects movement
- One receives the alert
- Program the Alarm Function
- Walk students through creating the code or use the provided link to share the completed code with students.
- Model in MakeCode
- Using the “on start” block add the following block inside:
radio set group “1”
- Using the “on shake” block add the following blocks inside:
Radio send string “thief!”
Call alarm
- Within the “Advanced menu” Make a Function titled “alarm.” Using the Function “alarm” block add the following blocks inside:
Show icon – angry face
Play melody baddy in background
- Using the “on radio received receivedString block” block add the following block inside:
Call alarm
- Set Up Radio Communication – Now we connect both micro:bit devices
- Download the code to BOTH micro:bit devices
- Assign a micro:bit as the sender (the one hidden) and the receiver (the one that will alarm)
- Test the Detect Movement – Shake the micro:bit sender and wait for response on the micro:bit receiver
- Debug if necessary
- Introduce the Activity
- Discuss:
- How do security systems know when something has been moved?
- What should happen if someone touches something valuable?
- How could we be alerted from far away?
- Today, we will be building your own motion-triggered alarm system using the BBC micro:bit.
- Introduce the System
- This project uses TWO micro:bits working together.
- Explain the roles of the two micro:bits:
- One detects movement
- One receives the alert
- Program the Alarm Function
- Walk students through creating the code or use the provided link to share the completed code with students.
- Model in MakeCode
- Using the “on start” block add the following block inside:
radio set group “1” - Using the “on shake” block add the following blocks inside:
Radio send string “thief!”
Call alarm - Within the “Advanced menu” Make a Function titled “alarm.” Using the Function “alarm” block add the following blocks inside:
Show icon – angry face
Play melody baddy in background - Using the “on radio received receivedString block” block add the following block inside:
Call alarm
- Using the “on start” block add the following block inside:
- Set Up Radio Communication – Now we connect both micro:bit devices
- Download the code to BOTH micro:bit devices
- Assign a micro:bit as the sender (the one hidden) and the receiver (the one that will alarm)
- Test the Detect Movement – Shake the micro:bit sender and wait for response on the micro:bit receiver
- Debug if necessary
- Introduce the Activity
- Discuss:
- How do security systems know when something has been moved?
- What should happen if someone touches something valuable?
- How could we be alerted from far away?
- Today, we will be building your own motion-triggered alarm system using the BBC micro:bit.
- Introduce the System
- This project uses TWO micro:bits working together.
- Explain the roles of the two micro:bits:
- One detects movement
- One receives the alert
- Program the Alarm Function
- Walk students through creating the code or use the provided link to share the completed code with students.
- Model in MakeCode
- Using the “on start” block add the following block inside:
radio set group “1” - Using the “on shake” block add the following blocks inside:
Radio send string “thief!”
Call alarm - Within the “Advanced menu” Make a Function titled “alarm.” Using the Function “alarm” block add the following blocks inside:
Show icon – angry face
Play melody baddy in background - Using the “on radio received receivedString block” block add the following block inside:
Call alarm
- Using the “on start” block add the following block inside:
- Set Up Radio Communication – Now we connect both micro:bit devices
- Download the code to BOTH micro:bit devices
- Assign a micro:bit as the sender (the one hidden) and the receiver (the one that will alarm)
- Test the Detect Movement – Shake the micro:bit sender and wait for response on the micro:bit receiver
- Debug if necessary
Tips for Running Activity
- Set Group & Channel: Always set a unique group number in on start to prevent interference, especially in classrooms. It might be best to assign and keep a list of assigned channels so groups know, and don’t accidentally select another channel.
- Power Levels: Adjust signal strength to increase range or lower it for debugging in confined spaces.
- Handle Data Types: You can send strings (text) or numbers. For complex data, consider sending simple number codes and decoding them on the receiving end.
- Receive and Display: The on radio received block allows the micro:bit to wait for messages, which can then be displayed using show string or show number.
- Don’t forget to download code to BOTH micro:bits
- Connection to Networks – A network is just a group of devices talking to each other. Your micro:bits formed a tiny wireless network—sending messages, receiving them, and reacting.
- Set Group & Channel: Always set a unique group number in on start to prevent interference, especially in classrooms. It might be best to assign and keep a list of assigned channels so groups know, and don’t accidentally select another channel.
- Power Levels: Adjust signal strength to increase range or lower it for debugging in confined spaces.
- Handle Data Types: You can send strings (text) or numbers. For complex data, consider sending simple number codes and decoding them on the receiving end.
- Receive and Display: The on radio received block allows the micro:bit to wait for messages, which can then be displayed using show string or show number.
- Don’t forget to download code to BOTH micro:bits
- Connection to Networks – A network is just a group of devices talking to each other. Your micro:bits formed a tiny wireless network—sending messages, receiving them, and reacting.
- Set Group & Channel: Always set a unique group number in on start to prevent interference, especially in classrooms. It might be best to assign and keep a list of assigned channels so groups know, and don’t accidentally select another channel.
- Power Levels: Adjust signal strength to increase range or lower it for debugging in confined spaces.
- Handle Data Types: You can send strings (text) or numbers. For complex data, consider sending simple number codes and decoding them on the receiving end.
- Receive and Display: The on radio received block allows the micro:bit to wait for messages, which can then be displayed using show string or show number.
- Don’t forget to download code to BOTH micro:bits
- Connection to Networks – A network is just a group of devices talking to each other. Your micro:bits formed a tiny wireless network—sending messages, receiving them, and reacting.
Assessment Opportunities
Reflection:
- What was the input in your system?
- How did the devices communicate?
- Why are functions useful?
- How could this system be improved?
Reflection:
- What was the input in your system?
- How did the devices communicate?
- Why are functions useful?
- How could this system be improved?
Reflection:
- What was the input in your system?
- How did the devices communicate?
- Why are functions useful?
- How could this system be improved?
Extension Opportunities
Students can:
- Send different messages for different movements
- Adjust sensitivity (use accelerometer values instead of shake)
- Build a protective case or enclosure (maker connection)
- Combine with other sensors (light, sound)
- Create a multi-object alarm network
Students can:
- Send different messages for different movements
- Adjust sensitivity (use accelerometer values instead of shake)
- Build a protective case or enclosure (maker connection)
- Combine with other sensors (light, sound)
- Create a multi-object alarm network
Students can:
- Send different messages for different movements
- Adjust sensitivity (use accelerometer values instead of shake)
- Build a protective case or enclosure (maker connection)
- Combine with other sensors (light, sound)
- Create a multi-object alarm network