We’ve recently had some PCBs made that allow you to attach a PIR movement sensor, buzzer, and magnetic door sensor to your micro:bit.
The PIR movement sensor is wired to pin 0 on the micro:bit, the magnetic door sensor contacts connect to pin 1, and the buzzer is wired to pin 2.
You can use the board as the basis for lots of different projects. You can make several micro:bit alarm boards talk to each other using the Radio function. You can attach the micro:bit to your PC or Mac and use Thonny/Python3 to read serial line messages from the micro:bit and send an email to your phone whenever the sensors are triggered or write events to a log file. The PDF manual contains examples of both.
Our PDF manual for the Alarm Board can be downloaded from http://www.securipi.co.uk/alarmbit.pdf
You can buy a ready-assembled board with the PIR sensor, magnetic door contacts and 3 metres of cable from Amazon for £13.99 https://www.amazon.co.uk/dp/B0778WBMJB
Here’s what the Thonny/Python3 code looks like running on a Windows 7 PC. This code reads “Serial Line” messages from the micro:bit’s USB port and stores the time and date of alarm triggers in a log file. Read our PDF manual to see more examples.
We can also supply the Alarm Board in a self-assembly kit that you solder together yourself for £7.95 https://www.ebay.co.uk/itm/162765653352
The PIR modules we supply have been modified to work at 3 volts (there’s a page explaining how to do that in our PDF manual).