# Power

In this tutorial we cover the following topics

Before we start: electricity - what is it?

Every time we want to learn something, it is faster and better for us when we can relate all new concept to something we know well from our real life experience. Such an analogy, when basic concepts of electricity are concerned, is a water.

Imagine a pipe interconnecting two identical reservoirs filled with some amount of water. Additionaly somewhere in a pipe a paddle wheel is mounted to make our observations easier.

If water level in both reservoirs is the same, no water flow in our pipe can be observed and a paddle wheel stays motionless. Our obserwation is that despite we have a conductor (pipe) and something inside it (water) which can power our device (move a paddle wheels) nothing happens. The same is with electricity. We have a conductor, like a copper wire, and something inside it (electrons) which can power our device (LED) but nothing happens. The reason for this is that presence of electrons is not enough to power a device as presence of water is not enough to move paddle wheel.

To move our paddle wheel, we have to generate a water flow in a pipe. A simplest option is to fill one of the reservoirs while make second empty.

Todo (id=no todo id): anim electricity_water_flow_moving_paddle_wheel_wyrownywanie_poziomow
In a copper wire all electrons moves chaotically, so in total all displacements cancels each others. In other words, there is no ordered movement of electrons. To change this, as we do in a water analogy, we have to fill with electrons one side (negative side) of a wire while make second side scarce of electrons (positive side). Then electrons will move from negative side to positive and power our device (LED). A tool we can use to make one side negative while second positive is a battery.

Todo (id=no todo id): anim electricity_electrons_flow_making_led_emiting_light

As we can see from preceding material, a real current flow direction is from negative side (minus) to positive (plus). In practise we consider a virtual flow of a positive particle from plus to minus. It doesn't matter which one we prefer as long as we are consequent.

Todo (id=no todo id): improve image quality

The flow of current that we get from a battery is known as direct current, or DC. Like the flow of water from a faucet, it is a steady stream that flows in one direction.

The flow of current that we get from the power outlet in our home is very different. The “active” side of the outlet changes from positive to negative, relative to the “neutral” side, at some rate each second (typically 50 or 60). This is known as alternating current, or AC.

Let's start: fixed linear voltage regulator

Let's start from... No, not from the beginning. We have to start from quit complicated electronic circuit (if you would build it from scratch). We will not dive into details of it, but we need it for our further experiments. Why? The answer is simple: for simplicity and our convenience. During our tutorials we will build many circuits and we can power them with different batteries: 4.5V, 5V, 6V, 9V, 12V etc. Imagine that on my tutorials I use 12V powers source but you have only one 9V battery. This could be a problem, because all components' values like resistance, capacity etc woud be for you useless force you to recalculate all of them.

On the other side, most of microcontrollers components are powered with 3.3V or 5V. That is why I made a decision to start from circuit which as input takes almost any power source but as output generates every time 3.3V (or 5V). This type of circuits is called voltage regulator. So if you have 3.3V or 5V power adapter you can use it, if not - you have to build this circuit and use it in all of our experiments.

At this point we can say

A voltage regulator is designed to automatically maintain a constant voltage level.

We will use one of many different types: a fixed linear voltage regulator.

Using linear voltage regulator you have to take into accout that all of them require an input voltage at least some minimum amount higher than the desired output voltage. That minimum amount is called the dropout voltage. For example, a common regulator such as the 7805 has an output voltage of 5V, but can only maintain this if the input voltage remains above about 7V. Its dropout voltage is therefore 7V − 5V = 2V. When the supply voltage is less than about 2V above the desired output voltage, so-called low dropout regulators (LDOs) must be used.

As a rule of thumb we have to remember that for linear voltage regulator the input voltage must always be higher than the output voltage by some minimum amount. This ,,amount'' depends on type of regulator: if is it LOD or not. Please try to find information about dropout voltage in datasheet of some regulators (see further). For example in LDO 3,3V LF33CV datasheet we can find 0.7V while in 5V L7805CV we have 2.5V.

Because LODs seems to be better than non LODs regulators we can ask why we care about non LODs regulators. The answer is simple: because of money - see table below.

