This follows on from my previous project the Micro:Night.
Do you want to know if anyone enters your room at night? Maybe your sibling comes in to play a prank, or just to annoy you. Find out with this new Micro:bit sensor alarm.
You will need:
- 1 x 3D Printer + Filament
- 1 x BBC Micro:bit
- 3 x Crocodile clips
- 1 x PIR motion sensor (See details below)
- 1 x JST connector to battery pack
- 2 x AAA batteries
First, you'll need to print the Micro:bit holder, sensor holder, and base, which you can download from this page.
The Micro:Night alarm uses a PIR motion sensor to detect movement between 3 and 7 metres away. If you want a closer range, you’ll need to choose the appropriate sensor between 3 volts and 5 volts. Follow the link below to access the motion sensor I have used.
You’ll need to adjust the sensitivity and time delay on the motion sensor. If you use the one I have, turn both the orange dials anti-clockwise as far as they’ll go for the shortest range and time delay.
Once you have your sensor, you’ll need to connect it to the Micro:bit. Follow the instructions below to do this. I have used three crocodile clips, yellow, green, and white.
- The wire connected to Pin 0 on the Micro:bit, needs to connect to the MIDDLE pin of the sensor.
- The wire connected to pin 3V, needs to connect to the pin closer to the tiny red resistor on the motion sensor.
- The wire connected to the GND pin on the Micro:bit needs to connect to the final pin.
If you’d like a more technical explanation of the connections, follow the link below to the instructions for making an intruder alarm.
Once connected, you can compile the code below to your Micro:bit. The Micro:bit will display a single dim LED when no movement is detected, and all the LEDs brighter when movement is detected. If you have a buzzer, you can connect it up to the circuit and a tone will play when movement is detected as an alarm.
https://www.microbit.co.uk/rjxcev Block Editor
Once you’ve got the code, you’re ready to go! Place the Micro:bit and sensor in their holders as shown in the photos, connect up to power, and catch intruders!