You're in the middle of a project and need to demagnetize your screws or tools and so you're off on the side project of making a solenoid demagnetizer, NOT. Heres a much easier solution
1. A power driver/drill (mine is a cordless with a 1/2" chuck)
2. A small flat magnet from a laptop found in many models the last decade or so that are found on the corners of both the keypad and screen casings to hold it closed when you shut it. I replaced my keyboard on my Lenovo so I had an extra upper casing and so I had two readily available. If you dont have one or do not want to try to remove yours from your good laptop, you can either buy a laptop casing that does or maybe there is something else you have with the same orientation of polarity. (See pics in step 1)
3. (optional) Some small wire coil about the diameter of the magnets width
Step 1: Obtain Proper Magnet and Put Coil Around One End It So It Goes Into Your Drill/driver Chuck Nicely
These magnets from my laptop are quite powerful for their size. As you can see from the pictures this magnet has its north/south polarity along the thickness of the flat rectangular magnet. You dont have to use the exact same magnet, but it does need to be as small and it does need to have its polarity along the width or thickness of the magnet, NOT along the length. I took a coil wire of from my hex key set, you probably have a similar one that has all the hex keys attached by a coil to a ring. I took the one that fit good around one end of my magnet. This is not completely necessary but youll find it more difficult to fit into your chuck properly without it.
Step 2: Carefully and Slowly Tighten Your Drill Chuck Onto Magnet
There is no special technique for this. However you can manage it is the name of the game, but be careful so you dont damage anything since this really isnt the design to fit properly into your drill. Tighten slowly as you manipulate the magnet so it will be sticking out nicely along the length. Try to get as much of the length sticking out as possible while still being held firmly in your drill chuck
Step 3: Demagnetize Away !
The key to demagnetizing is providing a magnetic field that changes polarity rapidly to the magnetized object. Many commonly encountered magnets have the polarity along the length, which could not work in this application because as it spins the direction of the magnetic field does not change. This magnet has its polarity along the thickness so that as it rotates along a lengthwise axis anything held in the space adjacent to it will be subjected to a changing magnetic field polarity every 180 degree spin of the magnet. So you want to hold the screw or the magnetized tool tip right next to the magnet with one hand, put the driver on high speed and pull the trigger of your driver with the other hand. The amount of time you'll have to hold it there depends on close you can hold it to the spinning magnet; too close will pull it from your fingers, but the strength of a magnetic field drops off as a squared function with distance from the magnet, so you have to get it as close as you can. It would also be dependent on how magnetized it is, how strong the demagnetizing magnet is and the rpm of your driver. I found I was able to demagnetize any of my screws or screwdrivers in about 5 -10 seconds. Perhaps even less, I didnt check because it would be dependent on the factors mentioned above anyways which might be variable from bench to bench. Let me know how it worked for you and good luck with whatever you were working on !