My modelling projects involving electrical components require a certain voltage value which invariably differs from whatever power supply I happen to have on hand. For example, the Arduino microcontrollers I use require 5 volts of regulated power if they are powered directly to their 5-volt inputs.
Over the years I have made my own voltage regulator circuits but always run up against the issue of wasted heat which needs to be drawn away from the voltage regulator using a heat sink and, even then, I worry about the potential fire hazard.
Not long ago I was listening to an episode on Larry Puckett's YouTube channel called Model Railroading With The DCC Guy. Larry makes frequent posts on a variety of topics, most of them electronic, and does a good job of explaining everything in layman's terms.
Larry's episode 120 covered the use of buck converters. These are little circuit boards that convert one DC voltage to another. The desired voltage is set using an onboard potentiometer which is turned with a small screwdriver. I ordered a batch of 10 from Amazon for C$19.99 and free shipping, so the per-item cost was C$2.00.
As you can see this one will use any DC voltage from 3V to 40V and reduce it to 1.5V to 30V. and it can handle up to 3 amps which is more than enough for most of our projects.
Here is a picture of one hooked up to a 9-volt battery. The voltage has been adjusted to 5 volts. The adjustment is very precise and allows for adjustments of 1/100 of a volt which is more precise than what I need. To run Arduinos on my model railroad I will be powering these from the 12 volt DC regulated power supply that is present under all of my benchwork. When connected to an Arduino these buck converters product no heat detectable by my finger.
From my search of Amazon and eBay it is clear that these can be purchased in many different configurations including those that can boost voltage.