In 2015, the U.S. Naval Academy decided that its graduates needed to return to the past and learn how to navigate using the stars. Nine years prior, it had dropped celestial navigation from its requirements because GPS was so accurate and simple to use.

But recent events had shaken the academy’s faith in GPS. Researchers had taken over a yacht’s navigation system as it steered in the Mediterranean. A truck driver in New Jersey had been fined $32,000 for driving an illegal signal jammer too close to Newark’s airport and interfering with its system. (All the driver wanted was to keep his boss from tracking him.) So the academy figured that its naval officers needed a backup plan, with trusty Polaris as their guiding star. The skies could never be hacked.

Except by clouds. “What do you do if you can’t see stars?” says engineer Michael DiMario of Lockheed Martin.

He and his team may have a solution: quantum sensors.

Lockheed Martin’s quantum magnetometer contains a tiny diamond cube as a sensor. Lockheed Martin

For nearly five years, DiMario’s team has been building a prototype: a cylinder, about a foot long and six inches in diameter, containing a synthetic diamond cube barely larger than a salt crystal. The diamond contains special impurities; in its repeating cubic lattice of carbon atoms, every now and then a carbon goes missing and its neighbor is a nitrogen atom. These so-called nitrogen vacancy centers, or NV centers, sort of bind together to form a molecule-like duo inside the diamond, and they turn out to be excellent magnetic sensors.

When a green laser illuminates the diamond, the NV center responds by emitting red light. Due to quantum mechanics’ effects, the diamond emits more or less light depending on the magnetic field that it is in. Researchers have used such diamonds to measure the magnetic field from a neuron firing in a squid, for example.

Quantum magnetometers sense earth's magnetic field, mapped here by NOAA, to navigate. National Oceanic and Atmospheric Administration

For navigation, DiMario uses the diamond to detect distinctive ripples and bumps in Earth’s magnetic field known as magnetic anomalies, which the National Oceanic and Atmospheric Association has previously mapped. Once he identifies an anomaly, he can use it as a reference point to navigate. Currently, ships and planes do not use magnetic anomalies for navigation because most magnetic sensors can only measure the field strength and not the direction the field is pointing, says DiMario. But his team’s device can measure both. Because it doesn’t need to communicate with a satellite to function, this quantum sensor is less vulnerable to hacking.