Door alarm using Micro:bit

This Micro:bit is a small microcontroller designed to teach kids about programming. As well as the CPU, it has a 5x5 LED array for graphics, two buttons, an accelerometer, compass, thermometer, light meter, Bluetooth and a radio interface so that multiple of the boards can talk to each other. There's also 23 pins for different types of IO you can do, including attaching things like sensors, LEDs and speakers for audio. All this for AUD$25 including a battery pack so you can run it disconnected from the computer. Amazing!

Louis and I have been having loads of fun with it. It's really easy to get code onto it. You write programs in the Scratch-influenced visual editor environment and hit the [Download] button to download the program as a .hex file. You plug the Micro:bit in with USB and it shows up as a storage device. Drag the .hex file to the Micro:bit device and it copies the code over, reboots and runs your code. So simple!

Yesterday we made a simple alarm for Louis' bedroom door. It uses the compass to detect when the door has opened and then fires an alarm. It has a disable switch which involves breaking the banana plug connection on the board. The code itself is really simple and the hardest part was calibrating the compass readings to accurately trigger when the door opens.