Two micro:bit V2 boards · MakeCode or Python
micro:bit radio door alert
Use a magnet and two micro:bits to turn door movement into radio messages, visual indicators and sound.
Multi-module setup and debugging
What you will build
A transmitter reports magnetic-field changes; a nearby receiver shows the open or closed state and sounds an alert.
Before you start
- Understand loops, conditions and radio groups, and transfer a different program to each board.
Model and software requirements
- Use the original transmitter and receiver programs with matching radio groups. Two V2 boards are this page's selected configuration, not an official V2-only restriction.
- MakeCode magnetic readings use µT; MicroPython uses nT. Adjust the threshold in the editor's own units rather than copying a number between languages.
Similar products, older hardware and other software versions are not automatically interchangeable.
Materials & equipment checklist
Check items as you prepare them. Follow each source for part specifications, kit contents and assembly requirements.
0 of 6 required materials ready
Checks stay on this page only and are not uploaded. Refreshing or leaving resets them.
Required materials
- × 2
Selected here for built-in sound; the original project also allows V1 with an external sound device.
Material referencehttps://microbit.org/projects/make-it-code-it/door-alarm/ - × 1
For the transmitter.
Material referencehttps://support.microbit.org/support/solutions/articles/19000013982-connecting-a-power-supply-to-the-micro-bit - × 2
For the transmitter's compatible holder.
Material referencehttps://support.microbit.org/support/solutions/articles/19000013982-connecting-a-power-supply-to-the-micro-bit - × 1
Program each board, then power the receiver through the computer.
Material referencehttps://microbit.org/get-started/user-guide/transfer-code-to-the-microbit/ - × 1
The project does not specify a model or strength; select and position it by measuring the actual readings.
Material referencehttps://microbit.org/projects/make-it-code-it/door-alarm/ Prepare enough to secure the board, battery holder and magnet. Mounting suggestion: avoid stressing connectors.
Material referencehttps://microbit.org/projects/make-it-code-it/door-alarm/
Optional materials
- × 1
Optional alternative to USB: one compatible holder and two AAA cells.
Material referencehttps://support.microbit.org/support/solutions/articles/19000013982-connecting-a-power-supply-to-the-micro-bit
Equipment & tools
- A computer and one data cable can program the boards in turn. This route powers the receiver by computer USB and the transmitter by batteries.
Build route
Follow the original instructions in order. This overview does not replace wiring diagrams or calibration procedures.
- 1
Assign boards and power
Label the transmitter and receiver and prepare their selected power sources.
Open this step - 2
Load the two programs
Use the project's transmitter and receiver sections. Keep their radio groups aligned.
Open this step - 3
Position the magnet
Follow the original arrangement: the magnet approaches the transmitter when the door closes. Testing suggestion: first compare near and far positions on a desk.
Open this step - 4
Measure and adjust
Read values with transmitter button A in both positions, then choose a threshold in the selected language's units.
Open this step - 5
Check messages
Compare open and closed indications; check programs, power and groups if messages are missing.
Open this step
First-run checks
- Moving the magnet away produces the open indicator and sound on the receiver.
- Moving the magnet close produces the closed indicator without a new alarm sound.
- Repositioning the hardware prompts a fresh reading check and threshold adjustment.
Outside this project's scope
- This is a learning model, not a security system. It has no guaranteed outage detection, phone alerts or internet monitoring.
Assembly and operation notes
- Warn others before sound tests and do not hold the receiver against an ear. Mount without shorting exposed circuits.
- Use separate radio groups for independent projects in the same area.
What to include in your budget
- Count two boards, transmitter batteries, USB cable, magnet and mounting materials. Add a second battery pack only for a receiver away from USB.
Original documentation and code
- Original door-alert project and both programsPublic resource
MakeCode, Python and HEX entry points; original content is CC BY-SA 4.0.
https://microbit.org/projects/make-it-code-it/door-alarm/ - Transfer programsPublic resourcehttps://microbit.org/get-started/user-guide/transfer-code-to-the-microbit/
- Power requirementsPublic resourcehttps://support.microbit.org/support/solutions/articles/19000013982-connecting-a-power-supply-to-the-micro-bit
- MicroPython magnetic unitsPublic resourcehttps://microbit-micropython.readthedocs.io/en/v2-docs/compass.html
- MakeCode magnetic unitsPublic resourcehttps://makecode.microbit.org/reference/input/magnetic-force
- Board safetyPublic resourcehttps://microbit.org/get-started/user-guide/safety/
Sources accessed: 2026-10-14. This page is compiled from the original documentation and has not been hardware-tested by RoboFacet. Check the original source for kit contents, prices and software updates.