A demultiplexer (demuxer) is a combinational logic circuit that takes a single input signal and routes it to exactly one of several output lines, determined by the binary state of its control pins. In a real circuit or installation, a demuxer fundamentally changes how you allocate microcontroller pins and route PCB traces, allowing a single GPIO, clock, or PWM line to command multiple discrete destinations without requiring a dedicated wire from the source for each target. If you are building a system that needs to distribute one signal to many nodes selectively, the demuxer is your primary routing tool.
The Core Mechanics: One Input, Many Destinations
Think of a demuxer like a railroad switchyard: one incoming track (the data input) is directed to exactly one of several outgoing tracks (the outputs) by the physical position of the switch levers (the select pins). The unselected tracks receive no train (or in electrical terms, remain in their default logic state).
The mathematical relationship between the select lines and the outputs is strictly exponential. For a demuxer with N select lines, there are 2^N possible output destinations. A 2-select-line demuxer routes to 4 outputs (1-to-4). A 3-select-line demuxer routes to 8 outputs (1-to-8), and a 4-select-line demuxer routes to 16 outputs (1-to-16).
Worked Numeric Example: Routing with a 74HC138
Let us look at the ubiquitous Texas Instruments 74HC138, technically labeled as a 3-to-8 line decoder/demultiplexer. Beginners often get confused by the datasheet because there is no pin explicitly labeled "Data In." In standard decoder ICs, the "Enable" pin functions as the data input when used as a demuxer.
Assume we are running the 74HC138 at a standard 5V VCC. We want to route a 5V digital control signal to output pin Y5.
- Configure the Select Lines (A0, A1, A2): To select Y5, we need the binary equivalent of 5, which is
101. Therefore, we set A0 = HIGH (5V), A1 = LOW (0V), and A2 = HIGH (5V). - Set the Static Enables: The chip has three enable pins: G1, /G2A, and /G2B. To turn the chip on, G1 must be HIGH, and both /G2A and /G2B must be LOW. We wire /G2A and /G2B permanently to GND.
- Feed the Data Input: We connect our incoming 5V control signal to the G1 pin.
The Result: When the incoming signal at G1 goes HIGH (5V), the internal logic gates decode the 101 select state and pull the Y5 pin LOW (0V). Because the 74HC138 has active-LOW outputs, Y5 drops to 0V, while Y0 through Y4, and Y6 through Y7, remain HIGH (5V). When the input signal at G1 drops to 0V, Y5 immediately returns to 5V. The single input signal has been successfully routed to the Y5 destination.
Where You Meet This in Practice
You will rarely see a demuxer used just to route a simple DC on/off signal in modern designs; microcontrollers have plenty of GPIO pins for that. Instead, demuxers solve specific architectural bottlenecks in embedded systems and analog sensor arrays.
1. Expanding Microcontroller PWM and GPIO
If you are building a hexapod robot or a multi-axis servo gimbal using an ESP32 or Arduino Nano, you will quickly run out of hardware PWM pins. By wiring a single hardware PWM pin to the G1 (Enable) input of a 74HC138, and using three standard GPIO pins for the select lines (A0, A1, A2), you can route that single, highly stable PWM signal to any of 8 different servo motor driver inputs. The microcontroller changes the select pins to aim the signal, then updates the PWM duty cycle.
2. Analog Sensor Multiplexing/Demultiplexing
Digital demuxers only pass 1s and 0s. If you need to route analog voltages—such as reading an array of 16 NTC thermistors or routing an audio signal—you must use an analog demuxer like the CD4067B 16-channel analog switch. These ICs use internal MOSFETs to pass continuous voltage levels.
Demuxer vs. Multiplexer vs. Decoder
The most common point of confusion on the workbench is mixing up multiplexers, demultiplexers, and decoders. While they share internal logic gate architectures, their functional roles in a circuit are distinct.
| Feature | Multiplexer (Mux) | Demultiplexer (Demux) | Decoder |
|---|---|---|---|
| Signal Flow | Many inputs to 1 output | 1 input to many outputs | Binary code to 1-of-N active output |
| Primary Function | Data selection / gathering | Data distribution / routing | Address decoding / state indication |
| Common IC Example | 74HC151 (8-to-1) | 74HC138 (used as demux) | 74HC42 (BCD to 1-of-10) |
| Data Input Pins | Multiple (e.g., D0-D7) | Single (often via Enable pin) | None (Inputs are purely address) |
The Decoder Overlap: A decoder and a demuxer are essentially the same silicon if the decoder includes an "Enable" pin. If you tie the Enable pin to a constant HIGH voltage and toggle the address pins, it acts as a decoder (turning on one LED at a time). If you tie the address pins to a fixed target and feed a data stream into the Enable pin, it acts as a demuxer. According to standard combinational logic theory, the presence of a data-steering Enable pin is what officially bridges the gap between a decoder and a demuxer.
Frequently Asked Questions
What is the difference between a demuxer and a decoder?
Functionally, a decoder translates a binary number on its input pins into a single active output line (e.g., binary 011 turns on output Y3). A demuxer routes a separate, incoming data signal to a specific output line chosen by the select pins. In practice, any decoder IC that features an Enable (or Strobe) pin can be used as a demuxer by feeding your data signal into that Enable pin while holding the address pins at your target destination.
Can a demuxer handle analog signals like audio or sensor voltages?
Standard digital demuxers (like the 74HC138 or 74HC154) cannot handle analog signals; they will clip your waveform to the VCC and GND logic thresholds. To route analog voltages, audio, or variable sensor data, you must use an analog demuxer/multiplexer IC (like the CD4051, CD4067, or 74HC4051). These utilize internal CMOS transmission gates that pass continuous voltage levels, though you must account for their internal on-resistance ($R_{ON}$) and limited bandwidth.
Why does my demuxer output float or behave erratically on a breadboard?
Erratic behavior is almost always caused by floating Enable or Select pins. CMOS logic ICs (the 74HC or CD4000 series) have extremely high input impedance. If a select pin or an unused enable pin is left disconnected on a breadboard, it will pick up ambient electromagnetic noise, causing the internal logic to rapidly switch between output channels. Always tie unused Enable pins to their inactive state (VCC or GND, depending on the datasheet) using a 10kΩ pull-up/pull-down resistor, or wire them directly to the power rails.
How do I cascade two demuxers to get more outputs?
You can cascade demuxers by using the outputs of a primary "selector" demuxer to drive the Enable pins of several secondary "destination" demuxers. For example, to build a 1-of-64 demuxer, you would use one 74HC138 as the master. Its 8 outputs would each connect to the G1 Enable pin of eight additional 74HC138 chips. You wire the highest-order select bits to the master chip, and the lower-order select bits to all eight slave chips in parallel. This tree architecture is exactly how early computer memory address decoding was implemented on motherboards.






