← All parts
CD4051 8-ch Mux
CD4051B
Texas Instrumentsic logic
The CD4051B is a CMOS single 8-channel analog multiplexer/demultiplexer with logic-level conversion. Three address inputs and an inhibit select one of eight bidirectional channels to a common line.
In stock
Specifications
4- Operating Voltage
- 3 to 20 V
- On Resistance
- 125 ohm
- Operating Temperature Range
- -55 to 125 C
- Package Types
- CDIP, PDIP, SOIC, SOP, TSSOP
Pinout
16| Pin | Name | Functions | Notes |
|---|---|---|---|
| 1 | CH 4 IN/OUT | GPIO | Channel 4 in/out |
| 2 | CH 6 IN/OUT | GPIO | Channel 6 in/out |
| 3 | COM OUT/IN | GPIO | Common out/in |
| 4 | CH 7 IN/OUT | GPIO | Channel 7 in/out |
| 5 | CH 5 IN/OUT | GPIO | Channel 5 in/out |
| 6 | INH | GPIO | Inhibit input, disables all channels |
| 7 | VEE | POWER | Negative power input |
| 8 | VSS | POWERGND | Ground |
| 9 | C | GPIO | Channel select C |
| 10 | B | GPIO | Channel select B |
| 11 | A | GPIO | Channel select A |
| 12 | CH 3 IN/OUT | GPIO | Channel 3 in/out |
| 13 | CH 0 IN/OUT | GPIO | Channel 0 in/out |
| 14 | CH 1 IN/OUT | GPIO | Channel 1 in/out |
| 15 | CH 2 IN/OUT | GPIO | Channel 2 in/out |
| 16 | VDD | POWER | Positive power input |
Interactive pinout
Highlight:
CD4051B
Click a pin to copy its name · tap a tag above to spotlight a bus.
Starter code
Community starter examples — minimal, unofficial, and provided to get you wiring fast. Verify against the manufacturer datasheet before relying on them.
Arduino (C++)
arduino
// CD4051 8-channel analog mux/demux — community starter example
// Select a channel with A/B/C, then read it through the common pin.
#if defined(ESP32)
#define A_PIN 25
#define B_PIN 26
#define C_PIN 27
#define COM_ADC 34 // common -> an ADC input
#else
#define A_PIN 2
#define B_PIN 3
#define C_PIN 4
#define COM_ADC A0
#endif
void selectChannel(uint8_t ch) { // 0..7
digitalWrite(A_PIN, ch & 1);
digitalWrite(B_PIN, (ch >> 1) & 1);
digitalWrite(C_PIN, (ch >> 2) & 1);
}
void setup() {
Serial.begin(115200);
pinMode(A_PIN, OUTPUT); pinMode(B_PIN, OUTPUT); pinMode(C_PIN, OUTPUT);
}
void loop() {
for (uint8_t ch = 0; ch < 8; ch++) {
selectChannel(ch);
delayMicroseconds(50);
Serial.print(analogRead(COM_ADC)); Serial.print(' ');
}
Serial.println();
delay(500);
}MicroPython
python
# CD4051 8-channel analog mux (ESP32) — community starter example
from machine import Pin, ADC
import time
a = Pin(25, Pin.OUT); b = Pin(26, Pin.OUT); c = Pin(27, Pin.OUT)
com = ADC(Pin(34)); com.atten(ADC.ATTN_11DB) # common -> ADC
def select(ch):
a.value(ch & 1); b.value((ch >> 1) & 1); c.value((ch >> 2) & 1)
while True:
vals = []
for ch in range(8):
select(ch); time.sleep_us(50); vals.append(com.read())
print(vals)
time.sleep(0.5)Wiring
| Pin | Arduino Uno R3 | ESP32 DevKitC (WROOM-32) | Notes |
|---|---|---|---|
| VDD | +5V | 3V3 | Analog signals must stay within VEE..VDD |
| VSS | GND | GND | |
| VEE | GND | GND | Tie to GND for single-supply use |
| A | D2 | GPIO25 | Channel select bit 0 |
| B | D3 | GPIO26 | Channel select bit 1 |
| C | D4 | GPIO27 | Channel select bit 2 |
| COM | A0 | GPIO34 | Common -> an ADC input |
| INH | GND | GND | Tie LOW to enable the mux |
Typical uses
- Reading 8 analog sensors through 1 ADC pin
- Routing one signal to 8 outputs (demux)