Jump to main content

Make Your Own Wireless Alarm System

1
2
3
4
5
40 reviews

Abstract

Have you ever wished you could have an alarm to prevent your little brother or sister from sneaking into your room? How about an alarm to prevent someone from stealing your favorite toy or from taking cookies out of the cookie jar? In this project you will learn how to program your own customized, wireless alarm systems to send you alerts about whatever you want!

Summary

Areas of Science
Difficulty
Method
Time Required
Short (2-5 days)
Prerequisites

None

Material Availability

See Materials section for details

Cost
Average ($50 - $100)
Safety

No issues

Credits
Science Buddies is committed to creating content authored by scientists and educators. Learn more about our process and how we use AI.

Objective

Design and test your own wireless alarm system.

Introduction

Have you ever been in a home or building with an alarm system of any kind? Alarms usually monitor for something dangerous, like the presence of smoke, and then automatically warn people of the danger somehow. For example, smoke alarms may make a very loud beeping sound, flash a bright light, or play a recorded message like "Danger! Fire!" Modern alarm systems may also send an electronic alert, like an email or text message. 

There are many different types of alarms. They use a variety of electronic sensors to measure different things. For example, a smoke detector uses a sensor that can detect particles of smoke in the air. A home security system might use a motion sensor that can detect body heat to "see" when someone is moving through a room, or a sound sensor (a microphone) to listen for loud noises, like someone breaking a window.

Some alarm systems use magnets to detect when a door or window has been opened. The strength of the magnetic field around a magnet decreases as you get farther away from the magnet. This means that you can place a magnet sensor on the frame around a door or window, and place a magnet on the door/window (or vice versa). When the door or window opens, the magnet and sensor move farther away from each other, and the strength of the magnetic field measured by the sensor changes. A computer connected to the sensor can react to this change to sound an alarm. 

In this project, you will design your own wireless alarm system using a tiny programmable computer board called a micro:bit. The micro:bit has a variety of built-in sensors, including a magnet sensor. This means that a single micro:bit can function as a door or window alarm (Figures 1 and 2). However, the micro:bit also has built-in radio communication abilities. This means that it can wirelessly send a message to another micro:bit. You can design your own alarm system, with one or more sensor micro:bits to detect if a door or window opens, and they can all transmit messages to a base micro:bit (that you can carry around with you) to alert you when something has been opened. 

Figure 1. A micro:bit and a magnet mounted on a window. The micro:bit shows a smiley face when the window is closed.

Figure 2. When the window opens, the magnetic field strength measured by the micro:bit changes, and it shows a frowning face.

The micro:bit also has a variety of other sensors, including an accelerometer which can detect motion, a light sensor which can measure light levels, and a microphone that can measure sound. All of these sensors could be included in a custom alarm system. The procedure of this project will focus on using magnets and the magnet sensor, but see the micro:bit tutorial series in the Bibliography to learn how to use the other sensors, and check out the Variations section for some ideas on how you can use them in an alarm system. 

Terms and Concepts

Questions

Bibliography

Materials and Equipment

Experimental Procedure

This project follows the Engineering Design Process. Confirm with your teacher if this is acceptable for your project, and review the steps before you begin.
  1. If you have never used a micro:bit before, watch our micro:bit setup video before you continue. 
  2. This is an engineering design project. There is no single "right answer" or correct way to do the project. Think about the criteria and constraints for your project before you continue. 
    1. What do you want your alarm system to monitor? See the introduction for some ideas. 
    2. What sensor(s) will the micro:bit boards need to use?
    3. How many micro:bit boards do you have available?
    4. What should the effective range of your transmitter and receiver be?
    5. How do you want the alarm to be activated? You could use more than one method, for example:
      1. Play a sound on the transmitter micro:bit to scare away an intruder
      2. Play a sound on the receiver micro:bit to notify you when an alarm has been activated
      3. Display a message on the screen of the receiver micro:bit to notify you which alarm has been activated (useful for multiple alarms)
    6. How should the system react if multiple alarms are triggered at the same time?
  3. To use the magnet sensor to detect when a door is opened or closed, you will first need to calibrate your sensor. This means you need to know the magnetic field strength values when the magnet is close to the micro:bit and when it is farther away. We recommend watching our micro:bit magnet sensor video before you continue.
  4. Write a simple program to print a single-axis magnetic force value to the serial monitor (Figure 3).
