Can't be done that way, and you've probably blown up your MOSFET.
First the 5V logic signal from the Arduino needs to be level-shifted to 12V, then it can be used to switch the gate of the p-channel MOSFET. To switch the MOSFET off the gate voltage must be the same as the source voltage.
It will really really help people to give full part numbers, I think you are refering to the NDP6020P ??
That device has a maximum gate-source voltage of +/-8V, so by connecting the source to 12V and the gate to ground you've exceeded the limit, and likely blown the gate oxide layer.
For high-side switching at 12V use a p-channel MOSFET with +/-20V or +/-30V gate-source voltage rating.
Hi Mark, thanks for the reply. Apologies for not using the complete name of the MOSFET.
You are correct that it is a NDP6020P, I bought them as a 20v item so I'm not sure where the confusion lies with that. But happy that it's me that has made the mistake.
I was reading here and it says that the Drain - Source voltage is 20v. But the Gate - Source voltage is the 8v that you have said. Should I be using a MOSFET with a Gate - Source voltage of over 12V?
Out of interest, i put multi meter across the battery I am using and it has been a long time since I charged it and it was only putting out 7v so I thought the MOSFET could be ok. I stepped up the voltage from the Arduino output to 12v and the switch worked fine.
7V on a gate with absolute maximum rating of 8V is asking for trouble too, absolute maximum is the point where devices start to destruct/degrade, you never go near them in a good design. For 12V use a 30V MOSFET is much wiser choice than 20V for instance (for automotive use 55V is the minimum recommended...).
The NDP6020P is designed for working with 3.3V and 3.0V logic, basically, at 5V the gate voltage headroom is not great. To switch at under 3V the gate oxide has to be ultra-thin, hence the 8V max rating. For 12V high-side the gate will see 12V to switch, so a non-logic-level p-FET is the choice to go for.
That indeed - and you need a second transistor (n-channel MOSFET or NPN) or gate driver to be able to switch it off, as the gate voltage has to be brought all the way up to 12V.
Fourth diagram here can be used with the NDP6020P on a 12volt supply if the zener (D2) is ~5.6volt and R2 is 470 ohm.
D1 is only needed for inductive loads.
Leo..
I'd suggest using a blue or white LED in place of D2, forward biased, which will drop 3V or so, plenty to switch on the NDP6010P and provide visual indication too.