  The sensitivity of quantum magnetometers is challenged by control errors and,
especially in the solid-state, by their short coherence times. Refocusing
techniques can overcome these limitations and improve the sensitivity to
periodic fields, but they come at the cost of reduced bandwidth and cannot be
applied to sense static (DC) or aperiodic fields. Here we experimentally
demonstrate that continuous driving of the sensor spin by a composite pulse
known as rotary-echo (RE) yields a flexible magnetometry scheme, mitigating
both driving power imperfections and decoherence. A suitable choice of RE
parameters compensates for different scenarios of noise strength and origin.
The method can be applied to nanoscale sensing in variable environments or to
realize noise spectroscopy. In a room-temperature implementation based on a
single electronic spin in diamond, composite-pulse magnetometry provides a
tunable trade-off between sensitivities in the microT/sqrt(Hz) range,
comparable to those obtained with Ramsey spectroscopy, and coherence times
approaching T1.