Figure 3. A simple program to print magnetic force to the serial monitor.
  1. Download the program to your micro:bit. Leave the micro:bit plugged into the USB cable, and click Show data Device.
  2. Watch the serial monitor. Experiment with moving a magnet near your micro:bit. Try changing the magnet's orientation, and moving it closer to/farther away from the micro:bit from different directions. How does the magnetic force value change? Write down the values when the magnet is very close to the micro:bit and when it is at least a few centimeters away. 
    1. Note: the magnetic force value may be positive or negative. Whether the force is positive or negative depends on the direction of the magnetic field (north or south) relative to the magnet sensor's axis. 
  3. Change the magnetic force block to the y-axis and re-download your program. Repeat step 6 and write down the values. Repeat the process again for the z-axis. 
  4. Based on the results of your testing, think about how you will physically mount the micro:bit and magnet to a door or window and the surrounding frame. Think about the constraints and criteria you have to work with:
    1. There will always be some fluctuations, or noise, in the sensor reading, even when the micro:bit and magnet are holding still. Your goal is for there to be an easily detectable, large change in the magnetic force reading when the door or window opens or closes. What orientation(s) and axis resulted in the biggest change in the magnetic force reading when the micro:bit and magnet moved apart?
    2. Does this orientation work when it comes to physically mounting the micro:bit and magnet? For example, it is much easier to tape a flat side of a micro:bit to a door than one of the edges. 
  5. Once you have decided on the relative orientations of the micro:bit and magnet and what magnetic force axis you will use, check the magnetic force values you wrote down. What is the value when the micro:bit and magnet are close? What is the value when they are farther away? Choose a threshold value approximately halfway between these two values. 
  6. Write a program for your transmitter micro:bit like the one in Figure 4.
    1. Figure 4 is just an example - make sure to choose the correct axis and enter the threshold value you chose from your testing.
    2. Remember that you can choose different actions, like showing different icons or messages on screen, or playing a sound.
    3. We will add radio communication later - first you will test to make sure this program works. 
microbit magnetic alarmImage Credit: Ben Finio / Science Buddies

forever if magnetic force (uT) y > -100 then show icon frown else show icon smile

Figure 4. Program for simple magnetic door or window alarm. Your threshold value and magnetic force axis may be different.
  1. Download the new program to your micro:bit. 
  2. Test the program by moving the magnet toward and away from the micro:bit. 
    1. Note: if your micro:bit's behavior seems reversed (it shows the frowning face when the magnet is close, and the smiley face when the magnet is far away), change the greater than (>) sign to a less than (<) sign and re-dowload the program. 
  3. Once you are sure the program works, disconnect your micro:bit from the USB cable and plug it in to the battery pack. 
  4. Use double-sided foam tape to mount your micro:bit and magnet on the door/window and frame. 
  5. Test opening and closing the door/window a few times to make sure the alarm works properly. 
  6. You should now have a working alarm with a single micro:bit. However, what if you are in a different room in your home, and you cannot see or hear the alarm micro:bit? It would be nice if you could automatically receive an alert about the alarm. That is where radio communication comes in. Add a radio send number block to your program as shown in Figure 5.
microbit magnet alarm transmistterImage Credit: Ben Finio / Science Buddies

forever if magnetic force (uT) y > -100 then show icon frown radio send number 1 else show icon smile

Figure 5. Alarm program modified to send a radio message.
  1. Write a separate program for your receiver micro:bit. Figure 6 shows an example, but remember that you could choose different actions. Download this program to a second micro:bit.
