Controlling an Electromagnet
In this project, you'll learn how to connect and control an electromagnet.
An electromagnet is a type of magnet in which the magnetic field is produced by an electric current. The magnetic field disappears when the current is turned off. The electromagnet is simply a large coil of wire wrapped around a piece of iron.
Parts needed:
| ||
The symbol for the electromagnet is shown on the right. There are two connection points. To turn on an electromagnet, we simply connect the two ends of the electromagnet wires to a power source, one end to 5V and the other end to GND. To control when to turn on or off an electromagnet, we need to connect one end of the wire to a digital I/O pin on the Arduino board just like with a LED. However, the electromagnet requires much more power (current) than a LED and the Arduino's digital output pin cannot supply this much current, so we cannot directly connect the wire to the digital output pin, therefore, a transistor is needed to boost up the power. | ||
You may want to first read about the diode
|
| |
1 | Making the connections
| |
2 | Code.
| |