Danish physicist Hans Christian Oersted (1777–1851) was the first to observe a connection between electricity and magnetism. He found that a current in a wire caused a nearby compass needle to rotate thereby establishing that an electric current always produces a magnetic field around itself. When an electric current flows through a wire wrapped around a piece of iron, it creates a magnetic field in the iron. Electromagnets are used in a wide variety of applications, including doorbells, switches, and valves in heating and cooling equipment to telephones, large machinery used to lift heavy loads of scrap metal, and particle accelerators.