-1

I was wondering if I can convert 3.3v to 5v when the 3.3v part isn't 5v tolerant.

I was thinking of using this layout: diagram with npn transistor

However I'm not sure if the gpio pin will get 5v "for a second" or if this is safe? Additionally, I'm not sure how to work out if 1MHz or 10MHz is possible here.

Would it be better to use a pnp transistor instead (SS8050?) so that the gpio could trigger the base directly?

If this is the wrong way to do this, is there a cheap unidirectional 3.3v to 5v converter IC which ideally has a schematic in Eagle?

EDIT: To clarify. I'm hoping to use the 5v to communicate with a shift register (which needs around 3.7v input minimum). Not to power the shift register.

JRE
  • 67,678
  • 8
  • 104
  • 179
  • To avoid any wrong assumptions, what is the 5V part that you want to drive from the 3.3V GPIO? If this is a one-off, where you have some flexibility, could you use a 74HCTxx part which has a lower input voltage threshold (low 0.8V, high 2.0V) threshold that a 3.3V GPIO could drive directly? – gbulmer Sep 18 '16 at 22:52
  • Also when it says '5V out to supply a shift register', do you mean '5V out to drive an input pin of a shift register' or do you want to supply 5V power source for a shift register, and control that power with a 3.3V GPIO? I read your question as you wanted to *drive an input pin of a shift register*, controlling a 5V device input pin from a 3.3V device. However rtstorm seems to read the question differently, so it may be unclear. – gbulmer Sep 18 '16 at 23:01
  • Gblumer. Your correct. I'm hoping to send data to a shift register. Not power it. At the moment I'm wanting to use the 74hc595. When this is run at 5v it seems to need around 3.7v for an input. I'd rather not run the shift register at a lower voltage as I'm wanting to use the shift register to control servos which require 5v input. The datasheet for the servos doesn't have a minimum input so I'd rather control the servos with the full 5v if possible. – Shanee Vanstone Sep 18 '16 at 23:12
  • 1
    A 74**HCT**595 would also run at 5V. However, its *input* pins will register a LOW at 0.8V, and a HIGH at 2.0V. Assuming your 3.3V device is CMOS, it will drive its GPIO outputs close to the power rails, 0V and 3.3V, so it has reasonable headroom. – gbulmer Sep 18 '16 at 23:28
  • Thank you for the reply. The HCT is definitely a nice! I'll probably end up using that, although it seems to be around double the price. It doesn't matter that much now, but I'm quite interested in price cutting for larger volume (if that ever happens) as I'm planning to use at least 3 shift registers. Thanks again. – Shanee Vanstone Sep 18 '16 at 23:55
  • I've created an answer, and added an extra suggestion which might save money, PCB board space, and be a better solution for level shifting for multiple shift registers. – gbulmer Sep 19 '16 at 01:07
  • What is your 3.3V-only part? – ThreePhaseEel Nov 18 '16 at 03:53
  • Why don't you connect the gate to your 3.3V GPIO, and the source to ground, instead? Then you have an inverter with a 3.3V input and 5V output. – user253751 Dec 18 '16 at 09:43

5 Answers5

1

A 74HC595 has the characteristics of 74HC logic families, and so has an input LOW maximum of 1.0V, and an input HIGH minimum of 3.5V.

So the circuit does need a signal level shifter to drive the 74HC595 inputs from a 3.3V GPIO.

However 74HCT will register a LOW at 0.8V, and a HIGH at 2.0V.

See table "Characteristics of Selected 7400 Series Families" at Wikipedia 7400 series for the signal thresholds.

A 74HCT595 would also run at 5V. Assuming your 3.3V device is CMOS, it will drive its GPIO outputs close to the power rails, about 0.6V LOW and 2.7V HIGH for modest current, so it has some headroom.

If you need to drive several inputs of the 74xx595 shift register, then the 74HCT595 would save a set of signal level shifting components.

If the extra cost of the 74HCT595 is an issue, you could use the fact that 74HCTxx logic inputs would work with your 3.3V while the outputs would drive a 74HC595. Effectively use 74HCTxx logic as a level shifter.

So, for example, a 74HCT04 hex inverter could be used to level shift 6 signals, which might be enough to interface to several 74HC595 shift registers. Hence, 6 sets of signal level shifting components could be replaced with a 74HCT04 plus a decoupling capacitor.

gbulmer
  • 10,040
  • 20
  • 29
0

is there a cheap unidirectional 3.3v to 5v converter IC which ideally has a schematic in Eagle?

Here is the link to TI's product comparison page for unidirectional level shifters. Most of them are cheap less than 0.7 USD per shifter and have switching frequency up to 50 MHz. Some of them are available as free samples too (Though terms and conditions are applied)

