by hugatry @ hackvlog.com:
Every now and then someone asks on different forums if there is an way to control cheap LM2596 modules with an Arduino or another microcontroller. I decided to demonstrate one solution that might be basic electronics for some, but still many don’t know about.
Those buck converters will change the output voltage to make the feedback pin, connected to the output via a voltage divider, become 1.25V or so. If feedback is higher, output gets lower and vice versa. If one changes the ratio of resistors in voltage divider, output voltage will change. This is usually done by turning a trimmer resistor with a screwdriver. That is good enough for many applications where voltage will be set only once, but sometimes there is a need to adjust the output voltage more frequently.
How to control LM2596 buck-converter with microcontroller – [Link]