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
  1. A micro: bit
  2. An Electromagnetic lock
  3. A Crowtail-base shield for Micro: bit
  4. A Crowtail- MOSFET
  5. A 4 pin Crowtail cable
  6. An external power cord
  7. Micro USB Cable
  8. A bolt driver

How to control Electromagnetic lock with micro:bit?

Process: Step 1 At first, you should write the code on the micro:bit before you start to assemble these parts.
  • 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 Step 2 Assemble all the parts We need a power converter due to that voltage required for an electromagnetic lock is 9v.
  • 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
Step3 Run it and you can see the electromagnetic lock opens when you turn on the power.
  • Reset the micro:bit
  • Press the AB button of micro:bit according to the code written before.
  At last, you’ll see the electromagnetic lock opens. Hope you can find more ways to play it!