Keywords: 1-Wire, how to, tutorial, voltage, level, shift, MAX14591, MAX3394E, DS2431, DS9490R, techniques, methods
Some systems are designed to operate in higher voltages than others. Unless the right measurements are taken, integrating systems with different operating voltages can be problematic. This application note explains how to integrate a 1-Wire® slave device into any system, regardless of its operating voltage, using level shifting.
Digital devices operate on a range of different voltages. Ideally, it is best to always connect two devices of equal operating voltages. Unfortunately, that is not always desirable. There are times when a 5V system needs to implement peripherals that operate at voltage ranges other than at 5V. But, depending on its maximum tolerance, connecting a 5V microcontroller to a 1-Wire device operating at 3.3V can be harmful to the device or the other way around. Because of this, it is important to convert the output voltage of one device to match the input voltage of another. This can be accomplished by using level shifting. This application note discusses the fundamental technique to "shift" between two voltages and how to apply it to a 1-Wire® system using two kinds of level shifters: the discrete level shifter and the IC level shifter.
Level shifting, in its simplest terms, is a technique that allows compatibility between two systems of different operating voltages. Over the recent years, the three most common voltage levels amongst transistor-transistor logic (TTL) devices are 1.8V, 3.3V, and 5V. Being able to "shift" between these levels can be a useful tool for integrating all kinds of systems together.
Whether using discrete components or an IC, most level shifters use the same technique for open-drain I/O ports. Figure 1 shows the design of a basic level shifter converting one bi-directional bus line from 3.3V to 5V and vice versa.
Figure 1. Bi-directional level shifter circuit that connects two different voltage sections of an open-drain bus line.
The level shifter consists of one discrete N-channel enhancement MOSFET for the serial data line I/O and one pullup resistor on each side. The gate (G) must be connected to the lowest supply voltage VL, the source (S) to the bus line of the "lower voltage" side, and the drain (D) to the bus line of the "higher voltage" side. Many MOSFETs have the substrate internally already connected with its source, otherwise it should be connected externally. The diode between the drain (D) and substrate is inside the MOSFET present as an n-p junction of drain and substrate. This technique can be used for more than one line by adding an N-channel MOSFET to each additional line.
To understand how the logic shifter works for any open-drain bus line, there are three main states to consider during a bi-directional transmission.
State 1 – No device pulls down the line to a low level
With nothing pulling down on the bus line, the lower voltage side gets pulled up to 3.3V by its pullup resistor. In this event, the MOSFET's VGS is below the threshold voltage because the gate and the source are both at 3.3V, so the MOSFET does not conduct. This allows the bus line at the higher voltage side to get pulled up to 5V by its pullup resistor. As a result, both sides are high but at different voltage levels.
State 2 – 3.3V system pulls down the open-drain bus to a low level
With the lower voltage side pulling down on the bus line, the MOSFET's source gets pulled down low and leaves the gate high. In this event, the MOSFET's VGS is above the threshold voltage and begins to conduct, also pulling the higher voltage side down. As a result, both sides are pulled low.
State 3 – 5V system pulls down the open-drain bus to a low level
With the higher voltage side pulling down on the bus line, the MOSFET's drain sits low. In this event, the MOSFET's drain-substrate diode begins to conduct, indirectly pulling the source low. When this happens, the MOSFET begins to conduct like in State 2 and, as a result, pulls down both sides of the bus line low.
The great thing about level shifting is that many serial protocols can be used. 1-Wire is a serial protocol capable of transmitting data back and forth by only using one line for communication. However, due to the vast selection of 1-Wire devices, not all systems are compatible. Fortunately, there are two ways to implement a level shifter into any 1-Wire application.
As the name implies, the discrete level shifter is composed purely of discrete components. It offers a fast and cost-effective solution to level shifting because the required components are not hard to gather and are very inexpensive. The discrete level shifter can be built using the same design covered in the Level Shifting section, but with a few alterations to accommodate a typical 1-Wire bus. By placing the lower-voltage device on the N-channel MOSFET's source, a 3.3V system can be integrated with any other system regardless if it operates at a higher or a lower voltage, as shown in Figure 2 and Figure 3.
Figure 2. Bi-directional level shifter circuit that connects a 3.3V 1-Wire system to a 5V host MCU.
Figure 3. Bi-directional level shifter circuit that connects a 3.3V 1-Wire system to a 1.8V host MCU.
Like the discrete level shifter, the IC level shifter uses the same level-shifting technique covered in the Level Shifting section but is instead integrated in the form factor of a small chip. With features such as slew-rate enhancement and high ESD protection, IC level shifters can be very efficient.
Serial communication protocols, like 1-Wire, can carry some capacitive load on the bus line, but there is a limit to how much capacitive load these lines can carry before data starts getting distorted. Any increase in bus capacitance, such as a longer bus line, increases the rise time, which can cause the 1-Wire read sample time (tMSR) to collect the wrong data. Thanks to the MAX14591 internal slew-rate enhancement circuitry, we can accelerate logic-state transitions to maintain a fast data rate with a higher bus load capacitance.
Static high voltage is produced usually by the interaction between people and their surroundings. Although the MAX14591 VCC I/O pins are protected by only a ±2kV human-body model (HBM), other level-shifting ICs, such as the MAX3394E, can provide an even greater protection against ESD of up to 15kV HBM. This can be very important in applications with an exposed external 1 Wire bus that could receive a large ESD event at the connection points.
Like the discrete level shifter, the IC level shifter can also be used with 1-Wire slave devices using a different operating range than the master. Simply connect the lower voltage system to the "VL" section, as shown in Figure 4 and Figure 5.
Figure 4. Bi-directional level shifter circuit that connects a 3.3V 1-Wire system to a 5V host MCU.
Figure 5. Bi-directional level shifter circuit that connects a 3.3V 1-Wire system to a 1.8V host MCU.
As seen in Figure 2 through Figure 5, wiring a 1-Wire device is slightly different from other serial communication systems like the one in Figure 1. Regardless of the level shifter used, there are some things worth considering when integrating a 1-Wire device and the following three steps help assure proper communication:
A simple test can be conducted by constructing a discrete level shifter like the one shown in Figure 2, consisting of a single bus line. Probing both sides of the MOSFET helps verify the voltage levels on each side that are pulled up to their corresponding voltage when the bus is high and at 0V when low, as shown in Figure 6. The test results did not include the optional strong pullup circuitry found in Figure 2 through Figure 5.
*Not all 1-Wire devices use the same RPUP. Check the device's data sheet for the recommended RPUP.
Figure 6. Oscilloscope plot of 1-Wire reset command at two different sections of a level shifter.
Level shifting at its core is composed of a few simple techniques, all of which can be applied to many types of serial communication protocols. By looking at the two most common solutions to level shifting, a 1-Wire device can be easily implemented into a range of systems operating at different voltages. The discrete level shifter allows for a quick and low-cost solution, whereas the IC level shifter is used in a more performance-based system. IC level shifters, like the MAX14591, can improve level-shifting efficiency with added features such as ESD protection, fast push-pull support, and more. Regardless of the method used, following the wiring procedures in this application note can help integrate most 1-Wire systems in a multi-voltage system.