While preparing to perform an experiment during a lecture at the University of Copenhagen, he found that the magnetized needle of a compass was deflected whenever the electric current through a voltaic pile (an early form of the battery) was started or stopped. This surprising occurrence was solid evidence that electricity and magnetism are related phenomena. The announcement of Ørsted's discovery incited a tremendous outbreak of research in the nascent field of electromagnetics in the early 1820s. Though it is a matter of some debate, another scientist, Italian Gian Domenico Romagnosi, reportedly made the same discovery as Ørsted, but more than a decade and a half earlier. Romagnosi's finding was described in an Italian newspaper in 1802 but was never recognized by most of his contemporaries.
Ørsted was a native of Denmark, where he was born on August 14, 1777, in Rudkørsted bing, a city located on the island of Langeland. Ørsted's father worked as a pharmacist, and after helping out in the family business in his youth, the younger Ørsted would eventually decide to follow in his father’s footsteps. Both he and his brother, Anders Sandørsted Ørsted, were directed in their early studies at home by their father and private tutors. That education enabled the brothers to gain entry into the University of Copenhagen in 1793. While Anders studied law, Hans concentrated his efforts in pharmacy. Hans Ørsted proved an exceptional student, writing prize-winning papers and passing the pharmacy examination with distinction. In 1799 he received a doctorate degree. His outlook on science and life at this time was greatly influenced by Immanuel Kant, and Ørsted's dissertation was an examination of his philosophies.
Following graduation, Ørsted served as a lecturer and pharmacist for a short time before grant and scholarship money enabled him to embark on the first of several foreign journeys that he would take over the course of his life. While visiting Germany, Ørsted became acquainted with Johann Wilhelm Ritter, whose views on electricity and magnetism reportedly aroused the possibility in Ørsted's mind that there was some sort of connection between the two (the notion of a unifying force underlying all of nature was widely held among adherents to the German Romantic movement). At that time, without any experimental evidence, such a connection was pure speculation. Ørsted was notably less influenced by the French scientists he met, whose approach to science was more mathematical.
In 1806 Ørsted gained a professorship at the University of Copenhagen. For a few years prior, he had been lecturing without an academic post to audiences paying a fee to hear him speak. The increasing popularity of his lectures did not go unnoticed by the university, resulting is the official offer of a faculty position. Ørsted became the first faculty member at the university to teach physical science. In addition to his teaching duties, Ørsted carried out research, chiefly in acoustics and electricity.
Ørsted left Copenhagen for about two years in 1812 to travel through Europe again. As did the earlier trip, this journey allowed him to exchange ideas with other notable scientists, helping broaden his views of the world. When Ørsted returned to Denmark he married Inger Birgitte Ballum. The couple remained together for the rest of his life and reared eight children.
1820 was a particularly important year for Ørsted's career. In April he made the discovery of the connection between electrical and magnetic phenomena for which he is chiefly known. He wrote a short treatise on the discovery, but much of the important subsequent work relating to his finding was carried out by others, such as François Arago and André-Marie Ampère, the latter of whom made his greatest contribution to science by rigorously applying mathematics to the study of electromagnetism. 1820 was also the year that Ørsted became the first person to isolate piperine (a component of pepper), thus making his mark in chemistry as well as physics. A few years later, in 1825, Ørsted again experienced a notable success in the field of chemistry when he produced an impure form of metallic aluminum.
As a man of broad interests, Ørsted enjoyed philosophizing and writing, as well as teaching and experimenting. He composed both poetry and prose. Ørsted was compiling his philosophical musings into a book ,The Soul in Nature, when he passed away on March 9, 1851. During his lifetime, he also encouraged the literary efforts of others, most significantly the Danish author Hans Christian Andersen, and was a strong proponent for the popularization of scientific knowledge. He was the founder of an organization expressly dedicated to the latter purpose. This Society for the Dissemination of Natural Science has awarded a prize named in his honor (the Ørsted Medal) since the early 1900s for remarkable Danish contributions to physics, chemistry or the popularization of science in general.
The unit of magnetic field strength in the CGS (centimeter-gram-second) system of physical units was also named in honor of Ørsted in the 1930s. One oersted is equivalent to the field strength one centimeter from a unit magnetic pole under vacuum conditions.