A magnetometer measures the strength and direction of a magnetic field at a specific point. Magnetometers…