The Core Concept: What a Multiplexer Actually Does
A multiplexer (often abbreviated as MUX) is an electronic switch that routes one of several input signals to a single output line, controlled by a set of digital select pins. In a real circuit, what a multiplexer changes is the physical architecture of your wiring: it trades parallel hardware lines for sequential time-division reading. Instead of dedicating 16 microcontroller pins to read 16 sensors, you use a MUX to read them one at a time through a single pin, saving expensive GPIO resources and reducing harness weight.
Think of it like a railway junction switch. Multiple tracks (inputs) converge, but the switch operator (select pins) dictates which single track is allowed to pass a train through to the main line (output). The other tracks are temporarily blocked. In electronics, this switching happens in nanoseconds, allowing your microcontroller to poll dozens of inputs so fast it appears simultaneous to human perception.
The Great Confusion: MUX vs. DEMUX vs. Shift Registers
When sourcing parts or reading schematics, hobbyists frequently confuse multiplexers with three other components. Understanding the difference prevents costly breadboard mistakes.
- Multiplexer (MUX): Many inputs, one output. Used for reading multiple sources or selecting one data path to pass to a single destination.
- Demultiplexer (DEMUX): One input, many outputs. Used for distributing a single signal to one of many destinations (e.g., triggering one specific relay out of eight). The 74HC138 is a classic DEMUX.
- Shift Register (e.g., 74HC595): Often confused with a DEMUX, but fundamentally different. A shift register converts serial data to parallel outputs and stores the state (latches it). A DEMUX only routes a live signal; it doesn't store it.
- Encoder: Converts multiple active inputs into a binary code output. A MUX passes the actual analog voltage or digital logic state of the selected line; an encoder just outputs a binary number representing which line is active.
Worked Numeric Example: Routing 16 Analog Sensors
Let’s look at a common bench scenario: you need to read 16 separate 10kΩ NTC thermistors using an Arduino Uno. The Uno only has 6 analog-to-digital converter (ADC) pins. You could buy a Mega, or you could use a 16-channel analog multiplexer like the 74HC4067.
The Pin Math
The 74HC4067 has 16 input channels (C0 to C15) and 1 common output (SIG). To select one of 16 channels, you need 4 digital select pins (S0, S1, S2, S3), because 24 = 16.
- Select pins required: 4 digital GPIO
- Signal read pin required: 1 analog GPIO
- Total microcontroller pins used: 5 (saving 11 pins compared to direct wiring).
The Hidden Gotcha: On-Resistance (RON)
Here is where datasheet literacy separates beginners from seasoned builders. A MUX is not a perfect wire; it has an internal on-resistance (RON). According to the NXP 74HC4067 datasheet, the typical RON at 4.5V is 80Ω.
If you are reading a 10,000Ω (10k) thermistor in a voltage divider, that 80Ω internal resistance sits in series with your sensor.
Where You Meet Multiplexers in Practice
Beyond basic sensor polling, multiplexers are the unsung heroes of complex embedded systems. You will encounter them in these specific scenarios:
1. Resolving I2C Address Conflicts
The I2C bus is great until you need to connect four identical BME280 sensors, all hardwired to the same I2C address (0x76). You cannot change the address, so you use an I2C multiplexer like the TCA9548A. This chip creates 8 virtual I2C buses. The microcontroller tells the TCA9548A to open "channel 2," talks to the sensor, then closes it and opens "channel 3."
2. LED Matrix Driving
In large LED matrices, wiring a dedicated pin to every single LED is impossible. Multiplexing is used to wire the LEDs in a grid of rows and columns. By rapidly switching the MUX to ground one row at a time while driving the column data, persistence of vision makes the entire matrix appear lit simultaneously, cutting the required GPIO count by over 75%.
3. Audio and Signal Routing
In DIY synthesizers or audio effect pedals, analog multiplexers route audio signals through different capacitor/resistor filter networks. Because audio is an AC signal swinging above and below ground, you must use a MUX rated for dual-rail or negative voltages, which brings us to component selection.
Multiplexer Selection Decision Tree
Choosing the wrong MUX is a classic cause of "my circuit reads random noise" or "the signal is clipped." Use this decision matrix to select the exact part number for your workbench.
| Signal Type & Requirement | Constraint / Edge Case | Recommended IC Part Number |
|---|---|---|
| Analog Sensors (Thermistors, Pots, LDRs) | Need to pass variable voltages (0-5V). Standard digital MUX will clip the signal to logic thresholds. | 74HC4067 (16-ch) or CD4051B (8-ch). These are true analog MUXes that pass continuous voltage. |
| Digital Logic (SPI, UART, GPIO expansion) | Only passing 0V or 5V/3.3V logic states. Speed matters more than analog precision. | 74HC151 (8-ch digital) or 74HC157 (Quad 2-ch digital). Faster switching, lower capacitance. |
| High-Speed Digital Buses (>50MHz) | Standard logic MUX introduces too much propagation delay and signal degradation. | SN74CB3T3257. This is a FET bus switch designed for high-bandwidth digital routing with minimal capacitance. |
| I2C Bus Expansion | Need to route bidirectional open-drain I2C lines (SDA/SCL) without corrupting the protocol. | TCA9548A. Specifically designed for I2C protocol routing with built-in voltage translation. |
| Bipolar Audio Signals (-5V to +5V) | Signal swings below ground. Standard 5V MUX will destroy the negative half of the waveform. | CD4052B powered with dual rails (e.g., VDD = +5V, VEE = -5V, VSS = 0V). |
Final Wiring Verification Step
Before applying power to a newly wired MUX circuit, always verify your Enable (EN) or Inhibit (INH) pin. On the 74HC4067, the EN pin is active low. If you leave it floating or wire it to 5V, the chip will remain disabled, and your output pin will read floating garbage. Tie the EN pin directly to Ground (GND) to permanently enable the chip unless you specifically need to shut down the entire MUX bus to save power.






