CD4051 Analog Multiplexer: Pinout and Arduino Wiring

Product Reviews Intermediate 10 min read Published:
CD4051 8-channel analog multiplexer symbol and article title

The CD4051 is a digitally addressed CMOS analog multiplexer/demultiplexer that connects one of eight analog channels to a single common terminal. The three-bit number you apply to the A, B and C address inputs selects which channel turns on; when the INH input is logic 1, every channel turns off. Because the switch is bidirectional, the same IC can gather eight sensors into one ADC input or distribute one signal to eight points. This article covers the pinout, the key datasheet values, an Arduino circuit for reading multiple analog inputs and the differences between two manufacturers’ versions, step by step.

How does the CD4051 work?

Inside the IC are eight bidirectional CMOS switches (transmission gates) and a binary decoder that drives them. The decoder reads the A (least significant bit), B and C inputs and turns on only the switch of the selected channel. For example, if you write C=1, B=0, A=1 (binary 101), channel 5 connects to the common terminal (COM).

The switch behaves like a resistor: when on, it has an “on resistance” (RON) of a few hundred ohms between its terminals; when off, it passes only a very small leakage current (typical values in the pA range, worst-case datasheet values of 50–200 nA at 25 °C). Signal direction does not matter: a voltage applied to a channel pin passes to COM, and a voltage applied to COM passes to the selected channel. This is why the datasheets name the pins “IN/OUT” and “OUT/IN”.

The IC has three supply pins: VDD (positive supply), VSS (logic ground) and VEE (negative supply of the switches). The address and INH inputs are read at logic levels between VDD and VSS, while the analog signal can swing between VEE and VDD. The TI datasheet describes this as “logic-level conversion”. In most single-supply applications, VEE and VSS are tied together to ground.

Truth table

INH C B A Channel on
0 0 0 0 0
0 0 0 1 1
0 0 1 0 2
0 0 1 1 3
0 1 0 0 4
0 1 0 1 5
0 1 1 0 6
0 1 1 1 7
1 x x x None

CD4051 pinout

The CD4051 comes in 16-pin packages (DIP, SOIC, SOP, TSSOP) with the same pinout. The channel pins are not in order: channel 0 is on pin 13 and channel 7 is on pin 4. When drawing a schematic, checking the table below instead of guessing pin numbers prevents mistakes.

CD4051 pinout, top view: 1 channel 4, 2 channel 6, 3 COM, 4 channel 7, 5 channel 5, 6 INH, 7 VEE, 8 VSS, 9 C, 10 B, 11 A, 12 channel 3, 13 channel 0, 14 channel 1, 15 channel 2, 16 VDD
CD4051 pinout (top view). The pin names from the HEF4051B datasheet are given in parentheses.
Pin CD4051B name HEF4051B name Function
1 Channel 4 Y4 Channel in/out
2 Channel 6 Y6 Channel in/out
3 COM OUT/IN Z Common terminal
4 Channel 7 Y7 Channel in/out
5 Channel 5 Y5 Channel in/out
6 INH E (active low) All channels off when 1
7 VEE VEE Negative supply of the switches
8 VSS VSS Ground (0 V)
9 C A2 Address input (most significant bit)
10 B A1 Address input
11 A A0 Address input (least significant bit)
12 Channel 3 Y3 Channel in/out
13 Channel 0 Y0 Channel in/out
14 Channel 1 Y1 Channel in/out
15 Channel 2 Y2 Channel in/out
16 VDD VDD Positive supply

Different manufacturers’ datasheets give the same pins different names. The “E” pin on the HEF4051B does the same job as INH on the CD4051B, despite the different name: when it is logic 1 (HIGH), all switches turn off. The address pins are called A0, A1 and A2; A0 is the least significant bit and corresponds to A on the CD4051B.

Key parameters: values from two manufacturers

The two CD4051 versions in our store have the same pinout, but their datasheet values are not identical. The table below gives each value from its own datasheet under the stated conditions. Do not compare the two columns directly where the conditions differ.

