How to control Electromagnetic lock with micro:bit?
Considering the wide use of micro:bit and electromagnetic lock, we made a video that combines the two to apply in life.
What electromagnetic lock is?
Electromagnetic lock is a locking device that consists of an electromagnet and an armature plate. There are two main types of electric locking devices. Locking devices can be either "fail safe" or "fail secure". Electromagnetic locks are fail-safe by design. (Fail-safe means that if the power goes off the door will be unlocked). These types of locks use magnets to open and secure a wide variety of things, ranging from doors to hidden compartments.
How it works?
So how does it work ? As we all know,in a magnet, there is a North and South pole. Between similar poles, the magnets repel, and opposite poles attract.
Magnetic locks use electromagnetism to control the entire locking mechanism. When the magnet is energized, it bonds to the armature and locks the door. To allow access or egress, a switch must be provided to de-energize the magnet. As the electric power activates the magnet, the bolt locks the door. To unlock the door, simply remove power.
But how can i use micro:bit which is a tiny programmable computer to control the Electromagnetic lock?
Things what you need
Step 2
Assemble all the parts
We need a power converter due to that voltage required for an electromagnetic lock is 9v.
- A micro: bit
- An Electromagnetic lock
- A Crowtail-base shield for Micro: bit
- A Crowtail- MOSFET
- A 4 pin Crowtail cable
- An external power cord
- Micro USB Cable
- A bolt driver
- Connect the micro:bit to your computer via a micro USB cable.(You can also refer this link to use a phone to code:https://microbit.org/guide/mobile/)
- Program it:using the MakeCode Editorto write you code
![STVTJ]4R9)V4TR0R]6$D~%I](https://www.elecrow.com/pub/media/magefan_blog/2019/01/STVTJ4R9V4TR0R6DI.jpg)
- Connect the external power supply and the electromagnetic lock to the power converter
- Plug the micro:bit into the crowtail-base shield for micro:bit
- Use a 4 pin Crowtail cable to link the power converter and crowtail-base shield for micro:bit(Note the pin is the one in the code you wrote earlier)
- Plug the power cord into the power supply
- Reset the micro:bit
- Press the AB button of micro:bit according to the code written before.