# Driving a 5 V logic input from a 3.3 V output

I have a device which requires a 5 V logic input. That input ordinarily needs to be high and the device is activated when the input goes low. I need to drive this from a 3.3 V output (Raspberry Pi GPIO) which is low when the Raspberry Pi is booting.

In summary: when the RasPi's 3.3 V pin is low, the 5 V input needs to be high and vice versa.

What is the best way to achieve this? I'm thinking of using a PNP transistor but I'm struggling to understand how to drive this, as the 3.3 V input isn't enough to stop the transistor passing current.

I've seen a few example circuits that pair the PNP with an NPN but these all require the input to the NPN to be high before the PNP passes current.

Is a Logic Level Converter a more sensible way to achieve this?

• Are you asking about the voltage levels required, or the logic sense of the signals? Is the main problem the fact that the output of the RasPi is low when booting, but you want your "device" to see a logic high during the boot process? If that's the case, then all you need is a simple inverter. Jan 8, 2021 at 22:28
• And does everything run off the same supply, or are multiple supplies involved? Jan 8, 2021 at 22:29
• Use an NPN transistor as an inverter. PNP is not required. As you noted the PNP circuit does not do what you want. Jan 8, 2021 at 22:35
• What is the device with 5V input? What specs does the 5V input have, does it use TTL or CMOS levels? Jan 8, 2021 at 23:10
• Also how much board + wire distance is there between the two devices? Jan 8, 2021 at 23:49

You need an inverter.

If you go shopping, you can find a logic family that will work correctly with a 3.3V input and output 0-5V. 74HCTxx an 74ACTxx families do this, for instance. If you're doing surface-mount, you can get a one-gate inverter that'll do it.

You can also use an NPN transistor and a few resistors. This will be slower, and may not meet the input slew rate specifications for the following stage - but it'll probably work.

simulate this circuit – Schematic created using CircuitLab

• Thank you :) I've tried the NPN circuit and it works as desired for this use case Jan 8, 2021 at 23:15
• you may not need that, 5V TTL compatible inpouts can accept 3.3V CMOS signals without any amplification. Jan 9, 2021 at 12:41
• He says he needs an inverter. If that's true he needs something, and it may as well do the level-shifting at the same time. But yes -- if the inverter were unnecessary then a quick check of the datasheet of the relevant part to see if 3.3V would work is a good idea. Jan 9, 2021 at 19:02

In addition to other suggestions, a one-transistor noninverting circuit can perform this 3.3V-to-5V logic conversion

simulate this circuit – Schematic created using CircuitLab

• OK... but the OP said it needs to invert. So how is this applicable? Jan 10, 2021 at 17:36
• Measuring low when booting, could mean open (input-configured) pin (a voltmeter to ground would measure this as 'low') or could mean pulldown (output-configured) I/O pin, latched LOW. The 'need to invert' may be inessential in the first case. Jan 11, 2021 at 3:23
• V1 should be at (3.3V/2)+0.5V, or about 2V. That's so that the converter has similar input threshold to CMOS logic. With 3.3V, the threshold is about 2.8V - much higher than 1.65V. Aug 30 at 16:48

Reading into your problem somewhat: your circuit is going to be off-board since it's connected from the Raspberry Pi, which implies some (unstated) distance where the signal travels over wire connected to the GPIO header. It's unlikely that you'll be using shielding over this connection so the signal may be vulnerable to some amount of environmental noise.

The Raspberry Pi has published voltage levels for its GPIO pins. These can inform the design of a simple, inverting Schmitt trigger that will offer some amount of immunity against noise at the receiving end. Assuming that the RPI is configured to have a $$\V_{DDIO} = 3.3 \text{V}\$$, the GPIO output will have $$\ V_{OLmax} = 140 \text{mV} \$$, $$\ V_{OHmin} = 3.0 \text{V} \$$. Hysteresis transitions of perhaps 0.5 - 2.5V should be safe, in turn making a circuit like this possible:

simulate this circuit – Schematic created using CircuitLab

This will reject a certain amount of noise (switching, interference, etc.) at the input side, and still achieve your invert-and-shift.