A multiplex (or multiplexer) is an electronic switching circuit that selects one of several input signals and forwards it to a single output line, allowing multiple data streams or sensors to share a single physical connection. In practical circuit design, a multiplexer fundamentally changes your architecture by trading physical copper and microcontroller GPIO pins for switching time and logic complexity. Instead of running 16 separate wires from 16 sensors to a microcontroller, you route them through a multiplexer IC, reducing the physical connections to a fraction of the original count.

Think of a hardware multiplexer like a multi-position rotary switch on an old stereo receiver: you have multiple inputs (CD, Tape, Radio), but only one physical amplifier path. The rotary switch connects the single amplifier to whichever source you select. In modern electronics, that mechanical switch is replaced by solid-state MOSFET gates toggling in nanoseconds, controlled by digital logic pins.

The Hardware Reality: How Multiplexers Shrink Circuits

At the silicon level, an analog multiplexer (often called an analog switch) uses CMOS transmission gates. When a specific channel is addressed, the internal MOSFETs turn on, creating a low-resistance path between that specific input pin and the common output pin. All other channels remain high-impedance (disconnected).

The most critical spec on any multiplexer datasheet is the On-Resistance ($R_{ON}$). Because the signal passes through a physical semiconductor junction, it is not a perfect short circuit. This resistance forms an unintended voltage divider with your sensor circuitry, which can introduce measurement errors if you are not careful.

Common Multiplexer ICs for Bench and Production Use
Part Number Channels Signal Type Supply Voltage Typical $R_{ON}$
CD4051B 8 (1-of-8) Analog / Digital 3V to 15V 120 Ω
CD74HC4067 16 (1-of-16) Analog / Digital 2V to 6V 70 Ω
MAX306 16 (1-of-16) Precision Analog 2.5V to 15V 100 Ω (Low Charge Injection)
SN74CBT3253 Dual 4 (Bus Switch) Digital / FET Bus 4V to 5.5V 5 Ω

Sources: Texas Instruments CD74HC4067 Datasheet, All About Circuits Multiplexer Guide.

Worked Numeric Example: Reading 16 Sensors with an ESP32

Let us look at a real-world scenario. You are building a thermal monitoring array using an ESP32 DevKit v1, and you need to read 16 separate NTC thermistors.

The ESP32 ADC Trap: The ESP32 has two ADC units. ADC2 shares pins with the WiFi radio. If you enable WiFi, ADC2 becomes completely unusable. This leaves you with roughly 15 usable ADC1 pins, which is not enough for 16 sensors.

The Multiplex Solution: We use a CD74HC4067 16-channel multiplexer.
Pins Required: The 4067 has 4 digital address pins (S0, S1, S2, S3). Because $2^4 = 16$, these 4 pins can select any of the 16 channels. You also need 1 analog pin connected to the common SIG (signal) pin.
Total GPIO Used: 5 pins (4 digital, 1 analog) to read 16 distinct sensors.

Pin Savings: Direct wiring requires 16 ADC pins. Multiplexing requires 5 GPIO pins. This is a 68% reduction in microcontroller pin usage.

The $R_{ON}$ Error Calculation (Where Hobbyists Fail)

The CD74HC4067 has a typical On-Resistance of 70 Ω. Let us calculate how this affects two different sensor types.

Scenario A: 10kΩ NTC Thermistor
Your voltage divider uses a 10kΩ pull-down resistor. The total resistance in the measurement path is $10,000Ω + 70Ω = 10,070Ω$.
Error introduced: $(70 / 10070) * 100 = 0.69%$.
Verdict: For room-temperature HVAC monitoring, a 0.69% voltage error translates to less than 0.2°C temperature inaccuracy. This is perfectly acceptable.

