ProjekinAja. Embedded Systems Stage 2 · Circuits Lesson 2.1
● Stage 2 · Lesson 2.1

Logic Levels, Pull-ups, and Open-Drain

3.3 V and 5 V parts have talked to each other for decades — mostly by luck, occasionally by design.

⏱ ~24 min read 🔌 Digital interfacing 🧮 One worked calculation

🎯 By the end you'll understand

What a pin actually promises when it says "high" or "low" (VIH, VIL, VOH, VOL) and how to compute the noise margin between two parts. Why a 3.3 V output driving a 5 V TTL-threshold input usually works and the reverse usually damages something. What open-drain is, why I2C uses it, and how to size an I2C pull-up from bus capacitance and the rise-time limits in the I2C specification. And the two ways a pull-up quietly drains a battery — neither of which is the one most people worry about.

KEY INSIGHTA digital pin is an analog circuit that has agreed to be interpreted

There is no such thing as a "1" on a wire. There is a voltage, a threshold the receiver applies to it, and a margin between the two that noise is allowed to eat. Every interfacing bug is a margin that went to zero.

Here is the bench scenario. A learner wires an SHT40 to an ESP32-C3 dev kit, adds no pull-ups because "the internal ones should do", and the sensor answers correctly at 100 kHz. They switch the bus to 400 kHz to speed up the wake window and the sensor stops acknowledging — sometimes. Then they add 1 kΩ pull-ups because "stronger is safer", the bus works, and three weeks later the battery is flat after a firmware crash left SDA held low. Nothing in this story is a software bug. It is one physical quantity, the time it takes a capacitance to charge through a resistor, colliding with two limits: the spec's rise time on one side, and the current budget on the other.

🔑 Hold onto this

Digital interfacing is two questions per wire. One: will the receiver's threshold be crossed with margin, in both directions, under worst-case parts? Two: what does the wire cost in current and time to get there? Logic levels answer the first. Pull-up sizing answers the second. The I2C spec (NXP UM10204) gives you hard numbers for both, and this lesson shows you how to use them rather than copying "4.7 kΩ" from a forum and hoping.

CORE CONCEPTFour voltages and one margin

A datasheet describes a digital pin with four guaranteed voltages. Two are promises the output makes; two are demands the input makes. Get the direction of each right and the rest is arithmetic.

SymbolWhoMeaningDirection of the promise
VOH (min)OutputThe lowest voltage an output will produce when it says "high", at its rated current"I will give you at least this much"
VOL (max)OutputThe highest voltage an output will produce when it says "low", at its rated sink current"I will pull you at least this far down"
VIH (min)InputThe lowest voltage an input is guaranteed to read as "high""Give me at least this much or I make no promise"
VIL (max)InputThe highest voltage an input is guaranteed to read as "low""Get me at least this low or I make no promise"

Between VIL(max) and VIH(min) is the undefined region. The datasheet says nothing about it, and a real input in that region may read either level, flip with temperature, or oscillate. The noise margin is the distance between what the driver guarantees and what the receiver demands:

📖 Noise margin

NMH = VOH(min, driver) − VIH(min, receiver) and NML = VIL(max, receiver) − VOL(max, driver). Both must be positive for the link to be guaranteed. Everything that couples onto the wire — ground bounce, crosstalk, the drop across a long ground return — spends this margin. A link with 50 mV of margin will work on the bench and fail in the enclosure next to a motor.

5.0 V 3.3 V 0 V DRIVER · ESP32-C3 @ 3.3 V guaranteed HIGH VOH ≥ 2.64 V VOL ≤ 0.33 V guaranteed LOW RECEIVER · 5 V TTL-threshold input reads HIGH VIH ≥ 2.0 V undefined VIL ≤ 0.8 V reads LOW NMH = 0.64 V NML = 0.47 V A 3.3 V CMOS driver into a TTL-threshold 5 V input: both margins positive, so the link is guaranteed by the datasheets, not by luck.
The four voltages drawn to scale. The driver's bands (left) must land inside the receiver's bands (right) with room to spare. Swap the receiver for a 5 V CMOS-threshold input (VIH = 3.5 V) and NMH becomes −0.86 V: the link is not guaranteed at all, even though it "works" on the bench most days.

