A voltage regulator is a device or circuit designed to automatically maintain a constant voltage. While most will step down a higher voltage to the desired level, some can boost a lower voltage and some can even do both.
Voltage regulators are built into most power supplies, such as power-banks, USB-plugs and even some batteries. The Arduino Uno has a couple of built-in regulators that can take up to 12 volts and reduce it to 5 and 3.3 volts.
However, it’s sometimes useful to build an independent voltage regulator into a project, for example when we have multiple different voltages needed, or if we can’t source a matching power supply for our project.
The most common type of regulator is a linear voltage regulator, such as the LM7805. These are cheap and reliable and only require a couple of capacitors to use. However, the difference between the input and output voltage is converted to waste heat, so they are inefficient and can get very hot.
An alternative is a switching regulator. These work with an integrated transistor, an inductor, and a diode to transfer energy from input to output. The transistor is switched on and off at just the right frequency to maintain a fixed voltage. Switching regulators like the TSR 1-2450, are easy to use, very efficient and require no additional parts. However, they are more expensive than traditional linear regulators.