Scenario B: 100Ω PT100 RTD (Resistance Temperature Detector)
A PT100 sensor has a base resistance of 100 Ω at 0°C, changing by roughly 0.385 Ω per degree Celsius. If you pass this signal through the 70 Ω $R_{ON}$ of the multiplexer, you are adding a massive, variable series resistance.
Error introduced: The 70 Ω offset looks like an additional ~180°C of heat.
Verdict: Catastrophic failure. You cannot use a standard CMOS multiplexer for low-impedance RTDs. You must either use an instrumentation amplifier before the multiplexer, or use a specialized low-$R_{ON}$ reed relay matrix.

For more on ESP32 ADC sampling constraints, refer to the Espressif ESP32 ADC Documentation.

Where You Meet Multiplexing in Practice

You are likely already using multiplexing without realizing it. Here is where the concept scales beyond the breadboard:

  • Automotive Wiring Harnesses: A 1990s luxury car used dedicated wires for every switch, resulting in wiring harnesses weighing over 40 kg. Modern vehicles use multiplexed networks (like CAN and LIN buses). The door control module multiplexes the window switch, mirror switch, and lock switch into a single twisted-pair data stream, cutting harness weight to under 15 kg and eliminating hundreds of copper connections that could corrode.
  • LED Dot Matrices: An 8x8 LED matrix contains 64 individual LEDs. Wiring them directly would require 64 microcontroller pins. By multiplexing the rows and columns (8 row pins, 8 column pins), you drive all 64 LEDs using only 16 pins. The microcontroller scans the rows sequentially at roughly 100 Hz; the persistence of human vision makes it look like all LEDs are lit simultaneously.
  • I2C and SPI Buses: While these are communication protocols, they rely on logical multiplexing. On an I2C bus, dozens of sensors share just two physical wires (SDA and SCL). The master sends an address byte, and the internal logic of each sensor acts as a digital demultiplexer, only responding when its specific address is called.

Common Confusions and Troubleshooting

When discussing multiplexing on the bench or in code, several concepts frequently get tangled.

Multiplexer (MUX) vs. Demultiplexer (DEMUX)

A MUX takes many inputs to one output (data selector). A DEMUX takes one input to many outputs (data distributor). If you are reading 16 sensors into one ADC pin, you need a MUX. If you are taking one PWM signal from a microcontroller and routing it to one of 8 different motor drivers, you need a DEMUX (like the 74HC138 or 74HC238).

Hardware MUX vs. Protocol Multiplexing (CAN/TDM)

Hardware multiplexing is a physical layer switching mechanism (connecting wire A to wire B via a MOSFET). Protocol multiplexing, like Time-Division Multiplexing (TDM) on a CAN bus or telecommunications fiber, is a data-link layer concept where multiple digital data streams are interleaved into packets on a single wire. A CAN transceiver handles the physical signaling, but the CAN controller handles the logical multiplexing of the data frames.

LED Matrix Ghosting

If you multiplex an LED matrix and see faint, unwanted illumination in unselected rows (ghosting), the issue is usually capacitive coupling or slow MOSFET turn-off times in your driver circuit. The fix: Ensure you are using proper sink/source drivers (like the MAX7219) that actively pull the unselected lines to ground or VCC, rather than just letting them float high-impedance. Adding a brief 'blanking' delay in your code between switching the row address and turning on the column data also eliminates bleed-over.

Frequently Asked Questions

Can I multiplex digital signals like UART or I2C?
Yes, but you must use a digital bus switch (like the SN74CBT series) with very low capacitance and low $R_{ON}$ (under 10 Ω). Standard analog MUX ICs like the CD4051B add too much parasitic capacitance, which will round off the sharp edges of high-speed digital signals and cause data corruption.

Does multiplexing reduce the sampling rate of my ADC?
Yes. If your ADC takes 10 μs to sample, and you are multiplexing 16 channels, a full sweep takes a minimum of 160 μs (plus the MUX switching time, which is usually negligible at ~10 ns). Your effective per-channel sampling rate drops by a factor of 16.