A multiplexor (often abbreviated as MUX) is a combinational logic circuit that selects one of several input signals and forwards it to a single output line based on the binary state of its select pins. In a real circuit or installation, a MUX fundamentally changes the physical architecture by allowing multiple signals to share a single transmission path or microcontroller GPIO pin, effectively trading parallel wiring complexity for sequential time-division reading. Think of it like a multi-lane highway merging into a single toll booth: the select pins act as the traffic lights, dictating exactly which lane gets to pass through the gate at any given microsecond.

What People Commonly Confuse It With: Beginners frequently mix up a multiplexor with a demultiplexor (which takes one input and routes it to many outputs) or an encoder (which compresses active inputs into a binary code without needing select lines). We will break down these differences in the final section.

The Core Specs: Choosing the Right Multiplexor IC

Not all multiplexors are created equal. The most critical distinction on the bench is between digital MUXes (which pass strict logic HIGH/LOW states) and analog MUXes (which use internal MOSFETs to pass continuous voltage waveforms). If you try to pass an audio signal or a varying sensor voltage through a standard 74HC151 digital MUX, you will clip the waveform and destroy your data. Always check the signal type before ordering parts.

Below is a data-dense reference table of the most common through-hole and surface-mount MUX ICs you will encounter in 2026, complete with propagation delays and typical unit pricing for small-quantity hobbyist purchases.

IC Part Number Channels Signal Type Typical Propagation Delay VCC Range Approx. Unit Cost
74HC157 Quad 2-to-1 Digital 14 ns @ 5V 2.0V - 6.0V $0.45
74HC151 8-to-1 Digital 18 ns @ 5V 2.0V - 6.0V $0.55
74HC4051 (e.g., SN74HC4051) 8-to-1 Analog N/A (On-Res: ~60Ω) 2.0V - 10.0V $0.35
74HC4067 16-to-1 Analog N/A (On-Res: ~70Ω) 2.0V - 10.0V $1.10
TCA9548A 8-channel I2C Bus N/A (I2C Switch) 1.65V - 5.5V $1.85

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

Worked Example: Expanding ESP32 ADC Channels with a 74HC4051

Let us look at a concrete numeric example. Suppose you are building a solar tracking array and need to read 8 light-dependent resistors (LDRs) to determine the sun's position. You want to use an ESP32 DevKit v1, but the ESP32 has a limited number of usable Analog-to-Digital Converter (ADC) pins—specifically, ADC2 pins conflict with the WiFi radio, leaving you short on channels.

By inserting a 74HC4051 analog multiplexor between the LDRs and the ESP32, you can read all 8 sensors using only 1 ADC pin and 3 digital select pins.

The Wiring and Binary Logic

The 74HC4051 has 8 input channels (Y0 through Y7), one common output (Z), and three select pins (S0, S1, S2). To route a specific channel to the output, you must apply the binary equivalent of that channel number to the select pins.

  • S0 = Least Significant Bit (1s place)
  • S1 = Middle Bit (2s place)
  • S2 = Most Significant Bit (4s place)

The Math: Let us say your code needs to read the LDR connected to Channel 5 (Y5). Convert 5 to binary: 101. Therefore, S2 must be HIGH (1), S1 must be LOW (0), and S0 must be HIGH (1).

ESP32 GPIO Mapping for Channel 5:
1. Set ESP32 GPIO 25 (wired to S2) to HIGH (3.3V).
2. Set ESP32 GPIO 26 (wired to S1) to LOW (0V).
3. Set ESP32 GPIO 27 (wired to S0) to HIGH (3.3V).
4. Trigger the ADC read on GPIO 34 (ADC1_CH6, wired to the MUX Z pin).
5. The ESP-IDF ADC oneshot driver captures the voltage from LDR #5.

Timing Consideration: The 74HC4051 has a typical "break-before-make" time of about 10 nanoseconds, and an on-resistance of roughly 60 ohms. When switching channels, the internal parasitic capacitance needs a moment to settle. In your firmware, you must insert a delayMicroseconds(50) after toggling the select pins and before calling analogRead(). If you skip this delay, your ADC will sample the residual charge injection from the previously selected channel, resulting in ghost readings.

Where You Meet This in Practice

Multiplexors are not just textbook theory; they solve specific, painful hardware bottlenecks in modern maker and commercial installations.

1. I2C Address Collisions

If you are wiring up three identical BME280 environmental sensors to an ESP32, you will hit a wall: the BME280 only supports two I2C addresses (0x76 and 0x77). To read all three on the same bus, you use an I2C multiplexor like the TCA9548A. The microcontroller sends a command to the TCA9548A to open "Channel 2," effectively isolating the third BME280 from the bus so its address no longer collides with the others.

2. LED Matrix Scanning

In large LED dot-matrix displays, wiring a dedicated GPIO to every single LED is physically and electrically impossible. Instead, the LEDs are wired in a grid. Digital multiplexors (often built into dedicated driver ICs like the MAX7219) rapidly cycle the select lines to illuminate one row at a time. Because they cycle at >100 Hz, human persistence of vision blends the sequential flashes into a solid, continuous image.

3. Audio and RF Signal Routing

In software-defined radio (SDR) or modular synthesizer builds, analog multiplexors route continuous AC waveforms. Here, the on-resistance and charge injection specs become critical. A high on-resistance will form a low-pass filter with the downstream capacitance, rolling off your high-frequency audio treble. For audio, builders often upgrade from the standard 74HC4051 to specialized low-on-resistance ICs like the DG408.

Common Confusions: MUX vs. DEMUX vs. Encoder

When ordering parts or reading schematics, mixing up these three components will result in a board that simply does not work. Here is the definitive breakdown.

Component Direction of Data Control Mechanism Primary Use Case
Multiplexor (MUX) Many Inputs → 1 Output Select pins choose which input passes through. Reading multiple sensors with one ADC pin.
Demultiplexor (DEMUX) 1 Input → Many Outputs Select pins choose which output receives the input. Routing a single audio source to one of many speakers.
Encoder 2^N Inputs → N Outputs No select pins; output reflects the binary address of the single active HIGH input. Converting a 16-button keypad press into a 4-bit binary code.

Frequently Asked Questions

Can I use a digital multiplexor to switch PWM signals?
Yes, but with caveats. A PWM signal is technically a digital square wave, so a 74HC151 will pass it. However, if your PWM frequency is very high (e.g., >10 MHz), the propagation delay and rise/fall times of the MUX will distort the duty cycle. For standard servo control (50 Hz) or LED dimming (1 kHz), a digital MUX works perfectly.

What happens to the unselected inputs on a MUX?
They are electrically disconnected from the output. However, they are still connected to the internal silicon. If you leave unused analog inputs floating, they can act as antennas, picking up EMI and injecting noise into the substrate, which can slightly degrade the accuracy of the active channel. Always tie unused analog MUX inputs to GND.

Do I need pull-down resistors on the select pins?
During microcontroller boot-up (like the ESP32 or Arduino resetting), GPIO pins float before the bootloader initializes them. If your MUX select pins float, the IC will rapidly and randomly switch channels, potentially causing short-circuit current spikes if the output is driving a low-impedance load. Adding 10kΩ pull-down resistors to S0, S1, and S2 ensures the MUX defaults to Channel 0 during boot.