Make your own digital power supply with Arduino
If you want a DC power supply that works well, there are a number of places to buy such a device. If, however, you want to learn how one operates, and perhaps build your own, the video below by YouTuber Electronoobs will show you how to accomplish this feat.
His project uses a transformer to step power down from the 230VAC available in Spain, along with a rectifier to produce DC current, and a capacitor to keep the output steady. An Arduino Nano produces a PWM signal that controls a MOSFET on the buck converter circuit, tuning the output voltage and current as needed based on user inputs.
Details can be found on Electronoobs’ website here, though you’ll want to use extreme caution when dealing with mains power. Also, the design will need to be modified if your country uses something other than 230VAC.