I am trying to control a 5V (240-1000 mA) solenoid from my Arduino using a irf 540 Mosfet.
I wrote a simple code that turns on the output pin HIGH for 10 secs, and LOW for 2 sec. The output pin of the arduino is connected to the Gate, the solenoid to the drain, the source to the ground. An external 5V power source is connected to the solenoid.
The mosfet seems to work well as a switch, since I can measure a voltage over the solenoid of 5V for 2 secs, and 0,7V for 10 secs.
However, this 0.7V keeps the solenoid in an "active" state, so the solenoid is constantly switched on. (I do feel a difference in force of the solenoid however)
How do i get the drain voltage to drop to 0 (instead of 0.7) when the arduino output is turned HIGH?
Datasheet of the mosfet irf 540: http://www.futurlec.com/Transistors/IRF540.shtml (The datasheet says the max gate voltage is 4V, while the arduino output is 5V. Might this be the problem? Tried lowering the gate voltage to 2.5V (with two equal resistors), but this resulted in a constant drain voltage of 5V)