What is an electromagnet?
An electromagnet is a magnet that runs on electricity. Unlike a permanent magnet, the strength of an electromagnet can easily be changed by changing the amount of electric current that flows through it. The poles of an electromagnet can even be reversed by reversing the flow of electricity.
An electromagnet works because an electric current produces a magnetic field. The magnetic field produced by an electric current forms circles around the electric current, as shown in the diagram below:
If a wire carrying an electric current is formed into a series of loops, the magnetic field can be concentrated within the loops. The magnetic field can be strengthened even more by wrapping the wire around a core. The atoms of certain materials, such as iron, nickel and cobalt, each behave like tiny magnets. Normally, the atoms in something like a lump of iron point in random directions and the individual magnetic fields tend to cancel each other out. However, the magnetic field produced by the wire wrapped around the core can force some of the atoms within the core to point in one direction. All of their little magnetic fields add together, creating a stronger magnetic field.
As the current flowing around the core increases, the number of aligned atoms increases and the stronger the magnetic field becomes. At least, up to a point. Sooner or later, all of the atoms that can be aligned will be aligned. At this point, the magnet is said to be saturated and increasing the electric current flowing around the core no longer affects the magnetization of the core itself.