Abstract
Have you ever wondered what someone would do if they fell, got hurt, and could not get up on their own? What if they were home alone and could not reach a phone to call for help? Or, what if they lost consciousness - is there any way to automatically detect that they fell and needed help? In this project, you will program your own fall detector, a device that can automatically detect when someone has fallen over, then sound an alarm or even send a message to someone else. Devices like these are used by many people with a variety of medical conditions - in this project, you will get to make your own and learn about how they work!
Summary
None
This project requires a micro:bit and a computer with an internet connection and a USB port. See materials list for details.
No issues
Objective
Program a medical alert fall detector device to automatically detect a fall and sound an alarm to alert others.
Introduction
Have you ever wondered how motion controls in video game controllers work? Or how a phone knows to automatically rotate the screen if you turn it sideways? These devices use an electronic sensor called an accelerometer. There are many different types of sensors that can measure all sorts of things, like sound, temperature, and light. Accelerometers measure acceleration, which is a change in speed. That is how a video game controller can detect when you shake it. Accelerometers can also detect which direction gravity is pointing, which helps devices tell which way is up and which way is down. That is how your phone knows to rotate the screen if you turn it sideways!
Accelerometers have other uses too. Think again about the question in the abstract. How could you automatically detect if someone has fallen over? By using an accelerometer! Accelerometers can detect both sudden changes in motion (like the impact of hitting the floor) and orientation (the difference between standing up and lying down). Devices that can automatically detect when someone falls are called fall detectors or fall monitors. More generally, a medical alert device or medical alarm can monitor other things, like whether a person's heart rate or breathing rate has dropped too low, if they have not moved for a certain period of time, or their location (using GPS). Many devices also have a button the person can push to summon help (for example, by calling a family member or 911) and voice communication abilities. These wearable devices can take different forms, like necklaces or bracelets (Figure 1).

In this project, you will use a pocket-sized programmable computer called a micro:bit to make a medical alert fall detector (note that technically it is "micro:bit" with a colon in the middle, not "microbit"). The micro:bit has many built-in sensors, including an accelerometer. It uses the accelerometer to measure pitch and roll angles (Figure 2). This lets you write code that does something when the micro:bit tips past a certain angle.
- When the micro:bit is lying flat with the edge connector pins facing you, both angles are zero.
- If you tip the micro:bit to the right, the roll angle increases (it will be a positive number).
- If you tip the micro:bit to the left, the roll angle decreases (it will be a negative number).
- If you tip the micro:bit toward yourself, the pitch angle increases (it will be a positive number).
- If you tip the micro:bit away from yourself, the pitch angle decreases (it will be a negative number).

The micro:bit has other features like buttons, a grid of LEDs (tiny lights), a speaker, and it can even send messages to another micro:bit. The project's procedure will show you how to build a very basic fall detector that detects when the micro:bit tips over, but you can decide what other features you want to use!
Terms and Concepts
- Sensor
- Accelerometer
- Acceleration
- Gravity
- Fall detector
- Fall monitor
- Medical alert device
- Medical alarm
- micro:bit
- Pitch
- Roll
- LED
Questions
- What sensors are built in to the micro:bit?
- What are some features of fall detectors/medical alert devices that you can buy online?
- What features do you want to program into your micro:bit fall detector?
Bibliography
- Micro:bit Educational Foundation (n.d.). Getting Started. Retrieved June 7th, 2024
- Microsoft MakeCode (n.d.). Rotation. Retrieved June 7th, 2024
- Finio, B. (n.d.). Accelerometer Technical Note. Science Buddies. Retrieved June 7th, 2024
- Science Buddies Staff (n.d.). Engineering Design Process. Science Buddies. Retrieved June 10th, 2024
Materials and Equipment
- micro:bit Go Bundle. This kit contains everything you will need to get started working with micro:bit:
- micro:bit board
- micro-USB cable
- 2xAAA battery holder
- AAA batteries (2)
- Computer with internet access and USB port
Disclaimer: Science Buddies participates in affiliate programs with Home Science Tools®, Amazon.com, Carolina Biological, and Jameco Electronics. Proceeds from the affiliate programs help support Science Buddies, a 501(c)(3) public charity, and keep our resources free for everyone. Our top priority is student learning. If you have any comments (positive or negative) related to purchases you've made for science projects from recommendations on our site, please let us know. Write to us at [email protected].
Experimental Procedure

