One of the challenges I faced with this controller project was being able to support both a 12v and a 24v 'system' voltage (starters, fuel pumps, etc). For simplicity I wanted to use a Active High output for these devices, that is to say when the fuel pump was 'turned on', +12v (or +24v) would be supplied to that connector pin.
A simple way to accomplish this was to use a P-FET, but the problem comes into how to drive it, esp as in the 24v system we could easily exceed any Vgs limit if not careful. In prior version of the controller I accomplished this using a simple NPN transistor and pull-up resisters, then added in stuffing options for a resister divider to handle the 12v or 24v configurations. With through-hole parts, selecting (or even changing) a single resister to match the system voltage was not too bad. But with really small SMT parts. . .
So, I came up with a new approach for driving the P-FETs. Still using a simple NPN transistor + pull up resister (these signals are just on/off, no real concern about Ton or Toff transition times), but this time I created a constant-current source out of the NPN, thereby eliminating the need for any voltage-divider resister:
R39 is driven directly by an Arduino port; when driven HIGH it will turn on the LED D24, as well as Q11. Taking advantage of the relatively stable voltage curve of LEDs I end up with a rather stable voltage at Vb of Q11. (Around 2.0 to 2.4v). With a constant voltage at its base, Q11 + the emitter resister R45 forms a constant current source. Doing the calculations comes up with around a 5mA CC source out of Q11 that is then used to pull down the FET's Gate through R38. D33 starts conducting once we reach 15v max Gate drive, keeping us well under the Vgs limit on FET Q14.
And as a bonus, I get a 'free' indicator LED I can use to tell when a given port is being driven!
This design models out in SPICE as being stable from 5v (about the min turn on for FET Q14), up to 40v. The limiting factor being we are now dumping power in Q11 as opposed to an external resistor - so Q11 becomes the critical limit. Depending on the LED selected, and its voltage curve, you may have to play with the emitter resistor R45, making is smaller or larger until arriving at the desired constant current source value. Once locked in, it will not very much as the LED drifts some. And the zener diode can be adjusted to match the specs for your FET. If you have more headroom on the Vgs, D33 can be increased - resulting in less power needing to be dumped by Q11. I will likely increase D33 from 10v to 15v in the final design, that will reduce Pd in Q11 from 150mW at 40v down to 120mW. Depending on the final FET selected for Q14, might even be able to use a 20v zener!