In atomic physics experiments, setting the magnetic field strength allows one to create spin dynamics between atoms, or to tune the interaction between them. This makes stable magnetic fields desirable, but unfortunately no commercially available sensor can measure magnetic fields past 20 Gauss with high enough precision to be used in a feedback loop. In this thesis, I present a magnetic field stabilization based on NV centers as a sensor. The setup is kept compact by moving the data treatment to a RedPitaya’s FPGA, and few components are needed to build the setup for performing spectroscopy on the NV center’s Zeeman shift. The measured magnetic field noise in our setup can be regulated down to 1.1mG over the control loop bandwidth of 1 kHz, which is about 2.5 times above the shot noise limit of our sensors. Using a precise frequency source the long term stability reaches 300 ppb on average over 30 minutes.