Figure 6. Example receiver program.
  1. Test your transmitter/receiver combination.
    1. Keep the receiver with you. Open the door or window yourself while you are in the same room. Does the alarm sound on the receiver?
    2. Try having someone else open the door or window while you are in a different room. Does it still work?
    3. Note that, using the code in Figure 5, the transmitter micro:bit will continue to send radio messages as long as the window is open, and the receiver micro:bit will store these messages in a queue. See the Variations section for more information. 
  2. Once you have a basic working alarm system with a single transmitter and single receiver, it is time to iterate and improve your alarm based on your criteria and constraints. Here are some suggestions. See the Variations section for even more ideas. 
    1. Test the reliability of your system. Do you ever get a false negative where the alarm fails to trigger?
    2. Can you add a second transmitter micro:bit? Have the second transmitter send a different number in its radio message. Use an if/else if statement in your receiver micro:bit's program to determine which transmitter sent the alarm, and display different messages accordingly. 
    3. Test the range of your alarm system. How far away can you go before you stop receiving the alerts?
      1. Can you improve the range using the radio set transmit power block?
      2. What about the radio set frequency band block? This may be useful if there is interference from other wireless devices in the area, like WiFi routers, cordless phones, or baby monitors. If you change the frequency band, make sure you do it on all the micro:bits you are using. 
icon scientific method

Ask an Expert

Do you have specific questions about your science project? Our team of volunteer scientists can help. Our Experts won't do the work for you, but they will make suggestions, offer guidance, and help you troubleshoot.

Global Goals

The United Nations Sustainable Development Goals (UNSDGs) are a blueprint to achieve a better and more sustainable future for all.

This project explores topics key to Industry, Innovation and Infrastructure: Build resilient infrastructure, promote sustainable industrialization and foster innovation.

Variations

  • Can you make your alarm system use additional sensors? 
    • The light sensor can detect when someone opens a door or turns on a light in a dark room, or when someone opens the lid of a container.
    • The sound sensor can detect loud sounds above a certain threshold.
    • The accelerometer can detect different types of motion.
      • You could use this as an additional method to detect whether a door or window has been opened, or mount the micro:bit on a portable object to detect when it has been picked up.
      • Is the accelerometer sensitive enough to detect vibrations from footsteps?
  • Can you add two-way radio communication to your alarm system? For example, make a micro:bit mounted on a door play an alarm sound when the door is opened, and press a button on another micro:bit to silence the alarm. 
  • What happens to your system when a windor or door is left open for a long time, or multiple alarms are triggered at once? The micro:bit can only respond to one radio message at a time, and it will store additional messages in a queue if it has not finished responding to the first one yet. However, this queue can only hold a certain number of messages, and additional messages will be dropped if the queue is full. This can be a problem if your alarm uses actions that take a long time, like scrolling a message across the micro:bit's screen. Can you write a program that does a better job handling message queueing and multiple alarms?

Careers

If you like this project, you might enjoy exploring these related careers:

Career Profile
Are you interested in developing cool video game software for computers? Would you like to learn how to make software run faster and more reliably on different kinds of computers and operating systems? Do you like to apply your computer science skills to solve problems? If so, then you might be interested in the career of a computer software engineer. Read more
Career Profile
Just as a potter forms clay, or a steel worker molds molten steel, electrical and electronics engineers gather and shape electricity and use it to make products that transmit power or transmit information. Electrical and electronics engineers may specialize in one of the millions of products that make or use electricity, like cell phones, electric motors, microwaves, medical instruments, airline navigation system, or handheld games. Read more

News Feed on This Topic

 
, ,

Cite This Page

General citation information is provided here. Be sure to check the formatting, including capitalization, for the method you are using and update your citation, as needed.

MLA Style

Finio, Ben. "Make Your Own Wireless Alarm System." Science Buddies, 21 Jan. 2026, https://www.sciencebuddies.org/science-fair-projects/project-ideas/CompSci_p082/computer-science/wireless-alarm-system-microbit. Accessed 10 June 2026.

APA Style

Finio, B. (2026, January 21). Make Your Own Wireless Alarm System. Retrieved from https://www.sciencebuddies.org/science-fair-projects/project-ideas/CompSci_p082/computer-science/wireless-alarm-system-microbit


Last edit date: 2026-01-21
Top
Free science fair projects.