This will help you make an electromagnetic lock system for your door or gate. If you wish to customize it, do not worry, this is only the basics on how to make it.
Step 1: Materials
You will need the following:
-2 9Volt Batteries
-1 toggle switch of your choice
-Copper wire, or similar conductive wire
-1 metal plate/rod (This will become an electromagnet, so shape may not be specific)
-a wooden board, or similar object to mount to (Unless it will be the wall or door itself. In that case, this item is not required)
Step 2: Wiring
In order to begin, you will need to be protected should the wire shock you, or cut you while being worked with. It is recommended to wear gloves (Non conductive), or use tools to avoid making contact with the wires.
After this, you may begin wiring the whole machination of wire and metal.
Cut the wire into segments. Make a short segment, to connect the batteries negative and positive poles. This allows for more electricity to flow through the wires. This may not be dangerous, however, avoid any and all contact with the wire should fortune not be on your side.
Next, cut a longer segment for connecting the negative pole of ONE of the batteries (It MUST be the one with the negative pole currently unused) to the toggle switch. For this, I had used a light switch, as it is a basic, single pole toggle switch. Wire the switch to the battery on the bottom, where when the switch is turned on, it reads "ON".
Step 3: Making the Electromagnet!
This step is not as easy, but it is also mildly boring and tiresome. You must wrap the long wire segment you have around your metal object being used as an electromagnet. If this metal can have a magnet hold onto it, then it is the perfect metal to use. Not all alloys will work. Save a cord of wire for the beginning of the magnet, to connect to the battery's unused positive pole.
Now, wrap the wire continuously around the metal object. More coils made by such will make it a stronger magnet, and thus, hold metal much better. Make sure the copper wires are bare and uncovered while doing this, as it will make the electromagnet actually function. If they are insulated while coiling, electricity will not flow, and the magnet will not work. When you believe you made enough coils, you can lead the remaining wire to the toggle switch of your choice.
Step 4: Tying Up Loose Ends
Connecting the wire to the switch will be easy. Wrap the wire around the other end of the switch, opposite of the other wire connected to it. If done correctly, you can toggle the electromagnet on and off.
There may be loose areas in the wire, so secure them and make sure that the wires DO NOT touch other ends. It is best to use wires that have been wrapped with colored rubber, as it will keep the wire from electrocuting you, but also to keep the LONG copper wires from making contact with each other unintentionally.
(And yes, this step title was a pun.)