# Switching power to a device from a microcontroller

## Situation:

I need to turn off power to a 5V lcd screen hooked to a 3.3V microcontroller when it is off, otherwise the lcd screen pulls power all of the time.

The goal here is for the LCD screen to only be on when a GPIO pin from the microcontroller supplies voltage, so that the LCD screen can only be on when the microcontroller tells it to.

## Problem: (all solutions I've tried)

-Using a low side n-channel mofset transistor (my preferred way of switching) isn't possible as some of the gpio pins of the micro controller are being used as drains to ground.

-Using a high side p-channel mofset transistor is not preferred because it would require a constant voltage to keep the lcd screen off.

-Using a high side n-channel mofset transistor, even though it would do the job perfectly, isn't possible (so far) because it would require 7V minimum voltage to the gate to switch the 5V drain-source current when the most this micro controller can put out is 5V, and DC step ups are too large and expensive to do the job and I dont know how to make a boost circuit myself.

-Simply attatching didoes to the gpios so that they can't drain to ground won't work, as they drop the voltage too low for the lcd screen to detect.

## Question:

Are there any other ways I can switch a 5V power supply with 3.3V GPIOs on the high side in a simple and compact manner? If not, how can I boost the 5V to 7V to make the high side NPN possible without using a hefty circuit or premade device?

• Have you looked at latching relays? Or can you not send an off signal when the micro turns off? – Samuel Dec 10 '15 at 21:18
• You could use a relay or mosfet.But with mosfet you should use a charge pump to open the n channel mosfet. – Stefan Merfu Dec 10 '15 at 21:19
• Why not connect to the enable input of whatever regulator it's using? – Ignacio Vazquez-Abrams Dec 10 '15 at 21:52
• Can you explain the problem with a low-side NPN? – Samuel Dec 10 '15 at 22:05
• Errm.... NPN MOSFET? Wouldn't that be n-Channel MOSFET? – JRE Dec 11 '15 at 17:25

While a PNP/P-Channel high side switch setup is best, with very low if any current draw while disabled (leakage current only), another solution is a physically small relay.

Reed Relays are one type. Regular electromechanical relays can also be commonly found in tiny packages.

As the load is minimal, either will do. 0 draw when disabled, the reed relay from radioshack (Sku: 275-0232) has a 20 mA coil current at 5V when on. This can be reduced by PWM or other tricks, as the coil will hold the contacts down to a voltage of 0.5V. Lower voltage, lower current draw.

• I ended up using reed relays for this setup, specifically this reed relay : mouser.com/ds/2/240/HE3600%20revised-275229.pdf. It works perfectly, and can switch the larger device's power with the smaller gpio, and requires no power when off. – Skyler Dec 16 '15 at 16:04
• 10mA current draw, nice. – Passerby Dec 16 '15 at 16:11

Using a high side p-channel mofset transistor is not preferred because it would require a constant voltage to keep the lcd screen off.

This statement doesn't make sense. A P channel MOSFET and pull-up resistor is a very standard way of switching a power rail. Switching 5V from a 3.3V GPIO pin takes a couple extra components.

simulate this circuit – Schematic created using CircuitLab

A logic high on the GPIO pin will turn your switched rail on. C1 is optional. It is there to limit the inrush current by slowing down the $V_{GS}$ transition. You'll probably want it there if there is significant capacitance on the switched net. That verification is up to you.

• To be fair, this consumes $50\mu A$ when it's turned off! – Daniel Dec 11 '15 at 18:23
• That was somewhat tong-in-cheek.. you should reframe your question to give power requirements. – Daniel Dec 11 '15 at 18:37
• @Daniel how does this consume any current when off? When the GPIO is low, Q1 is off, R1 pulls the gate of Q2 to source, and Q2 turns off. The only current would be leakage trough the (switched off) Q1 and Q2. – jms Dec 11 '15 at 18:40
• @Daniel No it doesn't. P channel MOSFETs do not turn on until $V_{GS}$ goes negative. – Matt Young Dec 11 '15 at 19:07
• @Daniel When "+5 -> 100k -> 1k -> Q1 -> Ground ≈50μA" is true, the P-FET is on, not off. – jms Dec 11 '15 at 19:15