EmbeddedRelated.com
Jacob Beningo
Live online course · Jacob Beningo
AI for Embedded Developers
$100 off for EmbeddedRelated readers until Dec 6 · 5 live sessions, Dec 7-11
Discount ends in
26days 03hrs 43min 04sec
Learn More →

Open Drain

Category: Electrical | Also known as: open-drain, open collector, open-collector

An open-drain (or open-collector in bipolar transistor terminology) output is a driver topology in which the output transistor can only pull the line low or leave it floating -- it has no active pull-high path. An external pull-up resistor (or current source) connected to a supply rail is required to bring the line high when no device is asserting it low.

In practice

Open-drain outputs are common on GPIO pins of most modern microcontrollers, where the pin mode can be configured in firmware (e.g., STM32 GPIO_MODE_OUTPUT_OD; on PIC devices, open-drain is typically enabled via a dedicated open-drain control register or bit, not just the TRISx direction bit). The lack of an internal pull-high means you must add an external pull-up resistor -- or enable an internal weak pull-up if the device provides one -- before the pin will reliably reach a valid logic high in typical single-wire use. Forgetting the pull-up is one of the most frequent wiring mistakes when first working with I2C, which mandates open-drain signaling on SDA and SCL.

The primary advantage of open-drain is that multiple devices can share a single wire without bus contention. Any device can assert the line low; the line goes high only when every device releases it. This wired-AND property is the basis of I2C, SMBus, and 1-Wire, and is also used for open-drain interrupt lines on many sensor ICs (e.g., the INT pin on LIS3DH or MPU-6050 accelerometers) where multiple interrupt sources are OR-ed onto a single MCU pin.

Pull-up resistor value is a real design tradeoff. A smaller resistor (1 kohm) charges bus capacitance faster and allows higher bit rates, but increases quiescent current when any device holds the line low. A larger resistor (10 kohm) saves power but limits maximum speed. I2C Fast-mode (400 kHz) and Fast-mode Plus (1 MHz) typically require pull-ups in the 1--2.2 kohm range; Standard-mode (100 kHz) is more tolerant of values up to ~10 kohm, depending on total bus capacitance.

Open-drain outputs can also level-shift passively: if the pull-up resistor is tied to a supply different from the driving IC's own supply (and both are within the pin's absolute maximum ratings), the high level on the wire is set by the pull-up supply rather than the driver's VDD. This technique is used to connect 3.3 V MCU peripherals to 5 V bus lines, though it only works in one direction and the feasibility depends on the specific IC's input voltage tolerance.

Frequently asked

What is the difference between open-drain and open-collector?
They describe the same concept using different transistor technologies. Open-collector refers to a bipolar junction transistor (BJT) output where the collector terminal is left unconnected internally. Open-drain refers to the equivalent MOSFET output where the drain is left unconnected. In modern datasheets for MCUs and logic ICs, 'open-drain' is the standard term because CMOS processes are nearly universal. The electrical behavior and external circuit requirements (pull-up resistor to a supply) are identical.
Do I always need an external pull-up resistor with an open-drain pin?
You need some pull-up path for the pin to reach a valid logic high. Many MCUs include optional weak internal pull-ups (typically 20--100 kohm) that can be enabled in firmware, which is convenient for low-speed or low-current signals. For I2C or other bus protocols with defined speed and capacitance requirements, internal pull-ups are usually too weak, and a specific external resistor value should be calculated based on bus capacitance and target bit rate.
Why does I2C require open-drain instead of push-pull outputs?
I2C is a multi-master, multi-slave bus where any participant must be able to assert the bus low. If two push-pull devices drove the bus to opposite logic levels simultaneously, a low-impedance short-circuit would result, potentially damaging the drivers. With open-drain outputs, any device can pull the bus low safely, and the bus returns high only when all devices release it. This wired-AND behavior is fundamental to I2C's arbitration and clock-stretching mechanisms.
Can I use an open-drain pin to drive a load like an LED or a relay directly?
Yes, and this is a common use case. Rather than a pull-up resistor to logic supply, the external circuit is a load: for example, an LED in series with a current-limiting resistor tied to VCC, or a relay coil (which requires a flyback diode for protection and may need a dedicated driver if the sink current exceeds the pin's rating). When the pin drives low, current flows through the load from VCC into the pin's drain. The load is 'on' when the pin is asserted low and 'off' when the pin is released and the external circuit pulls the node high. Check the pin's sink-current rating -- many MCU GPIO pins are rated for 4--25 mA sink current, while driving larger loads requires a dedicated FET or driver IC.
How does open-drain enable passive level translation between 3.3 V and 5 V logic?
If a 3.3 V open-drain output (whose drain diode and ESD structures can tolerate 5 V on the pin) drives a line whose pull-up resistor is tied to 5 V, the line sits at 5 V when released and is pulled to near 0 V when asserted. The 5 V receiver sees valid 5 V logic levels. This works only when the 3.3 V device's datasheet explicitly states the pin is 5 V tolerant. It also only handles signals that originate from the open-drain side; for bidirectional lines at different voltages, a dedicated level-shifter IC (such as the BSS138-based design common on I2C bus extenders) is more robust.

Differentiators vs similar concepts

Open-drain is often contrasted with push-pull output topology. A push-pull driver has both a pull-up transistor and a pull-down transistor: it actively drives the line to both logic high and logic low. This gives faster edge rates and does not require an external resistor, but prevents multiple drivers from sharing a line without bus arbitration logic. Open-drain sacrifices the active pull-high for the ability to wire-AND multiple outputs together. A third topology, open-source (or open-emitter in BJT terms), is the mirror image -- the output can only pull high or float, requiring an external pull-down -- but this is uncommon in practice.