A voltage regulator is a component that converts a voltage to a lower (or higher) level.

A typical example is if you want to use a 9V battery, but need 5V in the circuit. For example, create a portable USB charger. You can then use a voltage regulator that takes 9V as input and creates a regulated 5V output to use in your circuit.

Or if the circuit you're building requires a different voltage level. Suppose you have a circuit where the microcontroller needs 5V and the motor needs 12V. Instead of using two supplies, you could just use one 12V supply and add a regulator that supplies 5V to the microcontroller.


How to connect the voltage regulator


Usually you need to connect some extra components to the regulator to make the output more stable. at least one or two capacitors. But it depends on which regulator you choose. You can find information on how to connect a specific regulator in its datasheet.

For example, the voltage regulator 7805 is a common one. It gives you 5V output.


There are two common types of voltage regulators worth knowing about:

Linear Regulator

DC-DC switching regulator


Linear regulators are the simplest regulators, requiring only a few capacitors and maybe a resistor or two to work.

Examples of linear regulators include the 7805 and LM317 with adjustable output voltage.


DC-DC switching regulators are a little more complicated and require inductors and diodes to work. A more common example is the LM2596. But usually you can find these as small modules (look for DC-DC converters) that have everything you need on the board.


The main difference between the two is that linear regulators waste more power than switching regulators. So linear regulators can easily get very warm if you don't provide good cooling.

Also, switching regulators are the only ones that can give you a higher output voltage than what you put in. A linear regulator will always give you a lower output voltage.


How Linear Regulators Work


The output will always be the diode's zener voltage minus the transistor's voltage. V is typically around 0.6V to 0.7V. So with a 5.6V zener, the output will go to around 5V.

If the output voltage exceeds 5V, it means that V is going low. This will cause the transistor to drop the current, causing the voltage to drop again. The opposite happens if the output is below 5V.


How a Switching Regulator Works


The other main type is the switching regulator. This is a voltage regulator that turns the input voltage on and off and uses some smart circuit tricks with inductors to convert the voltage in a more energy efficient way.

There are mainly 3 types:

Buck Converters – Converts to Lower Voltages

Boost Converter – Converts to higher voltages

Buck-Boost Converters – Converts to Lower and Higher Voltages

Here are the basic concepts of a buck converter:

When the switch is pressed, current flows from the battery into the inductor, capacitor and load. Both the inductor and capacitor are charged. When the switch is released, the energy stored in the inductor and capacitor supplies current to the load.

In real life, switches are replaced by transistors. And there is a detection mechanism that checks the output voltage and turns the transistor on and off faster (for higher voltage) or slower (for lower voltage).