control output of dc-dc buck converter module using external voltage (or pwm)

Say I have an buck dc-dc module, like this one (photo for posterity)

The potentiometer controls the output voltage. I want to replace that pot so I can control the buck's output voltage digitally. I don't want to build my own buck converter - I want to mod this one. I'm not an electronics guru but I'm not an idiot either (famous last words?).

Say I have an external voltage source. Can I use that instead of the pot to control the buck's output? I imagine the pot is just a variable voltage divider, so would it be a simple matter of measuring the range of voltages at the pot, and then simply supplying that range from an external source? How stable does this voltage need to be?

What I actually want to do in the end is control the buck's output voltage using the duty cycle of a pwm signal - I can convert this to a variable analog voltage via an opamp circuit.

p.s. I know I could use a digital pot but I'd like to avoid that for the moment.

Technically you could use PWM with filtering or a proper DAC to supply the feedback voltage into the Xl4015 SMPS IC.

The issue is that the FB pin wants to see 1.25V. If the voltage is lower here, it will up the duty cycle and make the output voltage higher, and vice versa. If you just supply a fixed voltage here, there would be no feedback or regulation.

You could have the Arduino measure the output voltage and control the SMPS IC from the readings.

Remember that the pot is a voltage divider on the output of the IC, not the input.

// Per.

Thanks for the reply. So should it work if I was to supply a voltage from an opamp (i.e. assumed stable voltage)?

The Xl4015 won't care where the voltage is from, but it needs to be in relation to the output volage or it will track the supply voltage.

// Per.

You're right. Any pointers on cheap (perhaps opamp based) circuit that I can build to replace the pot and have it controlled externally by either pwm or some external voltage?

Easy and cheap: A digital pot.

// Per.

I knew you'd say that! I mentioned a digital pot in my p.s. in the 1st post too ... the ones I found at Farnell aren't cheap, or they required non-negligible amounts of extra hassle in terms of circuitry and programming (most seem to require I have an SPI controller available to drive it ...).

Appreciate the answers so far, many thanks.