Here is where it is getting problematic. I wired these up very simply. literally a wire from pin 9 to gate, source and drain with a big old magnet in middle and a flyback diode to handle things when the magnet turns off.
Also, don't forget to connect the ground of the +12V supply to the ground of the Arduino.
Also as drawn that diode is the wrong way round, the cathode should be to the positive side of the supply. In other words it is normally reversed biased.
Or does it matter?