The numbers on the diagram come from real families. Learn these three sets; almost every part you meet belongs to one of them.

FamilyVIL maxVIH minVOL maxVOH minNotes
ESP32-C3 GPIO at VDD = 3.3 V0.25·VDD = 0.83 V0.75·VDD = 2.48 V0.1·VDD = 0.33 V0.8·VDD = 2.64 VRatio-metric CMOS thresholds; VOL/VOH specified at the pad's rated current. Not 5 V tolerant.
Classic 5 V TTL (74LS, 74HCT, many 5 V MCUs)0.8 V2.0 V0.4 V2.4 VThresholds are absolute, not a fraction of VDD. This is why 3.3 V outputs can drive them.
5 V CMOS (74HC, CD4000 at 5 V)0.3·VDD = 1.5 V0.7·VDD = 3.5 V≈ 0.1 V≈ VDD − 0.1 VRatio-metric. A 3.3 V driver cannot guarantee a high here.
💡 "HCT" is the letter that matters

74HC parts have CMOS thresholds (VIH = 3.5 V at 5 V). 74HCT parts are the same silicon with TTL-compatible input thresholds (VIH = 2.0 V). If you need a 5 V logic part to listen to a 3.3 V microcontroller, HCT is the one-letter fix. The reverse trick — a 5 V part talking down to 3.3 V — has no one-letter fix, because the problem there is not the threshold but the absolute maximum rating of the receiving pin.

HOW IT WORKSMixing 3.3 V and 5 V: the asymmetry

The two directions are not mirror images, and the difference is the single most useful fact in this lesson.

3.3 V output → 5 V input. This is a threshold question. A 3.3 V CMOS output delivers at least ~2.6 V for a high. A TTL-threshold input needs 2.0 V, so the link has ~0.6 V of margin and is fine. A CMOS-threshold 5 V input needs 3.5 V, so the link is not guaranteed; it may work at room temperature with a fresh part and fail at 60 °C with a weak one. Nothing is damaged either way, because 3.3 V never exceeds the 5 V part's maximum input voltage.

5 V output → 3.3 V input. This is an absolute-maximum question. Almost every CMOS input has protection diodes from the pad to VDD and to ground. The datasheet's absolute-maximum input voltage is typically VDD + 0.3 V, which is where the upper diode starts to conduct. Push 5 V into a 3.3 V pin and the diode forward-biases; current flows from the 5 V driver, through the diode, into the 3.3 V rail. Three things can then happen, in increasing order of badness: the diode survives because the driver is weak and the current is small; the diode is stressed beyond its rating and the pin degrades or dies over weeks; or enough current flows into the 3.3 V rail to lift it above 3.3 V and stress everything on it, because the regulator can only source current, not sink it.

⚠ ESP32-C3 pins are not 5 V tolerant

Espressif's datasheet gives the GPIO input range relative to VDD, not as a fixed 5 V-tolerant rating. A 5 V sensor output, a 5 V Arduino, or a 5 V logic analyzer pod driving a C3 pin directly is a slow-motion failure. "It worked yesterday" is the expected symptom.

So the rules of thumb, with their reasons attached:

SituationWhat is enoughWhy
3.3 V push-pull output → 5 V TTL-threshold inputA wireVOH 2.64 V > VIH 2.0 V, nothing exceeds a rating.
3.3 V output → 5 V CMOS-threshold inputA level shifter, or swap the receiver for an HCT partVIH 3.5 V is above what 3.3 V can deliver.
5 V output → 3.3 V input, slow signal (UART, button, enable)A resistive divider, e.g. 1.8 kΩ over 3.3 kΩ gives 5 × 3.3/(1.8 + 3.3) = 3.24 VCheap, always safe. The divider plus pin capacitance forms an RC that limits speed — fine for 115 200 baud, not for 12 Mb/s.
5 V output → 3.3 V input, fast signal (SPI at 10 MHz+)A dedicated translator (74LVC1T45, TXB/TXS family)The divider's RC would round the edges past the receiver's timing.
Bidirectional open-drain bus between 3.3 V and 5 V devices (I2C)One N-MOSFET per line (BSS138) with a pull-up on each side — NXP's application note AN10441 circuitThe FET passes lows in both directions and blocks the 5 V side from the 3.3 V side. Works because open-drain lines are only ever pulled high.
5 V output → 3.3 V input "with a series resistor to limit the diode current"Works, but do not ship itYou are relying on a protection structure the datasheet does not characterise for continuous current. Prototyping only.

