building a magnetic field generator