After looking around the web for a while to find a way to interface my P-channel MOSFET with my microcontroller, I've come up with the attached schematic that's currently present on my breadboard. The npn transistor is supposed to pull the gate of the MOSFET to 0V, thus making it conduct, and the resistor (10k and 1k tested, same result) is supposed to pull the gate up to 18V when the npn is not conducting. The microcontroller pin is basically running a "blink LED" five line program and works as expected. So far the theory, sadly it doesn't work. The LED between the source of the MOSFET and GND is constantly on and the NPN transistor gets really, really hot.
Should the worst-case load on the transistor not be 18V / 10k = 1.8mA (18V -> 10k resistor -> NPN -> GND)? That's way below the specs of the NPN. Same for the voltage.
Here's my really (too?) simple schematics (the 18V source and the 5V source for the microcontroller share a common ground)
– Schematic created using CircuitLab
So to sum up the questions: Why does the MOSFET never turn off? Why is my NPN getting so hot?
I'm sorry if this seems like a redundant question, as there is a lot available on this on the web, but I'm just not good enough to link my problem to any of the solutions and tutorials on the web. It seems like everyone is using this exact circuit to do the job.