AD keyboard (5 keys on one analog pin) with ESP32
Supply 3.3-5 V
Bus ANALOG
Pins and ESP32 wiring
| Pin | Role | ESP32 pin | Notes |
|---|---|---|---|
| GND | Ground | GND | |
| VCC | Power | 3V3 | Use 3V3 so OUT never goes above 3.3 V |
| OUT | Analog output | D34 | A different voltage for each key: read it on an ADC1 pin (GPIO 32 to 39) |
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); // OUT on GPIO 34
Serial.println(mv);
delay(200);
}
Sources
- DFRobot ADKeyboard module (DFR0075) wiki, Resistor ladder: each key gives a different analog value
- Espressif ESP-IDF Programming Guide, ADC: input range and attenuation
Try it in 3D in BoardPilot
Related parts
Part data: CC BY 4.0, free to reuse with credit to BoardPilot.