DEFINITIONPush-pull vs open-drain: who is allowed to pull up

A push-pull output has two transistors: a P-channel to the rail that sources current for a high, and an N-channel to ground that sinks current for a low. It is fast, strong in both directions, and dangerous in one specific way: if two push-pull outputs on the same wire disagree, one sources while the other sinks, and the wire carries whatever current the weaker transistor survives. That is why you never tie two push-pull outputs together.

An open-drain output keeps only the N-channel transistor. It can pull the line to ground, or it can let go. It can never drive the line high; something else — a resistor to the rail — must do that. This sounds like a limitation and is actually the point:

1

Any number of devices can share the wire safely

The line is high only if nobody is pulling it low. A device pulling low and a device letting go do not fight; the low wins. This is a wired-AND, and it is why I2C can have a master and several slaves on two wires with no arbitration hardware.

2

A slave can slow the master down

I2C clock stretching: a slave that needs time holds SCL low, and the master, whose own driver is open-drain, cannot force it high. The master waits. Push-pull could not do this without a separate handshake wire.

3

The rail the pull-up connects to defines the logic level

Because devices only ever pull low, an open-drain line's high level is set by whichever rail the pull-up resistor connects to. This is the trick behind the BSS138 shifter and behind level-flexible interrupt lines.

4

The price is the rising edge

A push-pull output drives the line high with a transistor; an open-drain line rises through a resistor, so the rise is an RC exponential. The bigger the resistor or the bus capacitance, the slower the rise. This single fact is what the rest of the lesson is about.

PUSH-PULL VDD P N logic OUT: sources or sinks OPEN-DRAIN + PULL-UP VDD (any rail) Rp SDA N logic N another device Push-pull: strong in both directions, cannot share a wire. Open-drain: sinks only, shares freely, rises through Rp.
The whole difference is one missing transistor. Removing the P-channel makes the line shareable and makes the rising edge a resistor's job.

SEE ITSize the pull-up: rise time against current

The I2C specification (NXP UM10204) sets a maximum rise time for the bus lines, measured from 30 % to 70 % of VDD: 1000 ns in Standard-mode (100 kHz), 300 ns in Fast-mode (400 kHz), 120 ns in Fast-mode Plus (1 MHz). It also caps the current a device must sink at 3 mA while holding the line at or below VOL = 0.4 V. The pull-up has to satisfy both. Set the bus up below and find the window — then look at what the "safe, strong" choice does to a sleeping battery.

⚙ Interactive · I2C pull-up sizer

Bus capacitance, pull-up value, and speed set the rising edge. The sleep scenario reveals which pull-up mistakes cost a battery — and which do not.

35 pF
3.3 V 0 V 30 % 70 % VIH (C3) 2.48 V spec tr tr = … time →
Rise time 30→70 %
—
Spec limit
—
Rise-time verdict
—
Sink current at VOL (≤ 3 mA)
—
Pull-up cost per report (active)
—
Sleep current through pull-ups
—
Board sleep total
—
1000 mAh lasts (sleep only)
—
—

Three things to take from playing with it. First, the rise-time window is wide on a short bus: at 35 pF, anything from about 1 kΩ to 10 kΩ passes Fast-mode. Second, the internal ≈45 kΩ pull-up fails even Standard-mode on that same bus — it exists for buttons, not buses. Third, and most important: on an idle bus the pull-ups cost nothing, and during a report they cost a fraction of a microamp averaged over the minute. The pull-up current people fret about is not the leak. The leak is a line that stays low while the device sleeps, and a "strong" 1 kΩ pull-up turns that failure from a 60-day battery into a 12-day one.

EXAMPLEThe worked calculation, once, by hand

You will do this for every I2C bus you design, so do it once slowly. The line rises as an RC exponential: V(t) = VDD·(1 − e−t/RpCb). The spec measures rise time between 30 % and 70 % of VDD, and the time to go from one fraction to the other is:

📖 The rise-time formula

