You can use a micro:bit to demonstrate three smart-home ideas: a light-responsive lamp, a relay-switched fan, and an alarm triggered by light or movement. These are separate educational project designs, not one tested, integrated build. Keep the project to low-voltage components; the cited instructions do not establish a safe way to control mains-powered appliances or make this a certified home-security system.
How the three functions fit together
Each function follows the same basic loop: a sensor supplies an input, code compares or interprets it, and the micro:bit produces an output. The board can sense light through its LED display: the Micro:bit Educational Foundation describes a light sensor as “an input device that measures light levels” (Sensors).
- Light-responsive lamp: measure ambient light, compare the reading with a threshold, then switch a low-voltage lamp through a relay when it is dark enough.
- Fan: use code to turn a relay on or off; the relay switches a separate battery-powered fan circuit.
- Alarm: respond to a light-state message or movement input with a sound, a display, or both.
The available instructions describe these as separate activities. They do not provide a single wiring diagram or program combining all three, so treat them as modules to learn from rather than a verified complete smart-home system.
What you need
Choose components to match the functions you want to demonstrate. Check that the relay and other accessories are compatible with your micro:bit and that the loads are low-voltage.
Recommended Free Tools
#1 Best Overall
- 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.
- A micro:bit board and a way to program it. The Foundation identifies MakeCode as its official blocks-based editor and also provides a text-based Python editor (What is the micro:bit?).
- For the lamp or fan: a compatible relay, a battery holder and battery for the load circuit, and either a low-voltage LED lamp or a low-voltage motor with fan. MonkMakes’ Electronics Kit 2 instructions show relay-based fan and nightlight activities (Electronics Kit 2 for micro:bit instructions).
- For movement detection: an appropriate 3V PIR sensor and three suitable leads for 3V, GND and signal connections (PIR movement alarm).
- A second micro:bit if you want to follow the Foundation’s radio-linked light or movement alarm examples.
Make an automatic lamp that turns on when it is dark
The micro:bit’s LED display can measure light without an added light sensor. In the MonkMakes nightlight example, the program compares the reading with a threshold and switches an LED lamp through a relay when the reading falls below that value (Electronics Kit 2 for micro:bit instructions).
Set and tune the threshold
The example uses 50 as a starting threshold, not a universal setting. Room lighting, the board’s position and the surrounding environment affect the reading. The Foundation’s Light alarm activity likewise recommends adjusting its example threshold to local conditions; pressing button A displays a reading that can help you choose a value (Light alarm).
Rank #2
- Complete classroom kit: 10-unit club pack includes everything needed to get started: 10 micro:bit v2 boards, 10 micro USB cables, 10 battery holders, 20 AAA batteries, and 10 quick start guides — ideal for coding clubs, classrooms, and STEM workshops
- Built-in sensors and outputs: Each micro:bit v2 features 25 individually programmable LEDs, 2 programmable buttons, built-in speaker, microphone, light sensor, temperature sensor, accelerometer, and compass — no additional hardware required to start learning
- Wireless connectivity and AI-ready: Supports Radio and Bluetooth communication between devices for group projects and collaborative coding; technical upgrades enable students to explore AI and machine learning concepts hands-on
- Easy to program on any platform: Compatible with desktop computers via USB (480 Mbps data transfer); program using MakeCode (block-based), Python, or Scratch; backward compatible with all existing micro:bit v1 lessons, tutorials, and code
- Compact, durable, and classroom-friendly: Each board measures just 2" x 2" x 0.4" and weighs only 69g; battery-powered for portable use; designed for ages 8+ with no soldering required, making it safe and accessible for students of all skill levels
- Place the micro:bit where it will sense the room’s ambient light, and note the displayed reading in the conditions where you want the lamp to come on.
- Use that reading to choose a threshold, then test the program as the light changes. The MonkMakes example notes that a lower threshold makes the lamp wait for darker conditions.
- Connect the lamp to the relay’s separate, low-voltage load circuit as directed by the relay kit instructions. Do not connect the lamp’s load to a micro:bit GPIO pin.
Switch a fan with the micro:bit
A relay lets the micro:bit control a separate battery-powered fan circuit. In MonkMakes’ clap-controlled example, the board toggles a variable when it detects a loud sound and sets pin 0 high or low to control the relay. The relay, rather than pin 0, switches the separate battery-and-fan circuit (Electronics Kit 2 for micro:bit instructions).
This is a relay-control pattern, not a direction to power a motor from a micro:bit pin. Follow the compatible relay’s own connection instructions and use the separate battery supply specified for the fan circuit. You can adapt the idea to a chosen control condition, but the cited material does not document a unified program in which the light threshold, fan and alarm work together.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #3
- 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.
Build a light alarm with two micro:bits
The Foundation’s Light alarm project uses two boards: one senses light and transmits a status message; the other receives it and responds. The sensor board sends “lights on” or “lights off” messages every 10 seconds. Both micro:bits must use the same radio group (Light alarm).
- Load the Foundation’s Light alarm program in MakeCode or Python on both boards, using the project guide for the corresponding code.
- Set the same radio group on both boards so the receiver can hear the sensor board.
- Use the button-A reading to help tune the light threshold for the room.
- Test the chosen behavior. The example receiver shows an angry face and plays an alarm sound when it receives “lights on”; the guide suggests changing the response or combining the alarm with another sensor.
The example’s sound may not suit every setting. Consider using the display as visual feedback, or pairing visual feedback with sound where appropriate; the Foundation notes loud sounds as an accessibility consideration.
Rank #4
- This BBC micro:bit v2 Club kit is upgraded with a powerful new processor housing tons more capability and also adds a new speaker and microphone!
- 25 individually-programmable LEDs, 2 programmable buttons, Light and temperature sensors, Motion sensors (accelerometer and compass)
- MEMS microphone;Speaker to play audio tones
- Wireless Communication, via Radio and Bluetooth
- Package includes: 10x micro:bit v2 boards, 10x mirco USB cables, 10x battery holders, 20x AAA batteries,10x user guides
Add movement detection with a PIR sensor
A PIR sensor adds movement as an external input. In the Foundation’s movement-alarm project, the sensor’s power connects to 3V, ground to GND, and signal output to pin 0. The transmitting micro:bit sends a movement or still message to a second micro:bit, which can provide the alarm response (PIR movement alarm).
- Connect the PIR sensor’s 3V, GND and signal leads to the matching micro:bit connections shown in the project guide.
- Load the project’s transmitter and receiver programs onto two micro:bits and configure them to communicate as instructed.
- Test the sensor in its intended position. Sensitivity and timing may need adjustment; consult the sensor’s own documentation as well as the Foundation’s guide.
The Foundation suggests combining alarm sensors into a network. That is an educational design idea, not evidence that a combined light-and-motion setup meets the reliability or security requirements of a real alarm.
Quick Recap
Best Value
- Box Includes: 1 x official micro:bit v2.2 Board, 1 x micro USB Cable, 1 x Battery Holder, 2 x AAA Batteries, 1x Quick Start Guide
- microbit V2.2 is a tiny programmable computer, designed to make learning and teaching easy and fun!
- It's good for beginner coders, as well as advanced ones. Great to get the youth and young adults started with electronics.
- Easy to set up, easy to use. Use your imagination to use programming and electronics.
Choose the simplest build for your goal
| Goal | Micro:bits and input | Output and key consideration |
|---|---|---|
| Show an automatic nightlight | One board can use its LED display as a light sensor. | A relay switches a separate low-voltage LED lamp circuit; tune the threshold in the actual room. |
| Demonstrate a switched fan | The cited clap-controlled example uses one board’s sound input. | Pin 0 controls a relay; a separate battery circuit powers the fan. |
| Follow the radio light alarm | Two boards: one measures light, the other receives radio messages. | The receiver displays an alert and can play an alarm sound; both boards need the same radio group. |
| Follow the PIR movement alarm | Two boards and an external 3V PIR sensor. | The sensor board sends movement or still status to the alarm board; sensor timing and sensitivity may need adjustment. |
Keep the prototype within its limits
- Use the relay and separate battery-powered load circuit described by the relevant project instructions. Do not connect a motor directly to a GPIO pin.
- The cited educational instructions do not validate mains-voltage wiring. Do not use this article as a guide to switching household mains appliances.
- A classroom prototype is not a substitute for a certified burglar alarm, smoke alarm, or smart-home controller.
- Choose sound, visual feedback, or both with the people and environment in mind; loud alarm sounds can be an accessibility concern.
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.

