Summary
A multiplexer (MUX) is a digital or analog switching circuit that selects one of multiple input signals and sends it to a single output. A demultiplexer (DEMUX) performs the reverse operation by routing one input signal to one of several outputs. Multiplexers are widely used in communication systems, digital circuits, data acquisition, and microcontroller projects.
For Arduino projects, devices such as the CD4051 and 74HC4067 are especially useful because they let one analog input read multiple sensors by selecting channels electronically.

What Is a Multiplexer?
A multiplexer, or MUX, is a circuit that selects one signal from several input signals and connects the selected signal to a common output.
For example, an 8:1 multiplexer has 8 inputs, 1 output, and 3 select lines. The three select lines determine which of the eight inputs is connected to the output.
The basic relationship is:
Number of select lines = log₂(number of inputs)
So:
| Multiplexer | Inputs | Select Lines | Output |
|---|---|---|---|
| 2:1 MUX | 2 | 1 | 1 |
| 4:1 MUX | 4 | 2 | 1 |
| 8:1 MUX | 8 | 3 | 1 |
| 16:1 MUX | 16 | 4 | 1 |
A multiplexer can switch either digital signals or analog signals, depending on the device.
Components and Supplies
What Is a Demultiplexer?
A demultiplexer, or DEMUX, takes one input signal and routes it to one of several outputs based on the select lines.
For example, a 1:8 demultiplexer has:
- 1 input
- 8 outputs
- 3 select lines
Only the selected output receives the input signal.
A useful way to remember the difference is:
MUX: many inputs → one output
DEMUX: one input → many outputs
Many analog switching ICs, including the CD4051 and 74HC4067, can operate as either multiplexers or demultiplexers because their signal path is bidirectional. TI describes the CD4051B as an 8:1 analog multiplexer with a bidirectional signal path, while Nexperia describes the 74HC4067 as a 16-channel analog multiplexer/demultiplexer.
How Does a Multiplexer Work?
A multiplexer uses select lines to control electronic switches inside the IC.

