CD4051 8-Channel Analog Mux with an Arduino Uno

The CD4051 is an 8-channel analog multiplexer that lets one analog pin read eight sensors, or one output reach eight loads.

CD4051 8-Channel Analog Mux, The CD4051 is an 8-channel analog multiplexer that lets one analog pin read eight sensors, or one output reach eight loads.
In short

Powered from the Arduino Uno's 5V, the CD4051 needs 3.5 V on its select pins to see a high, which the Uno's 5 V outputs on D2, D3 and D4 provide directly. Its common pin goes to A0, turning one of the Uno's six analog inputs into eight.

Wiring the CD4051 8-Channel Analog Mux to the Arduino Uno

Pin by pin.

CD4051 8-Channel Analog MuxArduino Uno
VDD5V
VSSGND
VEEGND
INHGND
AD2
BD3
CD4
COMA0

What to know on the Arduino Uno

  • At VDD = 5 V the select inputs need at least 3.5 V for a high. The Uno drives 5 V, so it can select channels directly; a 3.3 V board could not with the mux on 5 V.TI CD4051B datasheet SCHS047O, p. 8
  • The ATmega328P's ADC is designed for sources of about 10 kΩ or less. The mux adds 470 Ω typical (1050 Ω max) at 5 V in series, so 10 kΩ potentiometers stay within that; higher-impedance sources need a slower read or a buffer.TI CD4051B datasheet SCHS047O, p. 6; Microchip ATmega328P datasheet DS40002061B, ADC section
  • Address to signal takes 720 ns at most at 5 V. The sketch waits 10 µs after setting the select pins, which also lets the Uno's sample-and-hold settle to the new channel before analogRead().TI CD4051B datasheet SCHS047O, p. 8
  • Every channel must stay between GND and the mux's 5 V supply, which is also the Uno's ADC range. A second CD4051 on A1 sharing D2 to D4 gives 16 inputs from four Uno pins.TI CD4051B datasheet SCHS047O, p. 19

CD4051 8-Channel Analog Mux code for the Arduino Uno

Compiled for arduino:avr:uno on 2026-10-29.

No library needed
// CD4051 8-Channel Analog Mux on Arduino Uno: wiring and a free simulation at https://www.tinkered.ai/components/cd4051-multiplexer/arduino-uno
#include <Arduino.h>

const int SEL_A = 2;
const int SEL_B = 3;
const int SEL_C = 4;
const int MUX_COM = A0;

int readChannel(int ch) {
  digitalWrite(SEL_A, ch & 1);
  digitalWrite(SEL_B, (ch >> 1) & 1);
  digitalWrite(SEL_C, (ch >> 2) & 1);
  delayMicroseconds(10);   // the switch settles (about 0.5 µs at 5 V)
  return analogRead(MUX_COM);
}

void setup() {
  Serial.begin(115200);
  pinMode(SEL_A, OUTPUT);
  pinMode(SEL_B, OUTPUT);
  pinMode(SEL_C, OUTPUT);
}

void loop() {
  Serial.print("pot 1: ");
  Serial.print(readChannel(0));
  Serial.print("  pot 2: ");
  Serial.println(readChannel(1));
  delay(200);
}

CD4051 8-Channel Analog Mux on the Arduino Uno: questions

Can I use a CD4051 with an Arduino Uno to read more analog inputs?

Yes. Power it from the Uno's 5V, drive A, B and C from three digital pins and read COM on an analog pin: each CD4051 turns one Uno analog input into eight.

Do the CD4051 select pins work with the Uno's 5 V logic?

Yes. With the mux on 5 V, a select high needs 3.5 V minimum (TI datasheet, p. 8), and the Uno drives its pins to 5 V.

Why are my CD4051 readings on the Uno mixed up between channels?

The ADC needs a moment after the channel changes. Wait a few microseconds after setting A, B and C, as the sketch does with delayMicroseconds(10), and keep source impedance around 10 kΩ or less; you can also discard the first analogRead() after a switch.

For AI assistants

This guide as plain Markdown. /components/cd4051-multiplexer/arduino-uno.md

What will you build with it?