Parameter CD4051BCN (onsemi, Fairchild datasheet) CD4051BM96 (Texas Instruments)
Package 16-PDIP (through hole) 16-SOIC (surface mount)
Absolute maximum supply VDD: −0.5 V … +18 V V+ to V−: −0.5 V … 20 V
Supply range Recommended VDD: 5 V … 15 V Single supply 3 V … 20 V, dual supply ±3 V … ±10 V (features section)
RON typ / max, 25 °C, VDD = 5 V, VEE = 0 V 270 Ω / 1050 Ω 470 Ω / 1050 Ω
RON typ / max, 25 °C, VDD = 10 V, VEE = 0 V 120 Ω / 400 Ω 180 Ω / 400 Ω
RON typ / max, 25 °C, VDD = 15 V, VEE = 0 V 80 Ω / 240 Ω 125 Ω / 240 Ω
RON max, 125 °C, VDD = 5 V 1300 Ω 1300 Ω
RON test load RL = 10 kΩ RL = 100 Ω (condition in the table header)
RON mismatch between channels (typical) 5 Ω (VDD = 15 V) 5 Ω (VDD = 15 V)
Minimum logic 1 input (VIH, 25 °C) 3.5 V (VDD = 5 V) 3.5 V (VDD = 5 V)
Address-to-output delay, VDD = 5 V Typ 500 ns, max 1000 ns (25 °C) Typ 450 ns, max 720 ns
−3 dB bandwidth (VDD = 10 V, RL = 1 kΩ) 40 MHz (typical) 20 MHz (typical)
Common terminal (COM) capacitance 30 pF (VDD = 10 V) 30 pF (VDD = 10 V)

The table teaches two lessons. First, RON increases as the supply voltage drops and as temperature rises: at 25 °C the maximum is 1050 Ω at 5 V and 240 Ω at 15 V; at 5 V it rises to 1300 Ω at 125 °C. Second, typical values vary by manufacturer, but the maximum values at 25 °C are the same in both datasheets. That is why designing to the maximum value, not the typical one, is safer.

Typical application: reading 8 analog sensors with an Arduino

The most common use of the CD4051 is connecting eight analog sources to a microcontroller with few analog inputs. For an Arduino Uno running at 5 V, the connections are:

CD4051 Arduino wiring diagram: A pin 11 to D2, B pin 10 to D3, C pin 9 to D4, COM pin 3 to A0, INH pin 6, VEE pin 7 and VSS pin 8 to ground, VDD pin 16 to +5 V with 0.1 µF decoupling, channel 0 pin 13 to a potentiometer wiper
Circuit for connecting eight analog sources to an Arduino with the CD4051; a potentiometer is drawn on channel 0 as an example. VEE and VSS go to ground, INH goes to ground or to a digital pin.
  1. Supply: VDD (pin 16) to +5 V, VSS (pin 8) and VEE (pin 7) to ground. Place a 0.1 µF capacitor between VDD and ground, close to the pin (the TI datasheet recommends 0.1 µF per supply pin).
  2. Address: A (pin 11) to D2, B (pin 10) to D3, C (pin 9) to D4.
  3. INH: pin 6 to ground. If several ICs will share the same ADC input, connect INH to a digital pin and turn the unused IC off with a 1.
  4. Common terminal: COM (pin 3) to the Arduino’s A0 input.
  5. Sources: the outputs of the sensors or the wipers of the potentiometers to the channel 0–7 pins. Tying unused channels to ground instead of leaving them floating keeps the reading from wandering randomly when that channel is selected.

The read loop is simple: split the channel number into three bits and write them to D2, D3 and D4, wait a few microseconds, then read with analogRead(A0). The reason for the wait is in the calculation below.

Example calculations

1. How much error does the on resistance cause?

The switch adds a series resistance between the source and the load and forms a voltage divider with the load: Vout = Vin × RL / (RL + RON). With the highest RON = 1050 Ω at VDD = 5 V and 25 °C (this value is 1300 Ω at 125 °C):

  • If COM drives a 10 kΩ load or divider: 10 000 / 11 050 = 0.905. About 9.5% of the signal is lost across the switch.
  • If COM drives an op-amp buffer with 1 MΩ input resistance: 1 000 000 / 1 001 050 = 0.99895. The loss drops to about 0.1%. On a 10-bit ADC referenced to 5 V, 1 LSB is 5 V / 1024 ≈ 4.9 mV; a 0.1% loss on a 5 V signal (about 5 mV) stays around 1 LSB in this case.

For this reason, the load behind the CD4051 must be high impedance. If you need to drive a low-impedance load, raising VDD lowers RON (at most 240 Ω at 15 V and 25 °C), or you can use a buffer op-amp after COM. The TI datasheet also states that the IC has no current drive circuitry and that any current through it comes entirely from the source; the absolute maximum input current is ±10 mA per input.

2. How long should you wait after changing channels?

Two delays add up. The first is the address change reaching the output: at a 5 V supply, at most 720 ns (TI) and 1000 ns (Fairchild/onsemi). The second is the capacitance at the COM terminal charging to the new channel voltage. For a sensor with 10 kΩ source resistance, the time constant is about τ = (10 kΩ + 1.05 kΩ) × 30 pF ≈ 0.33 µs. Settling to 10-bit accuracy takes about 8τ (e−8 ≈ 1/2980), which comes to about 2.7 µs. The 30 pF value is the typical value given in the datasheet for VDD = 10 V; the ADC’s own sampling capacitance adds to it. That is why waiting about 10 µs after writing the address, or discarding the first ADC reading after a channel change, is a practical and safe approach.

