I have an old radio and I am trying to replace its manual volume control by a digital one. I have desoldered/removed the potentiometer. I would like to use an ESP32 connected to a digipot (MCP4018) instead. (see figure).
The sketch is working fine and the resistance between the digipot's wiper (pin 5 of MCP4018) and the GND can be controlled. However, I am confused on how to connect this setup to the wholes left from the potentiometer (see attached figure). I tried the wiper in OUT whole but it didn't work. Thank you.
Please keep in mind two things:
1: If your original pot was the volume knob, it was/is an audio taper, which means it's not linear, but exponential. Digital pots are as far as I know almost always linear. You will need to 'fake' the exponential part in the microcontroller (not difficult in itself) but you may run out of useful resolution at the top end of the scale. You'll have to experiment/find out for yourself.
2: Usually digital pots can only handle Vdd + 0.6V or so on any of their pins. If you run this one at 3.3V since your ESP32 also runs at 3.3V, you are limited to 3.8V signal on the input but also the wiper output pin. If you exceed that, you destroy the chip. So you need to know exactly and for sure that the circuit you transplant this chip into will meet this requirement.
Edit: the limit according to the MCP4018 is in fact Vdd+0.3V for the A, W and B pins. So you can't exceed 3.6V if you run the chip at 3.3V.
Remark: the digipot's end-to-end resistance is 10K however the replaced potentiometer's resistance was 50K. This limits the amp's max gain. I will open another topic for discussion.
Great!
The solution to your gain problem is simple: use a 50k pot.
Alternatively you could insert an amplification stage (e.g. a simple opamp buffer) in front of the pot.
If the original pot was a simple signal divider, i.e the signal was coming in to A and going out from W, then 10k vs 50k should make no obvious difference. If however it was in feedback loop of OP amplifier then it matters. Can you give more details on make and model of the radio?
That's not true. It depends on the output impedance of the preceding stage. It may be a high-impedance stage (which is fairly typical if this is a volume control pot!) that has difficulty driving a 10k load. It's likely that using too low a value here will not only influence gain, but also frequency response.
Someone (such as myself ) will then have to report the spurious "new" topic to a moderator to have it moved back and attached to this one in order for it to make any sense.