The first connection between electricity and magnetism was found by Ørsted on 21 April 1820. Hans Christian Ørsted (14 August 1777 – 9 March 1851) was a Danish scientist. He became a professor at the University of Copenhagen in 1806. His famous discovery, known as Ørsted’s law, states that an electric current creates a magnetic field.
An illustrated demonstration of the experiment:
Opinions vary on whether the discovery was accidental or not.
“During a lecture demonstration, on April 21, 1820, while setting up his apparatus, Oersted noticed that when he turned on an electric current by connecting the wire to both ends of the battery, a compass needle held nearby deflected away from magnetic north, where it normally pointed. The compass needle moved only slightly, so slightly that the audience didn’t even notice. But it was clear to Oersted that something significant was happening.
Some people have suggested that this was a totally accidental discovery, but accounts differ on whether the demonstration was designed to look for a connection between electricity and magnetism, or was intended to demonstrate something else entirely. Certainly Oersted was well prepared to observe such an effect, with the compass needle and the battery (or “galvanic apparatus,” as he called it) on hand.
Whether completely accidental or at least somewhat expected, Oersted was intrigued by his observation. He didn’t immediately find a mathematical explanation, but he thought it over for the next three months, and then continued to experiment, until he was quite certain that an electric current could produce a magnetic field (which he called an “electric conflict”).
On July 21, 1820, Oersted published his results in a pamphlet, which was circulated privately to physicists and scientific societies. His results were mainly qualitative, but the effect was clear–an electric current generates a magnetic force.
His battery, a voltaic pile using 20 copper rectangles, probably produced an emf of about 15-20 volts. He tried various types of wires, and still found the compass needle deflected. When he reversed the current, he found the needle deflected in the opposite direction. He experimented with various orientations of the needle and wire. He also noticed that the effect couldn’t be shielded by placing wood or glass between the compass and the electric current.
The publication caused an immediate sensation, and raised Oersted’s status as a scientist. Others began investigating the newly found connection between electricity and magnetism. French physicist André Ampère developed a mathematical law to describe the magnetic forces between current carrying wires. Starting about a decade after Oersted’s discovery, Michael Faraday demonstrated essentially the opposite of what Oersted had found–that a changing magnetic field induces an electric current. Following Faraday’s work, James Clerk Maxwell developed Maxwell’s equations, formally unifying electricity and magnetism.”
From the American Physical Society