tr = Rp·Cb·ln(0.7/0.3) ≈ 0.847·Rp·Cb. Rearranged for the largest pull-up that still meets the spec: Rp(max) = tr(max) / (0.847·Cb). The 0.847 is not a fudge factor; it is ln(0.7) − ln(0.3), the number of time constants between the two thresholds.

Step 1 — estimate Cb. UM10204 allows each device up to 10 pF of I/O capacitance. Beacon has three devices on the bus (the ESP32-C3 module, the SHT40, the LIS2DH12), so budget 30 pF for pins. A trace over a ground plane runs roughly 1 pF per centimetre (a rule of thumb; the stackup sets the real number), and Beacon's bus is a few centimetres long. Call it Cb ≈ 35 pF, with 50 pF as a pessimistic bound.

Step 2 — the upper bound from rise time. At 400 kHz, tr(max) = 300 ns: Rp(max) = 300 ns / (0.847 × 35 pF) = 10.1 kΩ. With the pessimistic 50 pF it is 7.1 kΩ. Any pull-up above that is out of spec at Fast-mode.

Step 3 — the lower bound from sink current. The line-low current is (VDD − VOL)/Rp, and the spec only obliges a device to sink 3 mA while keeping VOL ≤ 0.4 V. So Rp(min) = (3.3 − 0.4)/3 mA = 967 Ω. A 1 kΩ pull-up is legal by 33 Ω. That is not a design margin; that is a coincidence.

Step 4 — pick inside the window, biased toward the high side. The window is 0.97 kΩ to 10 kΩ. Toward the low end you get faster edges and more current; toward the high end you get slower edges and less current. 4.7 kΩ gives tr = 0.847 × 4.7 kΩ × 35 pF = 139 ns, a 2.2× margin against the 300 ns limit, at a line-low current of 0.62 mA. That is the number on Beacon's schematic, and now it is a number with a reason rather than a folk value.

Step 5 — check what happens at the ESP32-C3's actual threshold. The spec's 70 % point is 2.31 V; the C3's VIH is 0.75 × 3.3 = 2.48 V, a little higher. The time to reach 2.48 V from 0 V is RpCb·ln(1/(1 − 0.75)) = 1.39·RpCb = 228 ns with 4.7 kΩ — still a small fraction of the 1.25 µs half-period at 400 kHz. The receiver sees a clean high well before the next edge.

🧪 Same bus, three wrong answers

Internal pull-up (≈45 kΩ): tr = 0.847 × 45 kΩ × 35 pF = 1.33 µs. Fails Fast-mode by 4× and fails Standard-mode too. The bus "works" because most slaves are forgiving, until one is not. 1 kΩ: tr = 30 ns, superb — but 2.9 mA per line at VOL, zero margin on the sink spec, and any stuck-low line drains 3.3 mA continuously. Two sets of 4.7 kΩ (one on the dev kit, one on a breakout board, a very common accident): the parallel value is 2.35 kΩ, still inside the window here, but on a long 200 pF bus with three breakouts each carrying pull-ups you can find yourself at 1.2 kΩ without ever choosing it. Count the pull-ups on every board you connect.

IN PRACTICEThe floating input: random data and a current you did not budget

The failure the brief warned about deserves its own bench story. A CMOS input is the gate of a P-transistor and an N-transistor stacked between the rail and ground. Drive the gate hard to either rail and exactly one of them conducts; the pair draws essentially no current, which is why CMOS logic is efficient. Leave the gate unconnected and it settles wherever the picoamps of leakage and the femtofarads of coupling take it — typically somewhere near the middle, where both transistors partially conduct. Two consequences follow.

The pin reads noise. An input floating near its threshold is a receiver tuned to whatever is nearby: 50 Hz from the mains, the edges of the trace beside it, your hand approaching the board. Read it in a loop and you get a random bit stream that changes when you touch the enclosure. This is the classic "the button presses itself" and "the interrupt fires with nothing connected" bug.

The input stage burns current. With both transistors half-on there is a resistive path from the rail to ground through the input buffer. On a modern low-voltage process this is not the milliamps of old 4000-series parts, but it is also not the nanoamps the deep-sleep budget assumes. A handful of floating pins can add tens of microamps to a device whose whole sleep budget is 8 µA. The fix is a rule, not a component: every input pin is either driven, pulled, or configured as an output. Unused pins on Beacon are set as outputs (low) or given a weak internal pull in the sleep-entry code, and the two GPIOs with external pull-ups are isolated before deep sleep so the internal circuitry cannot fight them.

