Electromagnet works on and off I'm working on an small electromagnetic motor and made one of the coils for it to test. The black spool is 3D printed (so maybe my problem is that I don't have the coil wrapped around a ferromagnetic core, but still) and wound with 24 AWG insulated copper magnet wire. I stripped the wire ends and connected a 9V battery to it, and the coil DOES magnetize, but only in short spurts (less than a second at a time). I usually have to take the battery away from the coil for a second and then reconnect the terminals for the coil to magnetize again. 
Any ideas as to why the coil only gets magnetized for a second, and how can I make it so that a consistent and sustained magnetic field is produced?

 A: AWG 24 wire is quite heavy for turning a coil. It implies you expect pretty large currents. If you used 2 m of wire in your coil, you'd have ~0.16 ohms DC resistance.
Meanwhile, a 9 V battery has quite high internal resistance, and quite low total charge capacity. The charge capacity will be degraded if you try to discharge the battery too quickly. 
For example, have a look at a typical 9 V battery datasheet here. When discharging with a 50 ohm load (the lowest specified), the battery life is in the range of 1-2 hours. With your load of 1/300 of 50 ohms, you can expect your battery to be discharged in about 10 or 20 seconds.
What's happened is you're discharging your battery very quickly, reducing the current it supplies. When you disconnect a discharged battery, the chemicals inside can recover a bit, and then provide a bit of additional current when you re-connect the battery. But this effect will get less and less as you further deplete the battery.
I recommend you 


*

*Work out in advance how much current you want to supply your coil.

*Choose a power source that can provide that current for a reasonable amount of time.

*Continue your experiments with your new power source.

