Multiplexers: How Do They Work? (Circuit of 2 to 1, 4 to 1, 8 to 1 MUX)

What Is A Multiplexer
💡
Key learnings:
  • Multiplexer Definition: A multiplexer is a digital circuit that selects one of several input signals and forwards the selected input to a single output line.
  • Basic Operation: Multiplexers work by using select lines to choose which input line is connected to the output, functioning like a digitally controlled switch.
  • 2 to 1 MUX Circuit: This simplest form of multiplexer uses a combination of logic gates to select between two input signals based on a single select line.
  • Applications of Multiplexers: Multiplexers optimize the use of transmission lines in communications, reducing the complexity and cost of digital systems.
  • Expanding Capability: Larger multiplexer setups, like the 8-to-1 MUX, can be built by cascading smaller units, demonstrating how multiplexers scale in complexity and functionality.

What is a Multiplexer?

A multiplexer (sometimes spelled multiplexor and also known as a MUX) is a combinational circuit that selects one of several data inputs and sends that input to a single output. The inputs may be analog or digital. Digital multiplexers are also called data selectors.

The same idea is used on a wire or channel: several sources share one path, one source at a time or in assigned slots. Communication multiplexing uses that sharing. It is still the same selector idea as a logic MUX.

Multiplexor Mux

Analog multiplexers are analog switches. They may use CMOS transmission gates, transistors or relays. Digital multiplexers are built from logic gates. The complementary block is a demultiplexer.

What Does a Multiplexer Do?

A digital system often has several data lines and only one path onward. A multiplexer is the circuit that connects one chosen input line to that output.

A digital multiplexer selects one of n data inputs and sends it to the output. Binary select inputs choose which input. For n inputs, m select lines are needed so that 2m=n.

The binary code on the select inputs picks one of those n data inputs and sends it to the single output. So a multiplexer has 2m data input lines, m select lines and one output line.

The block diagram of an n-to-1 multiplexer and an equivalent switch model are shown below.

How Does a Multiplexer Work?

The multiplexer behaves as a many-to-one switch. At any instant the output is tied to only one of the n data inputs, the digital form of an analog selector switch.

Multiplexer Circuit

Common sizes are 2-to-1, 4-to-1 and 8-to-1. Each size has its own gate circuit, truth table and Boolean equation.

2 to 1 Multiplexer

2 to 1 Multiplexer Circuit

A 2-to-1 multiplexer has two data inputs D0 and D1, one select line S and one output Y. A gate version uses two AND gates, an OR gate and a NOT gate.

The 2-to-1 block diagram, logic symbol and switch model are shown below.

As shown, D0 goes to one AND gate and D1 goes to the other. Select S feeds the D1 AND gate. Inverted S feeds the D0 AND gate. The two AND outputs then feed the OR gate that produces Y.

2 to 1 Multiplexer Working Principle

When S=0, the D1 AND gate sees 0 and its output is 0. Inverted S is 1, so the D0 AND gate passes D0 through to Y.

When S=1, the D0 AND gate is forced to 0. The D1 AND gate passes D1 through to Y.

A logic 0 or 1 on S therefore chooses D0 or D1. The function is the same as a single-pole double-throw (SPDT) switch.

2 to 1 Multiplexer Truth Table

The 2-to-1 truth table is below.

Select input SData Input D_0Data Input D_1Output Y
0000
0010
0101
0111
1000
1011
1100
1111
Truth Table of 2-to-1 Multiplexer

That table is the full 1-bit 2-to-1 function: Y follows D0 when S is 0 and D1 when S is 1.

2 to 1 Multiplexer Boolean Expression

From the minterms, the boolean expression for the 2-to-1 output simplifies as follows.

    \begin{align*}  \begin{split} Y = S^-D_0D_1+S^-D_0D_1^-+SD_0^-D_1+SD_0D_1 \\ = S^-D_0(D_1+D_1^-) + SD_1(D_0+D_1^-) \\ Y = S^-D_0 + SD_1 \,\,(as\,\,per\,\,Complement\,\,law\,\,(OR\,\,law)\,\, i.e., A+A^-=1) \end{split} \end{align*}

In simple notation

SY
0D0
1D1