i2c_bus.cESP-IDF 5.x · i2c_master driver
// Beacon's bus: external 4.7 kΩ pull-ups on the PCB, so the
// weak ≈45 kΩ internal ones are left OFF — they would only add
// a parallel path that does nothing for rise time.
#include "driver/i2c_master.h"

static i2c_master_bus_handle_t bus;

esp_err_t beacon_i2c_init(void)
{
    i2c_master_bus_config_t cfg = {
        .i2c_port   = I2C_NUM_0,
        .sda_io_num = BEACON_SDA_GPIO,      // pins fixed in Stage 3
        .scl_io_num = BEACON_SCL_GPIO,
        .clk_source = I2C_CLK_SRC_DEFAULT,
        .glitch_ignore_cnt = 7,
        .flags.enable_internal_pullup = false,   // board has 4.7 kΩ
    };
    return i2c_new_master_bus(&cfg, &bus);
}

// A device on that bus at Fast-mode. The SHT40 (0x44) and the
// LIS2DH12 (0x19) both accept 400 kHz; the LIS2DH12 tops out there.
esp_err_t beacon_i2c_add(uint8_t addr, i2c_master_dev_handle_t *dev)
{
    i2c_device_config_t d = {
        .dev_addr_length = I2C_ADDR_BIT_LEN_7,
        .device_address  = addr,
        .scl_speed_hz    = 400000,
    };
    return i2c_master_bus_add_device(bus, &d, dev);
}

Note the highlighted line. Leaving the internal pull-ups enabled alongside external ones is harmless electrically (45 kΩ in parallel with 4.7 kΩ is 4.26 kΩ), but it hides a design fact in configuration where the next engineer will not look for it. Make the board carry the pull-ups and the firmware say so.

BEACONBeacon's bus: two sensors, four resistors, one rule

Beacon's I2C bus carries exactly two slaves: the Sensirion SHT40 at address 0x44 and the ST LIS2DH12 at address 0x19, both talking to the ESP32-C3-MINI-1 at 400 kHz. The schematic gets two 4.7 kΩ pull-ups to the 3.3 V rail, one on SDA and one on SCL, placed near the module. The calculation above justifies the value; the placement matters less on a bus this short but keeps the return path tidy for Lesson 2.5.

What about the pull-up's contribution to the power budget? Beacon's canon budget is ≈ 8 µA in deep sleep and a 45 ms active window at ≈ 40 mA average. During the active window the bus is actually clocking for well under a millisecond (a handful of transactions: trigger the SHT40, read six bytes, read the LIS2DH12's status and a few registers). With both lines low half the time at 0.7 mA each, that is roughly 0.7 µC per report, which averaged over 60 s is about 0.01 µA. It does not register against 38 µA. In sleep, the bus is idle high, no current flows through either pull-up, and the sensors themselves are in their own low-power states (the SHT40 idles at under 1 µA; the LIS2DH12 in low-power mode at a few µA depending on data rate — both counted inside the canon's 8 µA).

Now the rule that this lesson exists to install, and that Stage 3 will turn into firmware: a line that is low while Beacon sleeps is a battery leak. Three ways it happens on a real board:

1

A slave holds SDA low after an interrupted transaction

The MCU resets mid-byte (watchdog, brown-out, a flashing session), the slave is still waiting to finish clocking out a 0 bit, and it holds SDA low forever. The pull-up now feeds 3.3 V / 4.7 kΩ = 0.7 mA into the slave's output transistor — 88× the entire sleep budget. Beacon's battery would be flat in about two months. Lesson 3.5 teaches the recovery sequence (nine SCL pulses, then a STOP); the point here is that the pull-up value sets the price of the failure.

2

The sensor rail is switched off but the pull-ups stay on the main rail

A tempting power-saving trick: cut the sensors' supply in sleep. If the pull-ups remain on the always-on 3.3 V rail, they feed current through the unpowered sensors' protection diodes into their dead VDD nets, about 0.6 mA per line. The sensors are half-powered through their own I/O pins, which is both a leak and a reliability hazard. Beacon does not switch its sensor rail for exactly this reason; both sensors have proper sleep modes, and the canon budget uses them.

