Example Code for micro:bit-Burglar Alarm for Art Gallery
This article guides you through setting up a burglar alarm system for art galleries using the micro:bit, featuring hardware components like tilt and touch sensors, and software programming with MakeCode and Mind+. By following the provided wiring diagrams and sample code, you can ensure security by alerting with a buzzer when exhibits are touched or tilted.
Hardware Preparation
![]() |
![]() |
![]() |
|---|---|---|
| BOS0005 Tilt Sensor | Buzzer Module | Touch Sensor |
![]() |
![]() |
![]() |
| BOS0035 Mainboard-3IO | BOS0028 Logic OR module | BOS0040 micro:bit BOSON Expansion Board |
![]() |
||
| MBT0039 micro:bit |
Software Preparation
MakeCode, Mind+
Wiring Diagram
Non-programming Project

Programming Project

Other Preparation Work
micro:bit and its expansion board will be used in programming projects.
Result
When someone touches the exhibit or the exhibit is tilted, the buzzer makes sound to alarm.
Additional Information
Program Flowchart:

Was this article helpful?