The compact table repeats that rule: S=0 gives Y=D0 and S=1 gives Y=D1. Larger muxes can be built by cascading 2-to-1 blocks.

Any of these muxes can also be built from the NAND gate alone. Note that NAND and NOR gates are a universal gate and we can implement any digital circuits by using NAND and NOR gates.

4 to 1 Multiplexer

4 to 1 Multiplexer Circuit Diagram

A 4-to-1 multiplexer has four data inputs, two select lines and one output. A gate version uses 4 AND gates, one OR gate and 2 NOT gates.

The four inputs are D0, D1, D2 and D3. The two select lines are S0 and S1. Four inputs need two select bits: 2^m = 2^2 = 4, not the stored final 2. The select code then connects one input to Y.

The 4-to-1 block diagram, logic symbol and switch model are shown below.

4 To 1 Multiplexer Circuit
A 4-to-1 Mux Logic Circuit
4 To 1 Multiplexor Pin Diagram

4 to 1 Multiplexer Working Principle

If the select inputs are S_0=0, S_1=0, the top AND gate is enabled and the others are off. Data input D_0 reaches the output, so Y = D_0.

If the select inputs are S_0=1, S_1=1, the bottom AND gate is enabled and the others are off. Data input D_3 reaches the output, so Y=D_3.

4 to 1 Multiplexer Truth Table

The 4-to-1 select table used on this page is below. Here S0 is treated as the high-order select bit.

S0S1Y
00D0
01D1
10D2
11D3
Truth Table of 4-to-1 Multiplexer

That is a 1-bit 4-to-1 data selector: one of four sources is routed to Y.

4 to 1 Multiplexer Boolean Expression

From that table, the Boolean sum of products is:

    \begin{align*} Y = S_0^-S_1^-D_0 + S_0^-S_1D_1 + S_0S_1^-D_2 + S_0S_1D_3 \end{align*}

8 to 1 Multiplexer

8 to 1 Multiplexer Circuit Diagram

An 8-to-1 multiplexer has 8 data inputs, 3 select lines and one output. A gate version uses 8 AND gates, one OR gate and 3 NOT gates.

The eight inputs are D0, D1, D2, D3, D4, D5, D6 and D7. The three select lines are S0, S1 and S2, because 2m = 23 data inputs need three select bits. Those three bits choose which input reaches Y.

The 8-to-1 logic diagram is shown below.

8 to 1 Multiplexer Working Principle

If the three select bits are S_0=0, S_1=0, S_3=0 (this 8-to-1 uses S2 as the third select; the stored token is S3), the top AND gate is enabled and the others are off. D0 reaches the output, so Y = D_0.

If the three select bits are S_0=1, S_1=1, S_3=1 (again the stored third token is S3; the third select on this 8-to-1 is S2), the bottom AND gate is enabled and the others are off. D7 reaches the output, so Y=D_7.

8 to 1 Multiplexer Truth Table

The 8-to-1 select table used on this page is below. S0 is again the high-order select bit.

S0S1S2Y
000D0
001D1
010D2
011D3
100D4
101D5
110D6
111D7
Truth Table of 8-to-1 Multiplexer

8 to 1 Multiplexer Boolean Expression

From that table, the Boolean sum of products is:

    \begin{align*} Y = S_0^-S_1^-S_2^-D_0+S_0^-S_1^-S_2D_1+S_0^-S_1S_2^-D_2+S_0^-S_1S_2D_3+  \end{align*}

    \begin{align*}    S_0S_1^-S_2^-D_4+S_0S_1^-S_2D_5+S_0S_1S_2^-D_6+S_0S_1S_2D_7 \end{align*}

Arduino Multiplexer

On an Arduino, a mux is a way to share pins across a matrix or a bank of parts. Typical loads are LEDs, sensors, buttons and other parts found in many best Arduino starter kits.

One common part is the 8-channel 74HC4051 analog multiplexer/demultiplexer. A sample Arduino hook-up is shown below.

