Oersted returned in 1814 and resumed an active part in university and political discussions. In one debate he supported the freedom of judgment as opposed to dogma, in another he held that the practice of science was in fact an act of religious worship. He continued as a popular lecturer. He devised a detonating fuse in which a short wire was caused to glow by an electric current.

In 1819 under royal command he undertook a very successful geological expedition to Bornholm, one of the Danish islands, being one of three scientists in the expedition. It was with the assistance of one of the members of this expedition, Lauritz Esmarch, that Oersted succeeded in producing light by creating an electric discharge in mercury vapor through which an electric current was made to flow. Together they also developed a new form of voltaic cell in which the wooden trough was replaced by one of copper, thereby producing stronger currents. Esmarch was among those who witnessed Oersted's first demonstration of his discovery.

The association between electric (both electrostatic and voltaic) forces and magnetic forces had been recognized by investigators for many decades. Electrical literature contained numerous references to lightning that had magnetized iron and had altered the polarity of compass needles. In the late 1700's Beccaria and van Marum, among others, had magnetized iron by sending an electrostatic charge through it. Beccaria had almost stumbled on a lead to the relationship between electricity and magnetism when a discharge from a Leyden jar was sent transversally through a piece of watch spring steel making its ends magnetic. The resulting magnetic effect proved stronger than when the discharge was made lengthwise. The experiments of Romagnosi and others have already been noted but no one had determined the cause and effect relationship between these two primary forces. Oersted's own earlier experiments were unimpressive, possibly because he had, like other experimenters, laid the conducting wire across the compass needle instead of parallel with it.