CD74HC4067 16-channel analog multiplexer with ESP32
Supply 3.3-5 V
Bus ANALOG
Pins and ESP32 wiring
| Pin | Role | ESP32 pin | Notes |
|---|---|---|---|
| SIG | Analog output | D34 | Common signal: to an ADC1 pin (GPIO 32 to 39) |
| S3 | Input (the ESP32 drives it) | D25 | Channel select bit 3 |
| S2 | Input (the ESP32 drives it) | D26 | Channel select bit 2 |
| S1 | Input (the ESP32 drives it) | D27 | Channel select bit 1 |
| S0 | Input (the ESP32 drives it) | D32 | Channel select bit 0 |
| EN | Not wired to the ESP32 | — | Enable, active LOW. Tie to GND |
| VCC | Power | 3V3 | Use 3.3 V so no channel goes above 3.3 V |
| GND | Ground | GND | |
| C0 | Not wired to the ESP32 | — | Channel 0: to a sensor or button, not to the ESP32 |
| C1 | Not wired to the ESP32 | — | |
| C2 | Not wired to the ESP32 | — | |
| C3 | Not wired to the ESP32 | — | |
| C4 | Not wired to the ESP32 | — | |
| C5 | Not wired to the ESP32 | — | |
| C6 | Not wired to the ESP32 | — | |
| C7 | Not wired to the ESP32 | — | |
| C8 | Not wired to the ESP32 | — | |
| C9 | Not wired to the ESP32 | — | |
| C10 | Not wired to the ESP32 | — | |
| C11 | Not wired to the ESP32 | — | |
| C12 | Not wired to the ESP32 | — | |
| C13 | Not wired to the ESP32 | — | |
| C14 | Not wired to the ESP32 | — | |
| C15 | Not wired to the ESP32 | — |
Suggested wiring for the 30-pin ESP32 DevKit, avoiding flash, input-only and strapping pins. BoardPilot checks it for you as you wire.
Starter code (Arduino)
void setup() { Serial.begin(115200); }
void loop() {
int mv = analogReadMilliVolts(34); // SIG on GPIO 34
Serial.println(mv);
delay(200);
}
Sources
- Texas Instruments CD74HC4067 datasheet, Truth table S0 to S3 and E; supply 2 to 6 V
- SparkFun Analog/Digital MUX breakout (BOB-09056), Header SIG, S3, S2, S1, S0, EN, VCC, GND and C0 to C15
Try it in 3D in BoardPilot
Part data: CC BY 4.0, free to reuse with credit to BoardPilot.