So having done some research I can see that the max output on the digital pins is 40mA, and the recommended is 20mA. I've purchased a 5V fan (https://www.amazon.co.uk/gp/product/B06XQWMFDQ/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1) that runs at 32mA, when I set the pin (12) to high it can't start the fan but a slight tap on the blades and it gets going. Now I know I can run this through the 5v pin but is there any other way around this besides using an external power supply, ie setting a digital pin as ground and using the 5v as a source?
Thats perfect, thanks very much for the help - seems like an NPN transistor is the smallest and easiest workaround, so I’d be alright with using the 5v as the power supply and the digital pin as the switch?
320 mA is too much for most small signal transistors or MOSFETs, get one that is rated at 1A. The startup current of that fan is likely higher than the rated current.