Thanks to Google, hundreds of millions of people are today celebrating Hans Christian Ørsted's birthday without having much of a clue who he is … so who exactly was he?

Probably not even the physics geeks remember much about Hans Christian Ørsted, although Google's Doodle logo illustrates his key discovery. That is, if you run a current through a wire – in this case, from the battery at the front – then the electricity creates a magnetic field, which will deflect a compass needle.

Thus the study of electromagnetism was born, and it's the basis of a lot of modern life: it led to the development of electricity generators and transformers. Remember that next time you flick a light switch.

As with many great discoveries, it happened by accident. In 1820, Ørsted, a professor of natural philosophy at the University of Copenhagen, was preparing an evening lecture when he noticed that a compass needle moved away from magnetic north and pointed to the wire whenever current flowed from the battery.

Perhaps even more surprisingly, the compass needle pointed in the opposite direction when you flipped the battery round.

With an invisible current creating an invisible field that moved a physical needle, this caused quite a stir at the time. In London, the Royal Society gave him a medal, and he was also made a knight of the Prussian Order of Merit, of the French Legion of Honor, and the Danish Order of the Dannebrog. On his death in Copenhagen in 1851, he was given a state funeral.

Today, thanks to the wonder of the internet, you can re-enact the experiment online in the Magnet Lab at Florida State University.

To honour Ørsted, the scientific community named the unit of magnetic induction after him, in what we now call the CGS (centimetre-gram-second) system. Sadly for him, people no longer measure things in oersteds, because nowadays we use an international metric system (SI) that honours people such as Ampere, Ohm, Hertz, James Prescott Joule, James Watt and Michael Faraday instead.

We're more likely to remember another great Dane whose life overlapped with Ørsted's, and whose literary efforts Ørsted is reported to have encouraged: Hans Christian Andersen. And while there's nothing wrong with fairy stories, they haven't contributed much to the development of electric motors.