Mixed Voltage Systems

posted in: Tutorials 0


It is common today to find microcontrollers, interface chips, sensors and other devices in 5V or 3.3V flavors. But what happens when you need to interface a 5V sensor with your 3.3V microcontroller? Devices that operate at different voltages most often do not interface directly to one another. The goal of this article is to provide an understanding of the various options for interfacing signals at different voltages.

Seven methods for interfacing 5V and 3.3V devices will be described. Not all methods can be used in all situations so it is important to read through all seven sections if this is your first experience with interfacing mixed voltage systems. It is not necessarily important which device in a system is 5V or 3.3V. For each interface method described the direction of the signals is more important followed by any considerations of using that interface method in your system.

When interfacing mixed voltage systems it is helpful to understand that direction also determines the need for protection. For example, a 5V output going into a 3.3V input requires conditioning, however a 3.3V output going into a 5V input will not, since the range of input voltages is within the accepted limits of the 5V device. Furthermore the logical high and low signals from the 3.3V output should be read properly by the 5V system due to input thresholds for each logic level. On open-collector 3.3V outputs a pull-up resistor to 3.3V may be required. In the following interface methods it is assumed that the 5V and 3.3V devices share a common ground unless otherwise specified.

Series Resistor Interface

A series resistor is sometimes used to interface 5V/3.3V devices, however it is important to understand that not all devices can be connected in this manner. This type of interface requires the 3.3V device to have protection from over-voltage on the I/O pins. This is done using clamping diodes which are designed to limit the input voltage to ~3.3V. These clamping diodes are pretty robust, however they are not meant to continuously sink large amounts of current. The series resistor limits the current across the clamping diode so that it is not permanently damaged.

Figure 1

Figure 1 shows a series resistor interfacing 5V and 3.3V devices. The value of R1 could vary if you know the current capability of the clamping diodes on your device. To be safe you could use a 10K resistor, however larger resistors limit the bandwidth of the signal across them. With higher bandwidth signals you will need to reduce the size of the resistor. You probably won’t go below 1K on most devices.

Not all 3.3V devices are able to be connected in this manner. If your device does not include clamping diodes you should not use a series resistor to interface to the 5V signal. While the 3.3V device may appear to function, it will eventually fail from electrical stress.

The Propeller chip does include protection, however the clamping diodes are rated at ±500µA. To ensure this current limit is not exceeded when providing 5V to an input pin we must use a minimum resistor value of 2800Ω. To allow for some safety margin and the fact that 2.8K is not a standard resistor value it is recommend to use a 3.3K (minimum) or 4.7K resistor. Both values are available at most electronics distributors.

Remember, it is not necessary to use a resistor on a 3.3V output going into a 5V input. The bidirectional port tags show that the signal can travel in each direction, but the resistor is only required when the signal is bidirectional or an output from the 5V device.

Diode Interface

Using a diode to isolate the 5V signals from the 3.3V device can offer a safer method of interfacing and does not require the 3.3V device to have protection diodes. In this interface the diode prevents 5V signals from entering the 3.3V device but allows the 5V device to assert the signal low, ensuring that the 3.3V device only sees 3.3V or 0V (GND).

Figure 2

Figure 2 shows the diode circuit allowing a 5V device to control a 3.3V device. Note R1 which is used to ensure the 3.3V input is high when the 5V device is not asserting the line low. This resistor is needed because the 5V device cannot assert the signal high.

While the diode allows the 5V device to assert the 3.3V device low, the actual voltage of the low signal will be equal to the voltage drop of the diode. It is for this reason that a Schottky diode is typically used in this circuit, as it has a lower forward voltage (typically 0.2V). It is important to be sure the cathode of the diode is toward the 5V device.

Transistor (BJT) Interface

Transistors have long been used to control a larger voltage (or current) with a smaller voltage (or current), essentially acting as an amplifier or switch. When used to condition a signal, a transistor inherently inverts the signal. Still, a transistor provides yet another way to interface signals of different voltages. Within a microcontroller environment it is easy to compensate for inverted signals in code.

Figure 3

Figure 3 shows how to use a 2N3904 NPN transistor to safely interface to a 3.3V input from a 5V device. As you can see a pull-up resistor (R2) is required on the 3.3V side. A current limiting resistor (R1) is required on the 5V side. When the 5V output goes high, Q1 will bias pulling the 3.3V side to ground. When the 5V output is low, Q1 is not conducting and R2 pulls the 3.3V side to 3.3V.

Figure 4

Figure 4 shows the same interface using a BS170 FET instead of a 2N3904 BJT. In this arrangement R2 is still required to pull up the 3.3V input, however R1 is now connected to ground to ensure Q1 is off when the 5V output is floating. This can happen on power-up if the 5V output pin has not yet been initialized.

Figure 5

While inversion is easily handled in software on a microcontroller, if for some reason you cannot have the signal inverted in your design and want to use the FET design you can also create a 2-stage buffer as shown in Figure 5. In this circuit the signal is double inverted making the output signal follow the input relative to the voltage supply levels.

