Three-Wire Digitally Controlled Potentiometer driver for ESP-IDF.
ESP32 has two 8-bit DAC (digital to analog converter) channels, connected to GPIO25 (Channel 1) and GPIO26 (Channel 2).
However, the maximum voltage is up to VDD.
If you control a voltage up to 5V, you can use this.
And ESP32Sx/ESP32Cx core does not have a DAC function.
- X9C102 = 1kOhms
- X9C103 = 10kOhms
- X9C503 = 50kOhms
- X9C104 = 100kOhms
I ported from here.
git clone https://github.com/nopnop2002/esp-idf-x9c103
cd esp-idf-x9c103
idf.py menuconfig
idf.py flash
Circuit | X9C | ESP32 | ESP32-S2/S3 | ESP32-C2/C3/C6/H2 | |
---|---|---|---|---|---|
INC | -- | GPIO33 | GPIO38 | GPIO3 | |
U/D | -- | GPIO32 | GPIO33 | GPIO4 | |
High terminals | Vh/Rh | -- | |||
Vss | -- | GND | GND | GND | |
Wiper terminals | Vw/Rw | -- | |||
Low terminals | Vl/Rl | -- | |||
CS | -- | GPIO5 | GPIO34 | GPIO5 | |
Vcc | -- | 5V | 5V | 5V |
You can change it to any pin using menuconfig.
If you connect to Low terminals = Gnd and High terminals = 5V, 0 to 5V is output to Wiper terminals in 99 steps.
See here.