Electronics & Circuits · Study deck

Logic Level and Level Shifting Contracts

Picture a 3.3 V controller reading a 5 V sensor board.

Voltage Vera is your guide for this deck.

logiclevelshifting
Voltage Vera, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Compare driver output guarantees with receiver input thresholds for a digital interface.
  • Calculate HIGH noise margin from VOH and VIH and explain why margin matters.
  • Decide when 3.3 V to 5 V or 5 V to 3.3 V links need level shifting.
  • Choose between resistor dividers, active translators, open-drain pull-ups, and MOSFET bus shifters.
iotclass.org

Major section

Start Simple

The wire may carry sensible bits on the bench while still stressing the input or missing a reliable high level.

  • The first safe move is to compare what one side guarantees with what the other side accepts.
  • GPIO means general-purpose input/output, a pin used for a direct digital signal.
  • I2C means Inter-Integrated Circuit, a shared two-wire link for nearby parts.
  • A microcontroller means a small computer chip that reads inputs and controls outputs.
iotclass.org

Major section

Phoebe's Field Notes: Why the BSS138 Needs the Body Diode's Head Start

The mathematical gist.: In the standard BSS138 shifter, the gate is tied to the 3.3 V rail and the source faces the 3.3 V bus.

  • Pulling that side low therefore gives 3.30 V of gate-to-source drive.

Numbers to remember

3.3 Vthe gate is tied to the 3.3 V rail
3.30 VPulling that side low therefore gives 3.30 V of gate-to-source drive.
iotclass.org

Major section

Overview: Four Numbers Define a Logic Interface

When two devices use different supply rails, a shared word such as HIGH is not yet an electrical contract.

  • The central: TXS0108E marks the translation boundary, while ↔ AUTO DIR shows that signals may travel either way.

Numbers to remember

5Vthe right is the 5V DOMAIN
Bidirectional level shifter connecting 3.3 V and 5 V logic domains.
Bidirectional level shifter connecting 3.3 V and 5 V logic domains.
iotclass.org

Major section

Check a Five-Volt Reply Before Connection

For this logic-level contract, a 3.3 V controller sends a clock to a 5 V sensor board and expects data back on another wire.

  • For this logic-level contract, a 3.3 V output cannot meet that stated threshold, so a direct controller-to-sensor HIGH has negative margin.

Numbers to remember

3.3 Va 3.3 V output cannot meet that stated threshold
52.6 mVthe low node is 5 × 50/(4700+50)=0.0526 V, or 52.6 mV.
Bidirectional level shifter connecting 3.3 V and 5 V logic domains.
Bidirectional level shifter connecting 3.3 V and 5 V logic domains.
iotclass.org

Major section

Check a Five-Volt Reply Before Connection (continued)

At the return level-shifting boundary, a 5 V output can exceed a non-tolerant 3.3 V input even though the bit value is correct.

  • An open-drain bidirectional bus needs a different check.
  • With a 4.7 kΩ pull-up and an illustrative 50 Ω low-side resistance, the low node is 5 × 50/(4700+50)=0.0526 V, or 52.6 mV.
  • The translator datasheet must state its powered-off behaviour.
iotclass.org

Deck summary

Key takeaways

The wire may carry sensible bits on the bench while still stressing the input or missing a reliable high level.

  • The mathematical gist.: In the standard BSS138 shifter, the gate is tied to the 3.3 V rail and the source faces the 3.3 V bus.
  • When two devices use different supply rails, a shared word such as HIGH is not yet an electrical contract.
  • For this logic-level contract, a 3.3 V controller sends a clock to a 5 V sensor board and expects data back on another wire.
iotclass.org

Retrieval practice

Recall check 1 of 3

Voltage Vera says: answer from memory, then check your reasoning.

Q1A 3.3 V logic output (VOH about 3.3 V) drives a 5 V TTL input whose VIH is 2.0 V. Is the HIGH read reliably?

AYes, it clears the 2.0 V threshold.
BNo: a HIGH must be at least 5 V for a 5 V part.
CNo: 3.3 V logic and 5 V logic can never interoperate in any direction.
DOnly if a pull-up resistor is added to the 3.3 V output.
Show answer

Answer: A

iotclass.org

Retrieval practice

Recall check 2 of 3

Voltage Vera says: answer from memory, then check your reasoning.

Q2You must drive a 5 V CMOS input (VIH about 3.5 V) from a 3.3 V push-pull output. Can a resistor divider do the job?

AYes, a divider will boost 3.3 V up to 5 V.
BNo, a divider only attenuates.
CYes, because 3.3 V already exceeds every 5 V input's threshold.
DNo level shifting is ever needed between 3.3 V and 5 V parts.
Show answer

Answer: B Shifting up requires adding voltage, which a passive divider cannot do.

iotclass.org

Retrieval practice

Recall check 3 of 3

Voltage Vera says: answer from memory, then check your reasoning.

Q3A shared bus such as I2C must be level-shifted between a 5 V and a 3.3 V device while letting both sides drive the line. Why is a plain resistor divider unsuitable, and what is used instead?

AA divider works fine; I2C is a simple one-way signal.
BYou should hard-wire the two devices together and rely on their clamp diodes.
CUse a bidirectional MOSFET shifter.
DUse an inverting op-amp on each line to translate the levels.
Show answer

Answer: C Open-drain bus lines need both sides to pull low, so a one-way divider fails.

iotclass.org

Print reference

Answers

Answer key.

  1. A
  2. B · Shifting up requires adding voltage, which a passive divider cannot do.
  3. C · Open-drain bus lines need both sides to pull low, so a one-way divider fails.
iotclass.org