CD4051 8-Channel Analog Mux Scanner

Three GPIOs scan eight analog inputs through a CD4051. One ADC reads them all, one channel at a time.

Difficulty: Breadboard. Estimated build time: about 30 minutes. Estimated parts cost: about US$1.80. 7-line bill of materials. Compare supplier offers when available. A bidirectional 8-channel analog multiplexer driven by three address lines.

Power and address the mux

Wire VDD (pin 16) to 5 V and VSS + VEE (pins 8 and 7) to GND — the VEE pin sets the lower analog rail and for single-supply 5 V operation it ties to GND. Connect the INH pin (6) to GND so the mux is enabled. Wire A/B/C (pins 11, 10, 9) to Arduino digital pins 2, 3, 4. These are your address lines: A=LSB, C=MSB. Code 000 selects Y0, 111 selects Y7.

Hook up the eight channel signals

Pin Y0 (13), Y1 (14), Y2 (15), Y3 (12), Y4 (1), Y5 (5), Y6 (2), Y7 (4) are the channel pins. Connect Y0 to a 10 kΩ + LDR voltage divider midpoint (light sensor). Y1 to a 10 kΩ potentiometer wiper. Y2 to a 10 kΩ + NTC thermistor divider. Y3 directly to a battery+ terminal through a 100 kΩ / 10 kΩ divider (10x attenuator so a 12 V battery reads as 1.09 V). Leave Y4–Y7 connected to four header pins for future expansion.

Read the common pin

Connect the COM pin (3) to Arduino A0. This is the single ADC pin that will see all eight channels in sequence. Add a 0.1 µF decoupling cap between VDD and GND right at the chip.

Scan and print all eight

In loop(), iterate channel 0–7. For each, write the three address bits with digitalWrite(2, ch & 1); digitalWrite(3, ch & 2); digitalWrite(4, ch & 4); delayMicroseconds(2); then analogRead(A0). Print the results with channel labels. Wave your hand over the LDR, turn the pot, breathe on the thermistor — you should see channels 0, 1, 2 respond independently.