Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
BETTESWORTHConstruction
BBC micro:bit

Create a Short-Range Wireless Intruder Alarm with Two BBC micro:bits

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Build a working wireless intruder-alert prototype with two BBC micro:bits and a 3 V PIR motion sensor. One micro:bit detects movement and broadcasts a radio message; the second receives it, displays an alert and can sound a buzzer, speaker or headphones.

Important: “Remote” means the two devices are physically separated but connected by short-range micro:bit radio. This project does not send alerts over the internet or to a phone, and it is not a certified or dependable replacement for a commercial burglar-alarm system.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What you will build

PIR sensor → sensor micro:bit )))) radio (((( receiver micro:bit → LED + buzzer

The transmitter sits near the area you want to monitor. Its PIR sensor produces a digital signal when it detects movement. The transmitter sends a message such as moving to a second micro:bit elsewhere nearby. The receiver shows an alert and activates an audible output.

The micro:bit radio is a device-to-device broadcast system. Its performance depends on walls, interference, orientation, batteries and transmit-power settings, so do not assume a guaranteed distance.

Popular on Amazon
KEYESTUDIO Microbit Basic Starter Kit for BBC Micro:bit V2 Accessories STEM Kit Coding for Beginners (Micro:bit V2.21 Included)
  • Microbit controller V2.21 is included!onboard comes with BLE, accelerometer, electronic compass, three buttons, 5 x 5 LED dot matrix, mainly used for teens' programming education.
  • Specially designed this starter kit includes commonly used resistors, LEDs, sensors, LED segment display and more to get you started with 18 interesting projects at least.
  • We have detailed tutorials (including an introduction, wiring diagram, test code, driver installation, Example Projects...... Step by step to explain how to use on our wiki page.
  • Each sensor is packaged individually and then held in a beautiful plastic box with compartments, it must be the best kit for you, your friends, and electric newbies or hobbyists.
  • All boards are well-packed after function, voltage and current testing. The kit is well packaged, with each item packed separately.

See the official micro:bit PIR movement alarm project for the original wiring and example programs.

Parts and tools

Required

  • Two BBC micro:bit boards
  • Two battery packs
  • One PIR motion sensor designed to operate at approximately 3 V
  • Three suitable connecting leads or crocodile clips

Optional

  • Buzzer, speaker or headphones for the receiver
  • Edge connector or breakout board for more reliable wiring
  • Small screwdriver for adjusting PIR sensitivity and delay controls
  • Mounting tape, a case or a small project box

For buying information, use the official micro:bit buying page. Established maker suppliers include Kitronik, Pimoroni and Adafruit PIR sensors.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Wire the PIR sensor safely

PIR sensor label micro:bit connection
VCC, + or 3V 3V
GND GND
S, OUT or signal P0

Power down the micro:bit before changing connections. Check the sensor’s labels and documentation: the signal must not exceed the voltage suitable for a micro:bit GPIO pin. Do not connect an unspecified or 5 V-only sensor directly to a micro:bit pin. Use an edge connector or breakout board if crocodile clips are loose or difficult to identify.

How the alarm works

A PIR sensor detects changes associated with moving warm objects. It does not identify a burglar, distinguish a person from a pet or reliably detect someone who becomes stationary. Modules vary in warm-up time, output polarity, sensitivity and how long their output remains high after movement.

Both micro:bits must use the same radio group. The group number is a filter, not a password: it is not encryption or authentication. The official example uses group 73.

Program the transmitter in MakeCode

Open MakeCode, create a micro:bit project and flash it to the micro:bit connected to the PIR sensor. In Blocks, use this logic:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Set the radio group to 73.
  2. Inside forever, read digital pin P0.
  3. If the reading is high, show a warning icon and send the string moving.
  4. Otherwise, clear the display and send still.
  5. Pause between readings.

A JavaScript version of that teaching example is:

radio.setGroup(73)

basic.forever(function () {
    if (pins.digitalReadPin(DigitalPin.P0) == 1) {
        basic.showIcon(IconNames.SmallDiamond)
        radio.sendString("moving")
    } else {
        basic.clearScreen()
        radio.sendString("still")
    }
    basic.pause(1000)
})

Use the MakeCode blocks if you are teaching beginners; the important details are the shared group, the P0 input and the exact message text.

Also popular on Amazon
KEYESTUDIO Micro:bit V2 Go Kit Original Microbit V2 Starter Kit, with Micro:bit V2, Battery Holder, Micro USB Cable
  • Includes the BBC Microbit V2.2 which has new speaker sensor, Built-in 25 LEDs, 2 buttons, motion sensor, buzzer, light sensor, temperature sensor, compass, radio and Bluetooth wireless features make it easy to get you started with more fun projects.
  • This is an easy to use electronic board that is very versatile and can be coded many different ways. It can be integrated with other coding tools and on many platforms.
  • Coding is easy with online block gui, javascript and python. Compiles to hex file, which you then copy to microbit (looks like a drive to pc)
  • Box contains: 1 micro:bit v2.2, 1 USB cable, 1 battery holder, 2 AAA batteries, user guide
  • Free tutorials and project ideas available on the micro:bit website. The instructions are easy to follow for a beginner to learn to code with it.

Program the receiver in MakeCode

Flash a separate program to the second micro:bit. Set its radio group to 73, then add an on radio received receivedString event:

  1. If the received string equals moving, show an alert image and play a tone.
  2. If it equals still, clear the display or stop the alert.
radio.setGroup(73)

radio.onReceivedString(function (receivedString) {
    if (receivedString == "moving") {
        basic.showIcon(IconNames.Skull)
        music.playTone(262, music.beat(BeatFraction.Quarter))
    } else if (receivedString == "still") {
        basic.clearScreen()
    }
})

Audio connections differ between micro:bit revisions and accessories. If the sound output is uncertain, use the LED display as the primary indication and follow the documentation for your buzzer, speaker or headphones.

MicroPython version

MicroPython code must be used in the micro:bit Python Editor or another compatible MicroPython workflow. It will not run in the MakeCode editor. See the MicroPython documentation and the radio API reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Transmitter

from microbit import *
import radio

radio.config(group=73)
radio.on()

while True:
    if pin0.read_digital():
        display.show(Image.DIAMOND_SMALL)
        radio.send('moving')
    else:
        display.clear()
        radio.send('still')
    sleep(1000)

Receiver

from microbit import *
import music
import radio

radio.config(group=73)
radio.on()

while True:
    message = radio.receive()

    if message:
        if message == 'moving':
            display.show(Image.STICKFIGURE)
            music.play(["C4:4"])

        if message == 'still':
            display.clear()

These are the official project’s basic examples. The receiver plays a note whenever it processes a moving packet, so frequent status messages can produce repeated sounds.

Test and calibrate it

  1. Flash the transmitter program to one micro:bit and the receiver program to the other.
  2. Check that both programs use the same radio group and matching message strings.
  3. Connect the PIR sensor to 3 V, GND and P0.
  4. Power both boards from their battery packs.
  5. Allow the PIR module to complete its startup or warm-up period.
  6. Walk through the sensor’s detection area.
  7. Confirm that the transmitter displays a warning.
  8. Confirm that the receiver displays an alert and produces sound.
  9. Walk away and observe whether the receiver clears the alert when it receives still.
  10. Test the receiver from its intended position, including through the doors or walls that will separate the boards.
  11. Disconnect and reconnect both battery packs to check startup behaviour.
  12. Switch off the receiver during movement and decide how your design should respond when it is restarted.

Improve sensor placement

Face the PIR across the expected entry path rather than directly at a nearby wall. Keep it away from heaters, windows receiving direct sunlight, air-conditioning outlets and moving curtains. Mount the sensor firmly so that cable movement does not create false triggers.

If the PIR reports movement continuously, wait through its warm-up period, then adjust sensitivity and hold-time controls with the screwdriver. Check the module’s documentation and verify whether its signal is active-high or active-low.

Reduce battery use

The simple program sends either moving or still every second. That is easy to understand and helps the receiver recover its current state after a missed packet, but it uses more radio power. The official project also warns that continuous status transmission is inefficient.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Also popular on Amazon
Freenove Ultimate Starter Kit for BBC micro:bit (V2 Included), 316-Page Detailed Tutorial, 225 Items, 44 Projects, Blocks and Python Code
  • micro:bit V2: Latest version official board, a pocket-sized device allows you to get hands-on with coding and digital making
  • 2 Sets of Codes: Block-based visual programming language code and Text-based Python code
  • 316-Page Detailed Tutorial: Provides step-by-step guide with basic electronics and components knowledge (The download link can be found on the product box) (No paper tutorial)
  • 44 Projects from Simple to Complex: Each project has schematics, wiring diagrams, complete code and detailed explanations
  • 225 Items in Total: This kit includes the common components, modules and sensors available for the board

An event-only transmitter sends messages only when the sensor state changes:

from microbit import *
import radio

radio.config(group=73)
radio.on()

previous_state = 0

while True:
    current_state = pin0.read_digital()

    if current_state and not previous_state:
        radio.send('moving')
        display.show(Image.DIAMOND_SMALL)
    elif not current_state and previous_state:
        radio.send('clear')
        display.clear()

    previous_state = current_state
    sleep(100)

This reduces transmissions and usually improves battery life, but a single missed moving packet can prevent the receiver from learning about the event. A practical compromise is to repeat moving periodically as a heartbeat, accepting the extra battery use.

Make the receiver latch the alarm

For a more useful alarm, make the receiver remain active after the first movement message instead of playing a sound for every packet. Add a reset action, such as pressing button A, and have the receiver stop or silence the alert only after reset. You can also add a timeout.

For multiple transmitters, use distinctive messages such as front-door:movement, garage:movement and kitchen:still. All devices still need the same radio group, but the receiver can display which sensor sent the alert.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The radio API supports configurable groups, power, message length, queue size and transmission rate. Higher transmit power can improve communication in some situations but may reduce battery life. See the MakeCode radio reference and MicroPython radio documentation.

Choose the right detection method

Method Best for Trade-off
PIR motion sensor People moving through a room or corridor Needs wiring and can react to pets, heat or airflow
Magnetometer and magnet Doors, drawers, cabinets and bags Nearby metal and magnets can affect calibration
Accelerometer Tampering with a box, bag, bicycle or valuable object Detects movement of the object, not room entry

The official door alarm uses a magnet near the micro:bit and sends an open message when the magnetic reading changes. The tilt alarm is better for detecting movement of a protected object. The project library also includes light-alarm concepts.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting

The receiver does nothing

  • Confirm both boards are powered and programmed.
  • Confirm the group number is identical.
  • Check that moving is spelled exactly the same in both programs.
  • Move the boards closer and test without heavy shielding.
  • Check that the PIR signal is connected to P0.
  • Ensure the receiver is not trapped in a blocking alarm loop.

The PIR constantly reports movement

Wait for warm-up, adjust sensitivity and delay, check the ground connection, and move the sensor away from heaters, sunlight, air-conditioning and moving objects. Temporarily display the raw digital reading to determine whether the module’s logic is reversed.

Also popular on Amazon
KEYESTUDIO Basic Starter Kit for BBC Micro bit V2, Graphical Programming Built-in Compass, Buttons, LED Matrix Display + Battery Holder & USB Cable for Microbit
  • BBC Micro:bit Development Board V2.2 is included! New micro:bit with sound.
  • Battery holder with On-Off switch to power the micro bit which is very convenient for controlling.
  • Micro:bit is a great platform to start, you code visually via the block editor which is a way to learn JavaScript basics using blocks of code.
  • Connection Diagram, Sample Code, Using Method and User Guide are provided on our wiki page.
  • It has an led matrix, compass, accelerometer and a microphone, which makes it easy to reprogram as a smartwatch, logging platform, gesture controller, or an external speaker for audio.

The alarm triggers repeatedly

The transmitter may be sending moving every second and the receiver may be playing a tone for every packet. Use event-only messages, play sound only when the alarm changes from inactive to active, or add a latched alarm with a reset button.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

There is no sound

Check whether your board revision requires an external audio device, whether the buzzer is connected correctly, whether the program reaches its tone instruction and whether the output is loud enough. Test the display independently of the audio.

Radio alerts are missed

Keep messages short, process them promptly and avoid unnecessary broadcasts. Radio packets are queued, and a full receive queue can cause incoming messages to be ignored. A heartbeat or acknowledgment scheme can improve visibility of link failures, but neither makes the system fail-safe.

Security and safety limitations

This project should be treated as a classroom, maker or educational wireless alert—not as primary security equipment.

  • The radio group is not encryption, a password or authentication.
  • A nearby micro:bit using the same group may receive or interfere with messages.
  • The system does not contact a phone, monitoring company or emergency service.
  • It has no guaranteed delivery, professional tamper detection or backup-power monitoring.
  • It may fail silently if the receiver loses power or radio contact.
  • Someone could remove the transmitter or battery without being detected.
  • PIR sensors can miss a person who stops moving and can trigger on pets or environmental changes.

Do not rely on it as the only protection for a home, business, medication, valuables or a vulnerable person. A certified commercial alarm is the appropriate choice where dependable security matters.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Buying the right upgrade

For most beginners, the practical route is a two-board micro:bit starter bundle, two battery packs, a documented 3 V PIR sensor and a simple buzzer or speaker. An edge connector or breakout board is worthwhile if the project will remain assembled.

Choose a sensor with clearly labelled power and signal pins, a documented 3 V-compatible output, adjustable sensitivity and delay, and suitable leads. Avoid unspecified 5 V-only modules, high-current speakers connected directly to GPIO pins and mains-powered sirens. MakeCode and the official Python documentation are free; no paid coding subscription is required.

Prices vary by country, currency, shipping and whether a listing contains one board, two boards or only a sensor, so check the supplier pages on the day you buy.

Quick Recap

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.