I am building a battery-powered uC circuit with an RGB LED. The LED is common cathode, so the circuit for switching the LED elements has to be high-side. The LED is a higher-current LED, so it cannot be driven by the uC directly.
To save power, I was planning to have the uC (AVR ATmega328) run at whatever voltage the 2 AAA batteries will provide (1.8-3.0V), while the LEDs need to be driven at 4.0V to account for the LED vdrop – the plan was to use a boost converter to power the LEDs. I was wondering what is the best way to drive the LED output from the uC. I can think of a few ways:
PNP BJT switch with three diodes
AVR docs state that the chip cannot "see" more then 0.5V above Vcc on any of the pins, so one option would be to use a diode \$V_{forward}\$ to present a lower voltage to the uC:
Perhaps D1 can be omitted? I am not sure if there is a E->B voltage drop in a PNP transistor.
P-Channel MOSFET with an NPN BJT
Another option is to control the P-Channel MOSFET with an NPN BJT
simulate this circuit – Schematic created using CircuitLab
N-Channel high-side MOSFET switch
This requires a charge-pump or something equivalent, so I am leaning against this solution.
Currently I am leaning towards the second solution, for no particular reason. Are there other solutions I should be considering? Are there other considerations that I should be thinking about?
Best Answer
Yeah, I think Option 2 is your simplest high-side option. Replace Q1 with a BSS138, and you can have a simple all MOSFET solution with discrete parts.
Alternately, if you're OK buying ICs, you can use an IC like the TPS2557 (which is an N-channel load switch with built-in charge pump), or an integrated dual N/P part like the Si3865DDV which basically squeezes the option 2 circuit into a convenient package. These would also take up less space than the discrete solution, and offer some protection features such as current-limiting if you would like. I can also understand the appeal of building something with parts you have lying around.
A N-channel device will have a lower on-resistance than a comparable P-channel device, but it does require a charge pump as you stated.
Finally, even with a MOSFET solution, I would personally keep R2 there and make it 1k or so, in addition to adding a pull-down to your UC enable pin so that when you are in reset, the LEDs stay off. By keeping R2, if you drop a screwdriver or something across the gate of the MOSFET to GND, it limits the current that can flow from the uC pin.
Here's the discrete solution:
simulate this circuit – Schematic created using CircuitLab