http://www.ti.com/lsds/ti/logic/unidirectional-voltage-translation-products.page

TI provides CAD models for most of their products along with data sheet.

Hope, you find it useful.

Yogesh
  • 78
  • 1
  • 5
-1

However I'm not sure if the gpio pin will get 5v "for a second" or if this is safe?

Where your schematic sayas "3.3 V supply" you should actually connect a 3.3 V logic signal. And where the schematic says "GPIO 3v supply" you should just connect to ground.

With that in mind...

If the 5 V supply is turned on very (very) quickly, the gate-drain capacitance of the FET could deliver a small amount of power back to the 3.3 V circuit. But it is very very unlikely there would be enough energy involved to damage the 3.3 V circuit.

Once the power supplies are turned on, normal operation of this circuit does not ever connect the 3.3 V circuit to 5.5 V.

This is in fact a very common way to translate low voltage logic levels to higher voltage levels. Depending on the load and the switching speed needed, you could even possibly increase R29 to 5, 10, or even 50 kohms and reduce the power consumed when the output is in the low state.

Additionally, I'm not sure how to work out if 1mhz or 10mhz is possible here.

For 1 MHz, with 1 kohm pull up and a single IC loading the output there will be no problem.

For 10 MHz, you should determine the load capacitance (due to the MOSFET, the load IC, and the traces between them) and verify that the rise time when the MOSFET releases the line will be fast enough.

Would it be better to use a pnp transistor instead (SS8050?) so that the gpio could trigger the base directly?

This would most likely not work. Whether you mean to use the PNP in common emitter (emitter tied to 5 V) or common collector (collector tied to ground, emitter pulled up to 5 V) configuration, then this circuit will expose the 3.3 V circuit to over-voltage (~4.5 V).

At the moment I'm wanting to use the 74hc595. When this is run at 5v it seems to need around 3.7v for an input.

You should look at the datasheet for 74HCT595. With \$V_{ih}\$ minimum of 2 V, you could avoid the level translation problem altogether.

The Photon
  • 126,425
  • 3
  • 159
  • 304
  • Thank you for the long, well considered reply. I'm quite tempted by the HCT and will probably end up using that! However it does seem to be about double the price and I'm looking to use 3 shift registers in this PCB, so I'm quite interested in price cutting for scale (if that ever happens). Am I right in thinking that with your modifications the 5v output is inverted? I was thinking I was making something similar to this question? https://electronics.stackexchange.com/questions/82104/single-transistor-level-up-shifter?rq=1 But inverting in software may be the way to go. – Shanee Vanstone Sep 19 '16 at 00:02
  • @ShaneeVanstone, On Octopart I see NXP's 74HC595,112 for $0.28 at qty 1000, or 74HCT595,112 for $0.38 at the same quantity. Remembering that you'll pay a few cents extra for placement of each added part at your assembly shop, I wouldn't worry too much about this price difference. And yes, the common source translator circuit does invert the signal. You could also use something like a 74LVC1G07 which won't cost you much more than a single FET but won't invert the signal and will have specs that make it easier to prove your circuit will operate at speed. – The Photon Sep 19 '16 at 01:29
-1

Close, but no cigar. Try your luck again.

You have the general idea correct, just need to swap some pins. The 3.3V GPIO should be connected to R27. The transistor Emitter (or mosfet drain) should be connected to the common ground.

This is a typical n - channel level translator that's in use everywhere. The only thing about it is that logic is inverted. That's simple to fix in code. When your GPIO is logic high, the transistor pulls the collector and thus the 5V input IC pin to ground.

Passerby
  • 72,580
  • 7
  • 90
  • 202
-3

I think you need to use buck converter. Basicly you need a IC that will control opening and closing Gate on transistor. That IC should have referance point in desired voltage (5V). Also on output it is good thing that you insert coil that will absorbe shock caused by transistor.

rtstorm
  • 101
  • 1
    I'm unclear. Why would you use a 'buck converter'? Why does it need an IC to control the gate on the transistor, the GPIO should be able to control the gate directly. Where does the 'shock' come from that a 'coil' is needed to "absorbe"? Are you reading the question as needing a DC-DC converter? – gbulmer Sep 18 '16 at 22:55
  • Yes i see now, he need a step up conveter. To convert 3.3V to 5V (sorry my english is not good) – rtstorm Sep 18 '16 at 23:04
  • 2
    AFAICT, the question seems to be about translating a signal, not a power source. OP appears to already have a 5 V source available. – The Photon Sep 18 '16 at 23:14
  • @rtstorm - no problem. We all make mistakes. Welcome to ee.se! I hope you enjoy contributing, which may be a great way to help your English. – gbulmer Sep 19 '16 at 01:13