CD74HC4067 16-channel multiplexer
Sixteen analog switches with one common pin, on a breakout.
Aliases: 74HC4067, 16-channel analog mux, SparkFun BOB-09056. Four address lines pick which channel is joined to COM, in either direction, so one analog pin reads sixteen knobs or sensors, or one pin drives sixteen outputs in turn.
Pins
| Pin | What it does |
|---|---|
I0 to I15 |
The sixteen channels. |
COM |
The common pin (SIG on some boards). |
S0 to S3 |
The channel address, S0 the least significant bit. |
EN |
Enable, active low: tie it to ground, or high to open every switch. |
VCC, GND |
Supply, 2 to 6 V. |
While it runs
The marker beside the channel joined to COM lights.
Reading it on an Arduino
const uint8_t ADDRESS[4] = {2, 3, 4, 5}; // S0 to S3
int readChannel(uint8_t ch) {
for (uint8_t bit = 0; bit < 4; bit++) digitalWrite(ADDRESS[bit], (ch >> bit) & 1);
delayMicroseconds(50);
return analogRead(A0); // COM on A0
}
What the model gets right
From the TI datasheet:
It is a switch, not a buffer. The chosen channel is joined to COM through the
on-resistance, both ways, so the signal is divided by whatever loads it, as on the
bench.
The on-resistance: 70 ohm typical from 4.5 V up, 100 ohm from 3 V and 160 ohm below.
Every other channel is open, and EN high opens them all. An address line that
is not a clean logic level opens every switch too.
What it does not model
The switching time, break-before-make, charge injection, leakage, the on-resistance's change with the signal voltage, and signals past the supply rails, which a real one clamps.
Common mistakes
Leaving EN unconnected: it floats, and the chip may or may not be enabled. Tie it
to ground.
Reading straight after changing the address: give the switch and the ADC's input a few microseconds to settle.
See it in action
Mux knobs reads three potentiometers on one analog pin. Open it at /templates.