Digitally controlled buck converter.

Sorry if in the wrong forum but still in the planning stage in my head so guessed it would go here.

I would like to build a digitally controlled buck converter as it will help me to understand a few things I've not used yet. And wondered if someone could throw their 2 cents in on my idea.

If I'm correct in my understanding, buck converters work with a voltage divider on the feedback pin, can I replace the voltage divider with a digital pot controlled with an Arduino??

I've read a couple of times that you shouldn't set the voltage on a buck without a load connected. First of all, I must have dodged a few bullets cos I've always done it that way. Second, I've never used a rotary encoder, can you use them in a way that 'home' is wherever you want it to be. So say I'm using the buck on something, had set the voltage, now want to change the voltage for a new device. If I was using an analog pot to control the voltage I'd have to reset back to home after turning it off, but I want to be lazy and not have to do that. When I switch the buck on once the second device is connected, can I take that old position as the new 0 and go from there.

Many thanks
Iain

Buck converters usually rely on a specific chip producing a pulse; those are to be regulated. But there are many different such chips, which all may work slightly different. So without going into specifics (the actual chip used, the rest of the circuit) nothing sensible can be said about your digital control attempts.

The chip I am thinking I would like to use is the XL4016.
Datasheet

Many Thanks
Iain

Most digital pot only operate with 5V, you need to get digital pot that able to operate more than 40V.

Please read this post
Replacing the potentiometer on LM2596S with a digital pot?