Consider an 8-channel MUX:
Input 0 ──┐
Input 1 ──┤
Input 2 ──┤
Input 3 ──┤
Input 4 ──┤──> Electronic Switch ──> Output
Input 5 ──┤
Input 6 ──┤
Input 7 ──┘
↑
S0 S1 S2
The select lines form a binary number.
For example:
| S2 | S1 | S0 | Selected Input |
|---|---|---|---|
| 0 | 0 | 0 | CH0 |
| 0 | 0 | 1 | CH1 |
| 0 | 1 | 0 | CH2 |
| 0 | 1 | 1 | CH3 |
| 1 | 0 | 0 | CH4 |
| 1 | 0 | 1 | CH5 |
| 1 | 1 | 0 | CH6 |
| 1 | 1 | 1 | CH7 |
This allows a microcontroller to control several signals while using fewer dedicated pins.
Multiplexer vs Demultiplexer
| Feature | Multiplexer | Demultiplexer |
|---|---|---|
| Function | Selects one of many inputs | Selects one of many outputs |
| Signal flow | Many → One | One → Many |
| Common name | MUX | DEMUX |
| Select lines | Control which input is selected | Control which output is selected |
| Example | 8 sensors → 1 Arduino input | 1 signal → 8 destinations |
| Applications | Data acquisition, sensor selection | Signal routing, communication |
Types of Multiplexers
Multiplexers can be classified according to the type of signal they switch.
1. Digital Multiplexer
A digital MUX switches binary signals between digital inputs and outputs.
Applications include:
- Digital data routing
- Processor systems
- Communication circuits
- Logic circuits
2. Analog Multiplexer
An analog MUX switches analog voltages between multiple channels.
Applications include:
- Sensor data acquisition
- Audio switching
- Measurement systems
- ADC input expansion
The CD4051 and 74HC4067 are examples of analog switching devices that can also be used for digital signal routing within their electrical limits.
Applications of Multiplexers and Demultiplexers
Multiplexers and demultiplexers are used wherever multiple signals need to share a limited number of connections.
Common applications include:
- Sensor data acquisition
- Arduino and microcontroller projects
- Communication systems
- Digital logic circuits
- Data routing
- Audio signal selection
- Industrial measurement systems
- Memory and processor systems
- Display control
- I/O expansion
One particularly useful application for hobby electronics is expanding the number of analog signals that an Arduino can measure.
Using a CD4051 to Expand Arduino Analog Inputs
The CD4051 is an 8:1 analog multiplexer. It provides eight selectable analog channels and uses three select inputs to choose the active channel. TI specifies the CD4051B as an 8:1 analog MUX with a single-channel signal path and a wide supply range.
Instead of connecting eight sensors directly to eight Arduino analog inputs, you can connect them to the eight CD4051 channels and use one Arduino analog input to read them sequentially.
Basic arrangement
Sensor 0 ──> CH0
Sensor 1 ──> CH1
Sensor 2 ──> CH2
Sensor 3 ──> CH3
Sensor 4 ──> CH4
Sensor 5 ──> CH5 CD4051
Sensor 6 ──> CH6
Sensor 7 ──> CH7
│
└──> COM ──> Arduino A0
Arduino D2 ──> S0
Arduino D3 ──> S1
Arduino D4 ──> S2
The Arduino changes S0, S1 and S2 to select a sensor, then reads the common output using A0.
CD4051 Arduino wiring
| CD4051 | Arduino |
|---|---|
| VCC/VDD | 5V |
| VSS | GND |
| INH/EN | GND |
| S0 | D2 |
| S1 | D3 |
| S2 | D4 |
| Common I/O | A0 |
| CH0–CH7 | Sensor outputs |
Important: exact pin numbers depend on the particular CD4051 package/module, so use the manufacturer's pinout when wiring the physical IC.
Arduino Code for CD4051
The following example reads all eight channels sequentially:
const int S0 = 2;
const int S1 = 3;
const int S2 = 4;
const int SIG = A0;
void setup() {
pinMode(S0, OUTPUT);
pinMode(S1, OUTPUT);
pinMode(S2, OUTPUT);
Serial.begin(9600);
}
void selectChannel(int channel) {
digitalWrite(S0, channel & 0x01);
digitalWrite(S1, (channel >> 1) & 0x01);
digitalWrite(S2, (channel >> 2) & 0x01);
}
void loop() {
for (int channel = 0; channel < 8; channel++) {
selectChannel(channel);
delayMicroseconds(10);
int value = analogRead(SIG);
Serial.print("CH");
Serial.print(channel);
Serial.print(": ");
Serial.println(value);
}
delay(100);
}
The channel & operations convert the channel number into the three binary select signals.
For example:
Channel 5 = binary 101
S2 = 1
S1 = 0
S0 = 1
The Arduino then reads the selected channel through A0.
On boards using a 10-bit ADC, analogRead() returns values from 0 to 1023 by default. The actual voltage range depends on the board's analog reference and input specifications.
Using a 74HC4067 to Read 16 Sensors
If eight channels are not enough, a 74HC4067 provides 16 independently selectable channels.
It uses four select inputs:
- S0
- S1
- S2
- S3
It also has a common signal connection and an enable input. Nexperia specifies the 74HC4067 as a 16-channel analog multiplexer/demultiplexer with four digital select inputs and 16 signal channels.
Basic wiring
Sensor 0 ──> C0
Sensor 1 ──> C1
Sensor 2 ──> C2
...
Sensor 15 ──> C15
74HC4067
│
Z ─────> Arduino A0
Arduino D2 ───────> S0
Arduino D3 ───────> S1
Arduino D4 ───────> S2
Arduino D5 ───────> S3
Typical module labels may use SIG, COM, Z, or similar terminology for the common signal connection, so check the module's documentation.
Arduino Code
const int S0 = 2;
const int S1 = 3;
const int S2 = 4;
const int S3 = 5;
const int SIG = A0;
void setup() {
pinMode(S0, OUTPUT);
pinMode(S1, OUTPUT);
pinMode(S2, OUTPUT);
pinMode(S3, OUTPUT);
Serial.begin(9600);
}
void selectChannel(int channel) {
digitalWrite(S0, channel & 0x01);
digitalWrite(S1, (channel >> 1) & 0x01);
digitalWrite(S2, (channel >> 2) & 0x01);
digitalWrite(S3, (channel >> 3) & 0x01);
}
void loop() {
for (int channel = 0; channel < 16; channel++) {
selectChannel(channel);
delayMicroseconds(10);
int value = analogRead(SIG);
Serial.print("CH");
Serial.print(channel);
Serial.print(": ");
Serial.println(value);
}
delay(100);
}
The 74HC4067 operates as an electronic switch rather than providing 16 additional ADCs. All channels share the common signal path, and the Arduino reads whichever channel is currently selected.
CD4051 vs 74HC4067
| Feature | CD4051 | 74HC4067 |
|---|---|---|
| Channels | 8 | 16 |
| Select lines | 3 | 4 |
| Common signal | 1 | 1 |
| Typical use | Up to 8 sensors | Up to 16 sensors |
| Arduino analog input used | 1 | 1 |
| Channel selection | Binary | Binary |
| Analog switching | Yes | Yes |
The 74HC4067 therefore doubles the number of channels available through one Arduino analog input compared with an 8-channel CD4051.
Important Considerations When Using Analog Multiplexers
A multiplexer does not behave like an ideal wire. The selected signal passes through an internal electronic switch that has an ON resistance and other electrical characteristics.
For example, TI lists typical ON resistance for the CD4051B, while Nexperia specifies approximately 80 Ω typical ON resistance for the 74HC4067 at 4.5 V.
For accurate analog measurements:
- Keep sensor source impedance appropriate for the ADC.
- Allow a short settling time after changing channels.
- Avoid exceeding the multiplexer or Arduino input voltage limits.
- Check the exact IC/module supply voltage requirements.
- Use a common ground between the Arduino, multiplexer and sensors.
- Consider signal loading and ON resistance for precision measurements.
The CD4051B and 74HC4067 are analog switches, not power switches. They should be used for signals within their specified voltage and current limits.
Multiplexer vs Direct Arduino Connections
Without a multiplexer, eight analog sensors could require eight analog inputs:
Sensor 0 → A0
Sensor 1 → A1
Sensor 2 → A2
...
Sensor 7 → A7
With a CD4051:
8 Sensors → CD4051 → A0
↑
3 Arduino pins
With a 74HC4067:
16 Sensors → 74HC4067 → A0
↑
4 Arduino pins
This is useful when a project has many sensors but only a limited number of available analog inputs.
Common Mistakes
1. Forgetting the common ground
The Arduino, multiplexer and sensor circuits should have an appropriate common reference.
2. Reading immediately after switching
Allow a short settling period before taking a measurement, particularly with high-impedance sensor outputs.
3. Applying excessive voltage
Do not assume that a multiplexer can accept arbitrary analog voltages. Check the exact IC's supply and signal specifications.
4. Treating a MUX as an ADC
A multiplexer only selects and routes the signal. The Arduino's ADC still performs the actual analog-to-digital conversion.
5. Using the wrong module pin labels
Different breakout boards can label the common signal, enable, power and channel pins differently. Always check the module schematic or datasheet.
Key Takeaways
- A multiplexer selects one signal from multiple inputs.
- A demultiplexer routes one signal to a selected output.
- A CD4051 provides 8 selectable channels using 3 select lines.
- A 74HC4067 provides 16 selectable channels using 4 select lines.
- Both can be used to connect multiple sensor signals to a single Arduino analog input.
- The Arduino still performs the ADC conversion; the MUX only selects the channel.
- Allow for settling time and the multiplexer’s electrical characteristics when making accurate analog measurements.
Conclusion
Multiplexers and demultiplexers are fundamental signal-routing circuits, but their usefulness goes beyond digital electronics theory. In an Arduino project, an 8-channel CD4051 or 16-channel 74HC4067 can significantly increase the number of sensor signals that one analog input can handle. This makes them practical for projects such as multi-sensor monitoring, data acquisition and robotics where Arduino I/O is limited.
Excerpt
Frequently Asked Questions
What is a multiplexer?
A multiplexer (MUX) is a circuit that selects one signal from multiple inputs and sends it to a single output. The selection is controlled by select lines. For example, an 8:1 multiplexer has eight inputs, one output, and three select lines.
What is the difference between a multiplexer and a demultiplexer?
A multiplexer routes one selected input to a single output, while a demultiplexer routes one input to one selected output. In simple terms, a MUX works as many-to-one, whereas a DEMUX works as one-to-many signal routing.
What is a 4:1 multiplexer truth table?
A 4:1 multiplexer has four inputs (I0–I3), one output (Y), and two select lines (S1 and S0). The select combination determines which input appears at the output:
S1 S0 Output Y 0 0 I0 0 1 I1 1 0 I2 1 1 I3
How do I expand Arduino analog inputs?
You can use an analog multiplexer such as the CD4051 or 74HC4067. A CD4051 provides eight selectable channels, while a 74HC4067 provides 16. Connect the sensor outputs to the MUX channels, connect its common output to an Arduino analog input, and use digital pins as select lines to choose which sensor to read.
Are decoder and demultiplexer the same?
No, they are similar but not identical. A decoder converts a binary input into a specific output line, while a demultiplexer routes a single data input to one of several outputs using select lines. A demultiplexer can be considered a decoder that includes an additional data input line.
What is a demultiplexer also known as?
A demultiplexer is commonly abbreviated as a DEMUX. It is also widely referred to as a "data distributor" or a "one into many" circuit because its function is to route a single input to multiple possible outputs.
Why is a demultiplexer called a data distributor?
It's called a data distributor because it takes one stream of input data and distributes it to one of many output lines. The select lines on the DEMUX act as an address, choosing which specific output channel will receive the incoming data signal.
Which type of logic circuit is in a demultiplexer?
A demultiplexer is a type of combinational logic circuit. This means its output depends only on the present combination of its inputs (both the data input and the select lines) and not on any previous state or memory.
What is an example of a multiplex?
A common example of multiplexing is found in telecommunication systems. Multiple telephone calls or internet data streams are combined by a multiplexer (MUX) to travel simultaneously over a single fiber-optic cable. This process is often called Time-Division Multiplexing (TDM).
A multiplexer (MUX) is a circuit that selects one signal from multiple inputs and sends it to a single output. The selection is controlled by select lines. For example, an 8:1 multiplexer has eight inputs, one output, and three select lines.
A multiplexer routes one selected input to a single output, while a demultiplexer routes one input to one selected output. In simple terms, a MUX works as many-to-one, whereas a DEMUX works as one-to-many signal routing.
A 4:1 multiplexer has four inputs (I0–I3), one output (Y), and two select lines (S1 and S0). The select combination determines which input appears at the output:
| S1 | S0 | Output Y |
|---|---|---|
| 0 | 0 | I0 |
| 0 | 1 | I1 |
| 1 | 0 | I2 |
| 1 | 1 | I3 |
You can use an analog multiplexer such as the CD4051 or 74HC4067. A CD4051 provides eight selectable channels, while a 74HC4067 provides 16. Connect the sensor outputs to the MUX channels, connect its common output to an Arduino analog input, and use digital pins as select lines to choose which sensor to read.
