Micro:bit Combination Lock
by fatheenahemed in Circuits > Microcontrollers
2136 Views, 5 Favorites, 0 Comments
Micro:bit Combination Lock
![9.png](/proxy/?url=https://content.instructables.com/F8M/MDGB/KTCA0CXO/F8MMDGBKTCA0CXO.png&filename=9.png)
![rye.JPG](/proxy/?url=https://content.instructables.com/FBU/2G5M/KT1IDKRJ/FBU2G5MKT1IDKRJ.jpg&filename=rye.JPG)
You'll need
1 x BBC micro:bit
1 x Buzzer
4 x Crocodile clips
1 x Copper tape (or kitchen foil)
1 x Sticky back velcro (or double sided tape)
The Alarm Circuit
![it.JPG](/proxy/?url=https://content.instructables.com/F4Q/DPGC/KT1IDKRN/F4QDPGCKT1IDKRN.jpg&filename=it.JPG)
How it works
The BBC micro:bit can test if a circuit is complete. We can use this to activate different bits of code.
We are going to separate the circuit into two pieces, two strips that connect to the micro:bit and one strip which connects them together when it touches.
Make the Circuit Breaker
![ch.JPG](/proxy/?url=https://content.instructables.com/FRZ/ESJ8/KT1IDKR4/FRZESJ8KT1IDKR4.jpg&filename=ch.JPG)
Get the box
Because this circuit is so simple, you can use it on anything that closes! A door, a window, a fridge, a drawer, a jar, a box!
We're using a big box to make it easy to show how it all works, but get creative with your alarm system.
Open the box and attach a strip of copper tape on the inside, front lip of the lid.
Attach the Micro:bit
![cj.JPG](/proxy/?url=https://content.instructables.com/FGD/UJ4E/KT1IDKRM/FGDUJ4EKT1IDKRM.jpg&filename=cj.JPG)
Close the box slightly and mark 2 points where the strip touched the front.
Attach two vertical strips of copper tape here with a fold at the end You can use Velcro, glue pads or even blue tack!
Connect to the Micro:bit
![xnfu.JPG](/proxy/?url=https://content.instructables.com/FKG/ATWP/KT1IDKRK/FKGATWPKT1IDKRK.jpg&filename=xnfu.JPG)
Using crocodile clips, or stripped wires, connect one side to P0 and the other to GND
Attach the Buzzer
![xnu.JPG](/proxy/?url=https://content.instructables.com/FCU/IZNS/KT1IDKRL/FCUIZNSKT1IDKRL.jpg&filename=xnu.JPG)
Stick it to the box and connect the red wire to P1 and the black to GND
Code
![Screen Shot 2021-09-01 at 8.46.35 AM.png](/proxy/?url=https://content.instructables.com/F41/NAQK/KT1IE9UV/F41NAQKKT1IE9UV.png&filename=Screen Shot 2021-09-01 at 8.46.35 AM.png)
https://makecode.microbit.org/#pub:_a09fKzctM1Rv
Try It Out!
![bu.JPG](/proxy/?url=https://content.instructables.com/FNH/NZCK/KT1IDKR3/FNHNZCKKT1IDKR3.jpg&filename=bu.JPG)