3

A GPIO driven low at sleep entry

Firmware leaves an I2C pin configured as a push-pull output low (a debugging leftover, or a "safe default" someone wrote) before entering deep sleep. The pull-up sources 0.7 mA into the MCU pin. The board sleeps at 700 µA and the log says everything is fine.

🔑 Stage 2 milestone entry

Schematic v0 gets: SDA and SCL with one 4.7 kΩ each to 3.3 V, near the ESP32-C3-MINI-1; SHT40 at 0x44 and LIS2DH12 at 0x19 on the same two wires; the LIS2DH12's INT1 to a GPIO that can wake the chip (Lesson 3.4 picks which). Design note on the sheet: "bus lines must be high in sleep; firmware verifies before sleep entry." The Stage 3 self-test reads both lines and refuses to sleep on a stuck bus. That is a schematic decision and a firmware decision made in the same breath — which is what this course means by a schematic being an argument.

WEAKNESSWhere this bites

✗ Designing to "it worked on the breadboard"

A breadboard adds a few picofarads per row and a few centimetres of jumper, so its bus capacitance is often higher than the final PCB's — and a bus that passes there may pass on the board too. But the reverse trap is more common: the dev kit and the sensor breakout each carry their own pull-ups, so the breadboard bus had 2.35 kΩ effective and worked beautifully. Your PCB, with the single 4.7 kΩ you intended, is slower and closer to the limit, and the first report that says "worked on the breadboard, flaky on the board" is a rise-time problem wearing a software costume. Count every pull-up on every board in the chain, and measure the rising edge on the real PCB with a scope (Lesson 1.7 already warned you the probe adds ~10 pF of its own).

✗ Trusting a "3.3 V-compatible" label on a 5 V part

Vendors write "3.3 V logic compatible" to mean different things: sometimes that the part's inputs accept 3.3 V highs (a threshold claim), sometimes that its outputs are 3.3 V (a level claim), rarely both. A 5 V-supplied part with TTL-threshold inputs will happily listen to a C3 — and then answer with 5 V push-pull outputs straight into the C3's non-tolerant pins. Check both directions of every wire against both datasheets' VOH/VIH and absolute-maximum lines. The word "compatible" on a product page is not a specification.

✗ Fixing an I2C problem by lowering the pull-up

When a bus misbehaves, the first forum answer is "try 2.2 kΩ". Sometimes right — if the edge really is too slow. But a missing ACK is at least as often a stuck slave, a wrong address, a clock-stretching slave the master ignores, or a slave whose sink capability cannot reach VOL against a pull-up that is already too strong. Lowering the resistor in that last case makes the ACK less visible, not more. Diagnose with a scope or logic analyzer before touching the resistor: an edge that reaches VIH in a tenth of the bit time does not need to be faster.

KEY INSIGHTHow this connects

  • Kirchhoff's Laws and Circuit Analysis by Hand (1.3) — the pull-up is a source with an output resistance, and everything on the line loads it. The RC rise, the sink-current limit, and the parallel-pull-up accident are all Thevenin reasoning from that lesson.
  • Diodes, Transistors, and MOSFETs as Switches (1.5) — an open-drain output is exactly the N-channel switch from that lesson with the load resistor moved off-chip, and the BSS138 level shifter is the same FET used as a bidirectional pass element.
  • Op-Amps and Amplification (2.2) — next: the analog side of the same boundary. Where a digital pin has a threshold, an analog input has a full scale, and the parts that condition a signal to fit it have their own set of limits.

Everything in this lesson reappears in Stage 3 as protocol behaviour: clock stretching and bus recovery (3.5), the strapping-pin trap on GPIO9 where a pull-up and a button meet at reset (3.3), and the wake-on-interrupt line from the LIS2DH12 (3.4). When those lessons say "the line is open-drain", they mean everything you just learned about who is allowed to pull up, and what it costs.

GLOSSARYKey terms introduced