3. Using it with a 3.3 V microcontroller

With VDD = 5 V, an address input must be at least 3.5 V to count as logic 1. The HIGH output of a 3.3 V microcontroller such as an ESP32 or STM32 stays below this limit, so it cannot reliably drive the address inputs of a CD4051 powered from 5 V directly. There are two solutions: add a level shifter on the address lines, or power the IC from 3.3 V. With the second approach, the single-supply lower limit of the TI version is 3 V (the Fairchild datasheet gives a 5 V lower limit for VDD in its recommended operating conditions, while its features section mentions a 3–15 V range for digital addressing), but neither datasheet gives an RON value for 3.3 V. Based on the trend in the table, the on resistance at this voltage will be higher than the 5 V values; the analog signal is also limited to 0–3.3 V.

Signals below ground: using the VEE pin

If an audio or sensor signal goes below zero, connect VEE to a negative supply. The example in the Fairchild datasheet uses VDD = +5 V, VSS = 0 V and VEE = −5 V; analog signals between −5 V and +5 V are then switched with 0–5 V logic levels. Because the address inputs are read relative to VSS, sharing a common ground with the microcontroller is enough. If you use a negative supply, add a separate 0.1 µF decoupling capacitor on the VEE pin as well. Keep the total difference between VDD and VEE within the datasheet limits: the Fairchild datasheet specifies the analog signal up to VDD − VEE = 15 V (15 V peak-to-peak), while the TI datasheet limits V+ to V− to an absolute maximum of 20 V.

What to watch when selecting and using it

  • Signal limits: According to the TI datasheet, inputs must not be pushed more than 0.5 V above VDD or below VEE, and outputs must not be pulled outside these limits. The analog signal must always stay between VEE and VDD.
  • Package: The CD4051BCN (16-PDIP) suits breadboards and through-hole boards; the CD4051BM96 (16-SOIC) suits production boards.
  • Channel count: For differential (X/Y pair) 4-channel selection, the CD4052B, and for three separate two-way switches, the CD4053B are in the same family and are covered in the same datasheet.
  • Channel switching: TI specifies “break-before-make” behavior, which prevents two channels from being on at the same time during a channel change. The HEF4051B datasheet, on the other hand, recommends using the enable input if this behavior is required. If a short between channels is critical, set INH to 1 during the change.

Common mistakes

  • Leaving the VEE pin floating: VEE is the supply terminal of the switches. It must be connected to ground even in a single-supply circuit.
  • Forgetting INH: A floating CMOS input reads randomly as 0 or 1. If INH reads as 1, no channel turns on and the circuit appears “not working”.
  • Assuming the channel order matches the pin order: Channel 0 is on pin 13, not pin 1. Use the pin table as your reference.
  • Trying to draw current from the IC: The CD4051 is not a driver; it is not suitable for directly powering current-hungry loads such as LEDs or relays.
  • Reading without a delay: A reading taken right after the address changes may come out close to the previous channel’s value.

Frequently asked questions

Are the CD4051 and HEF4051 the same IC?

Both belong to the 8-channel 4051 analog multiplexer family, and their datasheets show the same pinout. The pin names differ (Y0–Y7, Z, A0–A2 and E on the HEF4051B). Because electrical values vary by manufacturer, compare both datasheets before using one in place of the other.

Can the CD4051 carry digital signals?

Yes. The switch does not care whether the signal is analog or digital; it passes any voltage between VEE and VDD in both directions. For fast signals, account for the bandwidth and the delay formed by RON and the load capacitance.

How do I expand to 16 channels?

Connect the COM terminals of two CD4051s to the same ADC input and wire their address lines in parallel. Drive the INH inputs from separate digital pins: while one is 0, the other should be 1. This lets you read 16 channels with five digital pins and one analog input.

What is the INH pin for?

When INH is logic 1, all eight channels turn off regardless of the address inputs. In normal operation it is tied to ground; in circuits where several ICs share the same line, it is used as a chip-select pin.

Conclusion

The CD4051 is a bidirectional multiplexer with a wide supply range that selects one of eight analog channels with three address lines. For it to work correctly, do not skip the VEE and INH connections, keep the load high impedance and allow a short wait after each channel change. Always do your calculations with the maximum RON value from the datasheet.

For breadboard experiments, see the CD4051BCN (16-PDIP) product page; for surface-mount boards, see the CD4051BM96 (16-SOIC) product page. Other options are in the analog switch and multiplexer ICs category. If you want to increase the number of digital outputs, our 74HC595 shift register article complements this topic.

CD4051BCNonsemi · EE01035-3$0.423 In StockView

CD4051BM96Texas Instruments · EE00618$0.3860 In StockView

Sources

Products in this article

More from Product Reviews