Added singleton pattern to magnetic field sensor