Type Max. current [A] Dropout voltage [V] Price [PLN]
LDO 3,3V LM1117T 0.8 1.2 3.90
LDO 3,3V LD1117T 0.8 1.2 2.50
LDO 3,3V LF33CV 0.5 0.7 2.90
5V L7805CV 1.5 2.5 0.90
5V L7805AVB 1 2.5 0.80
LDO 5V LM1117T 0.8 1.4 4.50

Sometimes prices will be given in PLN which is the currency of Poland where I live. The currency we use doesn't matter - the ratio of two product is important. For example from the above table we can see that LDO 5V LM1117T which costs 4.50PLN is 5.625 times more expensive compared to 5V L7805AVB which costs 0.80PLN. The ratio stays, more or less, constant for different currencies.

In this type regulator design, the input current required is always the same as the output current. As the input voltage must always be higher than the output voltage, this means that the total power (voltage multiplied by current - see formula below) going into regulator will be more than the output power provided. The difference is dissipated as heat. This means both that for some applications an adequate heatsink must be provided, and also that a (often substantial) portion of the input power is wasted during the process, rendering them less efficient than some other types of power supplies. We may preffere buck converters (see further) over linear regulators because they are more efficient and do not require heat sinks, but they are more expensive.

An equation to calculate the powe we waste as a heat is as follow
$$P=(V_{in}-V_{out})I$$
where

• $V_{in}$ - input voltage,
• $V_{out}$ - output voltage,
• $I$ - current.

Simple linear regulators may only contain a Zener diode and a series resistor; more complicated regulators include separate stages of voltage reference, error amplifier and power pass element. Because a linear voltage regulator is a common element of many devices, integrated circuit regulators, as discussed abowe, are very common.

Examples of fixed linear voltage regulator

Let's take a closer look at some exemplary fixed linear voltage regulator
LDO 3.3V LF33CV

LFxx datasheet

Applications: application (test) circuit

Todo (id=no todo id): add fritzing shemas and photos

LDO 3.3V LD1117T

LD1117 datasheet (LM1117 datasheet )
(they are pretty much the same, just versions from different manufacturers: LM - National Semiconductor, LD - SGS-Thomson Eicroelectronics)

Applications: application (test) circuit

Applications: circuit for increasing output voltage (adjusting output of fixed regulators)

 1 Ohm 3.35V 27 Ohm 3.48V 180 Ohm 4.3V 220 Ohm 4.5V 330 Ohm 5V 560 Ohm 6.4V 750 Ohm 7.3V 1 kOhm 11.6V

Applications: battery backed-up regulated supply

LDO 5V LM1117T

LD1117 datasheet (LM1117 datasheet )
(they are pretty much the same, just versions from different manufacturers: LM - National Semiconductor, LD - SGS-Thomson Eicroelectronics)

Applications: application (test) circuit

Applications: circuit for increasing output voltage (adjusting output of fixed regulators)

Applications: battery backed-up regulated supply

5V L7805ABV

Lx780x datasheet
Applications: application (test) circuit

Applications: circuit for increasing output voltage (adjusting output of fixed regulators)

Applications: light controllers

Please pay an attention to pinouts (connections) and check it twice befor use if you don't want to damage your regulator. Compare for example pinouts for LDO 3.3V LF33CV and LDO 5V LD1117T.

Switching converters

When the output regulated voltage must be higher than the available input voltage, no linear regulator will work. In this situation, something like a switched-mode power supply. Switching converters provide much greater power efficiency as DC-to-DC converters than linear regulators, which are simpler circuits and waste some amount of power as heat.

We have two main types of switching converters

1. A boost converter (step-up converter) is a DC-to-DC power converter that steps up voltage (while stepping down current) from its input (supply) to its output (load).
2. A buck converter (step-down converter) is a DC-to-DC power converter which steps down voltage (while stepping up current) from its input (supply) to its output (load).

The most basic converters of this type costs about 10-15PLN which is 3-5 times more expensive than linear regulator.

We will not discuss this topic here. Todo (id=power:step-up converter): Describe switching (step-up/step-down) converter