How to replace a potentiometer with a digital solution in a buck feedback loop?
Put the digipot in R1's position. The max normal voltage seen at the FB pin will only be +1.25 volts so a 5 volt device will be fine. However, there might be fault circumstances when this might rise above 5 volts so put a zener diode across that point.
The other end of the digipot will be at 0 volts so this is another advantage. However, a digipot will introduce capacitance that may cause ringing in the regulator's output voltage and this might require you to have a small capacitor across R2 (about 47 pF).
You should also consider that using a digipot as a rheostat has two disadvantages: -
- The end-to-end resistance of the pot isn't accurately defined so there will be a larger error than when using a conventional fixed resistor
- Digipots are much better in terms of temperature stability when operated as a potentiometer rather than a rheostat.
You can dynamically change the output voltage changing the gain of the network (Vfb/Vout) injecting/extracting a small amount of current in the feedback network. If you inject current to the feedback node the output voltage decreases. You can use a DAC and a current source (transistor) to accomplish this.