VIH / VIL
The input thresholds: the minimum voltage guaranteed to read as high, and the maximum guaranteed to read as low. Between them the input's behaviour is undefined.
VOH / VOL
The output guarantees: the minimum voltage an output delivers for a high and the maximum it delivers for a low, each specified at a rated current.
Noise margin
The difference between what a driver guarantees and what the receiver demands, in each direction (NMH = VOH − VIH, NML = VIL − VOL). The budget that noise, ground offset, and crosstalk are allowed to spend.
Push-pull output
An output stage with both a sourcing transistor to the rail and a sinking transistor to ground. Strong and fast; cannot share a wire with another push-pull output.
Open-drain output
An output with only the sinking transistor. It can pull low or release; an external pull-up resistor provides the high. Enables wired-AND buses such as I2C.
Wired-AND
A bus arrangement where a line is high only if every device releases it. Any single device can pull it low. The basis of I2C arbitration and clock stretching.
Rise time tr (I2C)
The time for a bus line to rise from 30 % to 70 % of VDD, equal to 0.847·Rp·Cb. Limited by UM10204 to 1000 ns (Standard-mode), 300 ns (Fast-mode), 120 ns (Fast-mode Plus).
Level shifter
A circuit that translates logic levels between voltage domains: a resistor divider for slow unidirectional signals, a dedicated translator IC for fast ones, a MOSFET pass element for bidirectional open-drain lines.

ACTIVE RECALLCheck your understanding

Answer in your own words first, then reveal.

1A 3.3 V ESP32-C3 output drives a 5 V 74HC input. A colleague says "it works, I tested it." What do you tell them, with numbers?›

The C3 guarantees VOH ≥ 0.8 × 3.3 = 2.64 V. A 74HC input at 5 V demands VIH ≥ 0.7 × 5 = 3.5 V. The high-side noise margin is 2.64 − 3.5 = −0.86 V: the link is not guaranteed by either datasheet. It "works" because a typical 74HC input's real switching point sits near VDD/2 ≈ 2.5 V, so a 3.3 V high usually crosses it — but "usually" varies with temperature and part lot. The fix is a 74HCT part (VIH = 2.0 V, margin +0.64 V) or a level translator. Nothing is damaged in this direction; it is a reliability problem, not a smoke problem.

2Your I2C bus has 120 pF of capacitance and must run at 400 kHz. What pull-up range is legal, and what would you actually choose?›

Upper bound from rise time: Rp(max) = 300 ns / (0.847 × 120 pF) = 2.95 kΩ. Lower bound from the 3 mA sink limit at 3.3 V: Rp(min) = (3.3 − 0.4)/3 mA = 0.97 kΩ. The legal window is roughly 1–2.9 kΩ, so 4.7 kΩ would be out of spec here (tr ≈ 478 ns). Choose 2.2 kΩ: tr = 224 ns with 25 % margin, line-low current 1.3 mA. Better still, ask why the bus has 120 pF — a long cable or many devices — and consider shortening it or dropping to 100 kHz, where anything up to 9.8 kΩ passes.

3Beacon's sleep current jumps from 8 µA to about 700 µA after a firmware update, with no new hardware. Name the most likely electrical cause and how the pull-up value set the size of the damage.›

Something is holding an I2C line low during sleep: either a slave stuck mid-transaction after a reset, or a GPIO left driven low at sleep entry. 700 µA is the tell: 3.3 V / 4.7 kΩ = 0.70 mA, exactly one pull-up's worth of current into a low line. Had the pull-ups been 1 kΩ, the same bug would read 3.3 mA and drain the 1000 mAh cell in under two weeks; at 4.7 kΩ it takes about two months. The pull-up is not the bug, but it is the multiplier on the bug's cost. The fix is in firmware (bus recovery, verified-high lines before sleep) and the check is one multimeter reading on the sleep current.

4Why can two open-drain outputs share a wire when two push-pull outputs cannot, and what does that property give I2C that it could not have otherwise?›

A push-pull output actively sources current for a high, so two disagreeing outputs create a low-impedance path from rail to ground through the two transistors — a short. An open-drain output can only sink; when it wants a high it simply releases the line and the shared pull-up provides it. Two open-drain outputs can therefore never fight: any device pulling low wins, and the others merely stop contributing. This wired-AND behaviour gives I2C three things: multiple devices on two wires without arbitration hardware, clock stretching (a slave holds SCL low and the master must wait), and multi-master arbitration (a master that sees the line low when it released it knows it lost). The cost is that the rising edge is a resistor's job, which is why pull-up sizing is a design task.

Next: op-amps — the analog side of the same boundary →