- If this is your first time using a micro:bit, follow the Getting Started instructions on the micro:bit website to learn how to use your micro:bit and connect it to your computer.
- Decide what programming language you will use for your micro:bit:
- If you are new to coding, we recommend using Microsoft MakeCode to program your micro:bit. MakeCode is a graphical programming language where you make computer programs using colored blocks of code instead of a text editor. The example code in this procedure uses MakeCode. We recommend following a few of the MakeCode tutorials before you proceed.
- You can also program your micro:bit in Python, JavaScript, and Scratch. You may prefer this approach if you already have programming experience in one of these languages. See the Let's Code page for more details.
- Start a new MakeCode program and make the code shown in Figure 3. You can also access the program on the MakeCode website here. This program will make the micro:bit display a smiley face when it is standing upright and a frowning face when lying flat (Figure 4).
- Download the program to your micro:bit and test it yourself:
- Stand the micro:bit upright on its front edge as shown in the left side of Figure 4. In this position, the pitch angle is 90 degrees. What does the micro:bit display?
- Lay the micro:bit flat with the LEDs facing up. In this position, the pitch angle is zero degrees. What does the micro:bit display?
- Tilt the micro:bit forward so the LEDs are facing down (hold it up in the air so you can see the LEDs). In this position, the pitch angle is 180 degrees. What does the micro:bit display?


- Look at the code so you can understand how it works. The key to this program is an
if/elsestatement. The code tells the micro:bit "IF the pitch angle is outside of a certain range, show a frowny face. ELSE, show a happy face." The condition for theifstatement will be true if thepitchvariable is less than theangle1variable OR if thepitchvariable is greater than theangle2variable. That way, when the micro:bit is "vertical," it will show a smiley face. When it "falls over" (either forward or backward), it will show a frowny face. - Try changing the
angle1andangle2variables and re-downloading the code. What happens if you make the angles bigger? Smaller? What values do you think will work the best for a fall detector if a person is wearing the micro:bit, for example, in their pocket or clipped to a belt? - Now it is time to use the engineering design process to design your own fall detector. There is no "right" or "wrong" way to do this, but here are some suggestions for features you could add:
- Program a "help" button using the
on button A pressedblock underInputin the MakeCode menu. - Make the micro:bit play a sound in addition to displaying something with the LEDs.
- Experiment with the
on shakeblock underInput. This block lets you detect a variety of motions using the accelerometer (you can change them using the drop-down menu). Do any of these make sense to use as part of a fall detector? - Try using the
on loud soundblock. Does this block work to detect loud sounds like a person falling or yelling for help? - See the Variations section for some more advanced suggestions.
- Program a "help" button using the
- Try some real-world testing of your fall detector.
- Use the battery pack that came with your micro:bit so it does not need to be plugged into a USB cable.
- Try wearing your micro:bit yourself or asking a volunteer. You will need to figure out how to attach it to a person's clothing or have them put it in a pocket.
- Try some (gentle!) practice falls onto something soft like a couch or pile of pillows. Does your fall detector detect the falls? If not, are there things you can change in your code, like the values of the
angle1andangle2variables, or other conditions you have set?
- Try iteratively testing and improving your fall detector based on the results of your tests.
Ask an Expert
Global Goals
The United Nations Sustainable Development Goals (UNSDGs) are a blueprint to achieve a better and more sustainable future for all.
Variations
- You can use your micro:bit to send messages to another micro:bit. Can you program your micro:bit to automatically send a "help" message when a fall is detected? See the secure messaging and Micro Chat tutorials on the micro:bit website.
- The example code in this project only uses the
pitchangle. What if someone falls sideways? Can you incorporate therollangle into your code? What combination of pitch and roll angles indicates that someone is standing upright and not fallen over? It can be helpful to monitor the pitch and roll angles using theserial write numbersblock underAdvanced/Serial. - One problem with the example code in this project is that it will immediately detect a "fall" if the micro:bit tips over. This can result in "false positives" — for example, what if someone is wearing the micro:bit, bends over to pick something up, then immediately stands back up? Can you write a program to wait and detect if a person is standing again before sounding an alarm?
- Can you write a program that will sound an alarm if a person has not moved for a certain amount of time?
Careers
If you like this project, you might enjoy exploring these related careers:










