Generating 12V PWM from 5V PWM
What @IgnacioVacquez-Abrams is talking about in his comment is creating a Push-Pull output.  This is basically what is in the output stage of your Microcontroller.







simulate this circuit &ndash; Schematic created using CircuitLab

When the PWM is HIGH Q1 conducts. The gates of M1 and M2 are then both LOW, so M1 is on and M2 is off. RL and CL are effectively connected to +12V.  When the PWM goes low Q1 stops conducting, the gates of M1 and M2 are pulled up to +12V by R1. M1 turns off, M2 turns on. RL and CL are then effectively connected to ground.

It is important to select MOSFETs M1 &amp; M2 with gate threshold voltages sufficiently high so that both FETs are not ON when the gate voltage is in-between 12V &amp; 0V.  This is one place where you do NOT want to use logic-level MOSFETs.