Computing stuff tied to the physical world

What if I mix 3.3V and 5V?

In Hardware on Apr 24, 2013 at 00:01

Welcome to the new weekly What-If series, also available via the Café wiki.

As you probably know, mixing 3.3V logic with 5V logic is usually a bad idea, but why and what if you need to do it anyway?

This topic is too complex for a single post, but let’s just start and see where it leads to:

  • VCC in these examples is the supply voltage, i.e. either 3.3V or 5.0V, depending on which chip we’re looking at. The goal being to connect a mix of these.

  • Digital I/O pins work by treating everything below a certain voltage as “0” and everything above another voltage as “1”. In between, the levels are undefined and could be interpreted either way, depending on temperature, stray capacitances, moon phases, who knows…

  • For the ATmega328, for example, everything between -0.5V and 0.3 x VCC is treated as “0” and everything between 0.6 x VCC and VCC+0.5V as “1”.

  • For 5V signals, that translates to: under 1.5V is “0” and over 3.0V is “1”, respectively.

  • Also relevant, is that unloaded output pins tend to be very close to the 0V and VCC ground and power supply levels, respectively.

So mixing is in fact not a problem at all for the following scenario: 3.3V levels for output signals, tied to 5V levels for the input signals. If all you need, is to read logic levels on say a 5V Arduino Uno from a 3.3V JeeNode, then just tie the signals together and you’re all set.

Connecting a 3.3V level output pin to a 5V level input pin works fine.

The problem occurs in the other direction: a “1” output on a 5V logic level is about 5V, whereas the maximum allowed input level for a “1” on a chip powered by 3.3V is 3.3+0.5, i.e. at most 3.8V.

Hooking these together without taking care of the problem will lead to problems, such as overheating chips and even smoke or fire (although this is almost impossible with simple battery- or USB-powered hookups).

Tomorrow I’ll describe the cause of these problems, along with some simple solutions.

  1. That’s a very good question, and I in fact have a different answer, totally by mistake. My pcb had a small issue (I rotated a component and a track overlapped) which caused the 5v supply to short with the 3.3v supply effectively providing a healthy 5 volts to all my ‘sensitive’ 3.3v ics. Happily oblivious, I powered the circuit up and didn’t even notice a problem. Everything except the wireless transceiver worked flawlessly. The transceiver, a cc1100 could receive packets but not send. The pic32 mcu, Ethernet controller, Rtc and rs485 transceiver all worked great. Even the programmer connected and didn’t have an issue! That was either just very good luck or it shows that tolerances are generally much more than we think…

  2. “So mixing is in fact not a problem at all for the following scenario: 3.3V levels for output signals, tied to 5V levels for the input signals.” Something wrong here. Because if your input have pull-up (to 5V) then your 3.3V schema can get parasitic power via this pull-up. In reasons, that you try to get minimal power consumption, you will get over-voltage in your 3.3V device, because of pull-up.

  3. I would think that going from 5 to 3.3 volts is as simple as providing a few conducting diodes (or LED’s) ? the forward diode drop would lower the voltage arriving at the 3.3.volt pin. would there be any disadvantage I’m overlooking ? capacitance on fast switching signals maybe ?

    • Diodes are not perfect, i.e. they have a certain capacitance, and the “knee” is round, especially at very low currents (note that this is very different from the diode limiting described above, where a predictable amount of current will flow). The other issue could be the “0” level: if the diode leakage is too low, it won’t pull down the voltage quick enough, so you’d also need a pull-down resistor, which makes it somewhat similar to the voltage divider approach.

      Just a hunch, but I also suspect that the single resistor is more predictable w.r.t. tolerances.

  4. in recent issue of Elektor (Mai 2013) there is an description of an bidirectional solution consisting of two FET’s and pullup-resistors. Seems a good idea.

  5. “Connecting a 3.3V level output pin to a 5V level input pin works fine” … with a somewhat reduced noise margin.

    • Good point. The lower the voltage swing, the more signal noise on lengthy lines can mess it up. Adding resistors also increases input / output impedances, so the connection will be more susceptible to noise pickup.

  6. Looking forwards to tomorrow’s post – especially if it covers bidirectional (for pins that may be I or O depending on the application)

    • I’ll have to disappoint you on that – too much material in there already. It’s a great idea, though – I’ll keep it in mind for a future post.

Comments are closed.