Optical Isolation Interface

Optical Isolators work just like transistors as far as the output is concerned, but with two important benefits. First, optical isolators can provide complete electrical isolation between two different devices, which can be useful if there is a lot of electrical noise present. The other benefit when using optical isolators is that it is possible to prevent the signal from being inverted depending on how the input to the opto is wired. This is because the input to the opto is essentially an LED. This LED controls the base of the transistor providing isolation while biasing the internal photo-transistor.

Figure 6

Figure 6 shows how a 4N25 opto-coupler could be connected to send a 5V signal safely to a 3.3V input. Note that this circuit still inverts the signal, however this effect can easily be changed by connecting the input as active-low rather than active-high as shown in Figure 7.

Figure 7

By keeping the signals optically isolated, noise and voltage issues are non-existent. In this manner optocouplers have several advantages over previous methods demonstrated for interfacing 5V and 3.3V signals. Optocouplers are also very useful for interfacing 5V or 3.3V microcontrollers to devices that operate at much higher voltages, such as 12V automotive systems or 24V industrial applications.

MOSFET (Pass Transistor) Interface

In open-collector systems such as 1-Wire®, I2C or even non-inverted serial interfaces, a Pass Transistor interface such as the one shown in Figure 8 is an ideal method for bi-directional level translation and can be achieved with an N-Channel MOSFET such as the BS170. If neither device (5V or 3.3V) pulls the data line low, VGS of Q1 is 0V and the 5V device sees 5V, while the 3.3V device remains at 3.3V.

Figure 8

If the 3.3V device pulls the data line low the VGS of Q1 is 3.3V and will turn on Q1, pulling the 5V data line low. If the 5V device pulls the data line low, the body diode of Q1 will be forward biased, pulling the source to 0.6V. VGS will be 2.7V and Q1 will turn on, pulling the 3.3V data line low. In this manner logic levels are translated in both directions.

Ideally the 3.3V device will have zero resistance at ground, however in a real-world application this is likely not the case. If you factor in the resistance of the sinking driver you can calculate that VGS will not necessarily be at 3.3V, but lower depending on the value of R1 and the RDS of Q1.

In this design, slew rate is directly dependent on the values of R1/R2 and the number of devices sharing the bus, which can affect capacitance. Lower resistor values will increase the maximum transmission rate, however power consumption will be increased.

Buffer Interface

Buffer arrays are typically used to buffer current on a signal bus, however they can be used to interface 5V devices to 3.3V devices by using a special family of buffer known as LVC (Low-Voltage CMOS). This particular family is suited to 3.3V devices while providing 5V tolerant inputs. A common 74xxx buffer for interfacing 5V devices to 3.3V devices is the 74LVC244A, which is an octal buffer, enabled in two groups of four ports.

The 74LVC244A provides a non-inverting 3.3V buffered output which can accept both 5V and 3.3V input signals. The outputs are capable of sourcing / sinking up to 50mA and the supply range is typically 1.65V to 3.6V making 1.8V operation possible. The signal is unidirectional.

Figure 9

As you can see from Figure 9, the pins are grouped into two ports with four outputs each. There is a separate output enable pin for each group of pins. When an /OE pin is high, the outputs for that group are high-impedance. When an /OE pin is low, data is passed from an A input to the Y output at a level equal to VCC. Unused inputs are commonly tied to ground to reduce noise and power consumption.

Voltage Translator Interface

Voltage Translators are specialized devices designed to overcome traditional problems associated with bi-directional mixed voltage interfaces. As specialized devices these voltage translators are not typically to be used in a design without verifying the electrical requirements of the circuit against those required by the translator.

Figure 10

The TXB0108PW (Figure 10) is a non-inverting, bi-directional, eight-port voltage translator with individual VCCA and VCCB supply inputs and an active high output enable. Port A can operate from 1.2V to 3.6V and Port B can operate from 1.65V to 5.5V, however Port A voltage supply must always be less than or equal to Port B voltage supply.

Devices such as the TXB0108PW implement protection features such as disabling the outputs when either Port VCC is at ground. This device also contains one-shots to detect rising and falling edges on Ports A & B. This speeds up low-to-high and high-to-low transitions. The TXB0108PW, like other similar devices will have specific requirements for the input/output circuits to ensure proper operation.

For example, the TXB0108PW requires an input drive strength of at least ±2mA. The device is also designed to drive capacitive loads of up to 70pF. Output loads must have an impedance of >50K so as not to contend with the output drivers. This excludes the TXB0108PW from use in I2C or 1-Wire interfaces, or anywhere there is an open-drain driver connected to the bi-directional data line.

This article demonstrated many ways of interfacing 5V and 3.3V technology. While there are other options, many are more complex or require specialized parts.


Discuss this tutorial on Savage///Chats

This article was published in the April 2011 issue of Nuts and Volts Magazine


Leave a Reply