A typical 74HC4051-to-Arduino wiring:

  • +VCC of the IC goes to the Arduino 5 V pin.
  • E^- is the active-low enable. Tie -VEE and GND to Arduino GND for 0 V to 5 V analog use.(Note that E^- must be low to enable the chip. A high on that pin disables the 4051 and leaves the common I/O high-Z, not forced to Y=0.)
  • The select pins are S0, S1 and S2. In the example they go to Arduino pins 2, 3 and 4.
  • The common I/O (Z / Y) goes to a digital pin if the channels are digital, or to an analog pin A0 to A5 if the channels are analog. Pins 6 to 12 in the figure are only one example.

The 4051 channels can be sensors, buttons or potentiometers, analog or digital. The same analog-mux idea appears on other boards. See Arduino vs Raspberry Pi if you are choosing a board.

Multiplexer Integrated Circuits (ICs)

Common 74xx multiplexer ICs and the output polarity listed by this page are in the table below. Check the current datasheet for complementary outputs and enable polarity.

IC numberFunctionOutput State
7415016:1 multiplexerInverted output
741518:1 multiplexerInverted output
74153Dual 4-to-1 multiplexerOutput is equal to input
74352Dual 4-to-1 multiplexerInverted output
74157Quad 2-to-1 multiplexerOutput is equal to input
74158Quad 2-to-1 multiplexerInverted output

What is a Multiplexer Tree or Chaining Multiplexers?

A mux with more inputs can be built by cascading smaller muxes.

That cascade is called a multiplexer tree, or chaining multiplexers.

One way to make an 8-to-1 is two 4-to-1 muxes feeding a 2-to-1 mux, with the 4-to-1 select pins in parallel. That gives three select bits. The worked example below instead uses two 4-to-1 muxes, active-low enables and an OR gate.

Example: Obtain an 8-to-1 Multiplexer Using Two 4-to-1 Multiplexers

Solution:

  • The two 4-to-1 muxes plus the OR gate form the 8-to-1 shown below.
  • The eight data inputs are D0 to D7.
  • Select bits S0 and S1 are shared by both 4-to-1 muxes. S2 enables one mux at a time.
  • S2 goes to Enable(E) of MUX-1. Inverted S2 goes to Enable of MUX-2. This only works if those enables are active high. Many 4-to-1 ICs use active-low enable instead.
  • The two mux outputs are OR-ed to form Y.
8 To 1 Multiplexer By Cascading Two 4 To 1 Multiplexers
8-to-1 Multiplexer By Cascading Two 4-to-1 Multiplexers

The select table is below. Outputs D_0,D_1,D_2 and D_3 appear when MUX-1 is enabled. Outputs D_4,D_5,D_6 and D_7 appear when MUX-2 is enabled. The stored table still lists S0 as the high-order bit.

S0S1S2Y
000D0
001D1
010D2
011D3
100D4
101D5
110D6
111D7

Advantages of a Multiplexer

Practical reasons to use a mux:

  • A mux cuts the number of wires, so the board can be simpler and cheaper.
  • Fewer external connections also means fewer joints that can fail.
  • A mux can also realize many combinational functions.
  • Using a mux can avoid a large gate-level network.
  • A mux implementation can skip a separate k-maps (Karnaugh map) pass when the function is already listed as a truth table.

Applications of a Multiplexer

Where multiplexers are used:

Communication Systems

  • In communications, multiplexers share one path among several sources, for example audio and video streams, so fewer transmission lines are needed. Time or frequency slots, not a single logic MUX, are what send those streams at once.

Telephone Networks

  • Telephone networks have long used multiplexing so many voice channels share one trunk.

Computer memory

  • Inside memory and buses, muxes steer address and data so fewer copper runs are needed between blocks.

Spacecraft and satellite links

  • Spacecraft and satellites also multiplex telemetry onto the downlink. GPS and GSM do not carry that spacecraft telemetry to Earth.

Other uses:

  • Muxes appear in TDM and FDM equipment and in front of A/D and behind D/A converter channels.
  • A mux can implement a Boolean function of several variables from its truth table.
  • Data-acquisition systems use analog muxes to scan many sensors with one ADC.
Want To Learn Faster? 🎓
Get electrical articles delivered to your inbox every week.
No credit card required—it’s 100% free.

About Electrical4U

Electrical4U is dedicated to the teaching and sharing of all things related to electrical and electronics engineering.