© Warren Gay 2018
Warren GayAdvanced Raspberry Pihttps://doi.org/10.1007/978-1-4842-3948-3_3

3. Power

Warren Gay1 
(1)
St. Catharine’s, Ontario, Canada
 

One of the most frequently neglected parts of a system tends to be the power supply—at least when everything is working. Only when things go wrong does the power supply begin to get some scrutiny.

The Raspberry Pi owner needs to give the power supply extra respect. Unlike many AVR class boards, where the raw input voltage is followed by an onboard 5 V regulator, the Pi expects its power to be regulated at the input. The Pi does include onboard regulators, but these regulate to lower voltages (3.3 V and lower).

Figure 3-1 illustrates the rather fragile Micro-USB power input connector. The original model B has a large round capacitor directly behind the connector that is often grabbed for leverage. Avoid doing that, since many have reported “popping it off” by accident.
../images/326071_2_En_3_Chapter/326071_2_En_3_Fig1_HTML.jpg
Figure 3-1

Micro-USB power input

Over the years since the original Model B, other models have been produced without the large capacitor. But they all use the fragile Micro-USB power input like the one in shown in Figure 3-1. Use care and be gentle when inserting the power connector.

Calculating Power

Sometimes power supplies are specified in terms of voltage and power handling capability in watts. The Pi’s input voltage of 5 V must support varying input currents according to the model being used. Table 3-1 summarizes the model power requirement minimums.
Table 3-1

Summary of Raspberry Pi Minimum Power Requirements

Model

Minimum Current

Power

Pi Model B

700 mA

3.5 W

Pi 2 Model B

820 mA

4.1 W

Pi 3 Model B

1.34 A

6.7 W

Pi 3 Model B+

1.13 A

5.65 W

Pi Zero and W

350 mA

1.75 W

Let’s verify a power supply figure for the Raspberry Pi 3 Model B+ in watts (this does not include any added peripherals):
$$ {displaystyle egin{array}{l}P=V	imes I\ {}kern1.5em =kern0.5em 5	imes 1.13\ {}kern1.5em =kern0.5em 5.65Wend{array}} $$
The 5.65 W represents a minimum requirement, so we should overprovision this by an additional 50%:
$$ {displaystyle egin{array}{l}P=5.65	imes 1.50\ {}kern1.5em =8.475Wend{array}} $$

The additional 50% yields a power requirement of approximately 8.5 W.

Tip

Allow 50% extra capacity for your power supply. A power supply gone bad may cause damage or several other problems. One common power-related problem for the Pi is loss of data on the SD card.

Current Requirement

Since the power supply being sought produces one output voltage (5 V), you might see power adapters with advertised current ratings instead of power. In this case, you can simply factor a 50% additional current instead (for the Pi 3 Model B+):
$$ {displaystyle egin{array}{l}{I}_{supply}={I}_{pi}	imes 1.50\ {}kern4.25em =kern0.5em 1.13	imes 1.50\ {}kern4.25em =kern0.5em 1.695Aend{array}} $$
To double-check our work, let’s see whether this agrees with the power rating we computed earlier:
$$ {displaystyle egin{array}{l}P=V	imes I\ {}kern1.5em =kern0.5em 5	imes 1.695\ {}kern1.5em =kern0.5em 8.475Wend{array}} $$
The result agrees. From this evaluation, you can conclude that you minimally need a 5 V supply that produces one of the following:
  • 8.475 W or more

  • 1.695 A or more (ignoring peripherals)

Supplies that can meet either requirement should be sufficient. However, you should be aware that not all advertised ratings are what they seem. Cheap supplies often fail to meet their own claims, so an additional margin must always be factored in.

Peripheral Power

Each additional circuit that draws power, especially USB peripherals, must be considered in a power budget. Depending on its type, a given USB peripheral plugged into a USB 2 port can expect up to 500 mA of current, assuming it can obtain it.

Wireless adapters are known to be power hungry. Don’t forget about the keyboard and mouse when used, since they also add to power consumption. If you’ve attached an RS-232 level shifter circuit (perhaps using MAX232CPE), you should budget for that small amount also in the 3.3 V supply budget. This will indirectly add to your +5 V budget, since the 3.3 V regulator is powered from it. (The USB ports use the +5 V supply.) Anything that draws power from your Raspberry Pi should be tallied.

3.3 Volt Power

The input to the Raspberry Pi is a regulated 5 volts. But the Pi itself depends upon a 3.3 V supply, which is provided by an onboard regulator. The onboard regulators may provide additional lower voltages for other support ICs, depending upon the model. Because the 3.3 V supply is indirectly derived from the input 5 V supply, the maximum excess current for the original Model B that can be drawn from it is 50 mA; the Pi uses up the remaining capacity of the regulator.

When planning a design, you need to budget this 3.3 V supply carefully. Each GPIO output pin draws from this power source an additional 3 to 16 mA, depending on how it is used. Projects that have higher current budgets may need to include their own 3.3 V regulator, fed from the input 5 V input instead.

Powered USB Hubs

If your power budget is stretched by USB peripherals, you may want to consider the use of a powered USB hub. In this way, the hub rather than your Raspberry Pi provides the necessary power to the downstream peripherals.

Not all USB hubs work with (Raspbian) Linux. The kernel needs to cooperate with connected USB hubs, so software support is critical. The following web page lists known working USB hubs:

http://elinux.org/RPi_Powered_USB_Hubs

Power Adapters

For the high current quad core models of the Raspberry Pi, you’ll simply want to purchase a proper adapter. Don’t mess around with cheap or inferior supplies for your high-performance gear.

For the low power Pi’s, like old Model B, the Zero, or Zero W, you might be tempted to try some cheaper solutions. Let's examine some of the options.

An Unsuitable Supply

The example shown in Figure 3-2 was purchased on eBay for $1.18 with free shipping (see the upcoming warning about fakes). For this reason, it is tempting to use it.
../images/326071_2_En_3_Chapter/326071_2_En_3_Fig2_HTML.jpg
Figure 3-2

Model A1265 Apple adapter

This is an adapter/charger with the following ratings:
  • Model: A1265

  • Input: 100–240 VAC

  • Output: 5 V, 1 A

When plugged in, the Raspberry Pi’s power LED immediately lights up, which is a good sign for an adapter (vs. a charger). A fast rise time on the power leads to successful power-on resets. When the voltage was measured, the reading was +4.88 V on the +5 V supply. While not ideal, it is within the range of acceptable voltages. (The voltage should be within 10% of +5 V — 4.75 and 5.25 V.)

The Apple unit seemed to work fairly well when HDMI graphics were not being utilized (using serial console, SSH, or VNC). However, I found that when HDMI was used and the GPU had work to do (move a window across the desktop, for example), the system would tend to seize up. This clearly indicates that the adapter does not fully deliver or regulate well enough.

Caution

Be very careful of counterfeit Apple chargers/adapters. The Raspberry Pi Foundation has seen returned units damaged by these. For a video and further information, see www.raspberrypi.org/archives/2151 .

E-book Adapters

Some people have reported success using e-book power adapters. I have also successfully used a 2 A Kobo charger.

Power Source Quality

While it is possible to buy USB power adapters at low prices, it is wiser to spend more on a high-quality unit. It is not worth trashing your Raspberry Pi or experience random failures for the sake of saving a few dollars.

If you lack an oscilloscope, you won’t be able to check how clean or dirty your supply current is. A better power adapter is cheaper than an oscilloscope. A shaky/noisy power supply can lead to all kinds of obscure and intermittent problems.

A good place to start is to simply Google “recommended power supply Raspberry Pi.” Do your research and include your USB peripherals in the power budget. Remember that wireless USB adapters consume a lot of current—up to 500 mA.

Note

A random Internet survey reveals a range of 330 mA to 480 mA for wireless USB adapter current consumption.

Voltage Test

If you have a DMM (digital multimeter), it is worthwhile to perform a test after powering up the Pi. This is probably the very first thing you should do if you are experiencing problems.

Follow these steps to perform a voltage test (the now standardized 40-pin header strip is assumed for pin numbering):
  1. 1.

    Plug the Raspberry Pi’s Micro-USB port into the power adapter’s USB port.

     
  2. 2.

    Plug in the power adapter.

     
  3. 3.

    Measure the voltage between P1-02 (+5 V) and P1-39 or P1-06 (Ground): expect +4.75 to +5.25 V.

     
  4. 4.

    Measure the voltage between P1-01 (+3.3 V) and P1-39 or P1-06 (Ground): expect +3.135 to +3.465 V.

     

Caution

 Be very careful with your multimeter probes around the pins of P1. Be especially careful not to short the +5 V to the +3.3 V pin, even for a fraction of a second. Doing so will zap your Pi! Use Dupont wires for safety.

Figure 3-3 illustrates the testing of the +5 V supply on the Raspberry Pi 3 Model B+. Notice the use of a red Dupont wire on the header strip for the +5V supply (pin P1-02). A blue Dupont wire attaches to the ground connection.
../images/326071_2_En_3_Chapter/326071_2_En_3_Fig3_HTML.jpg
Figure 3-3

Testing the +5V supply for the Raspberry Pi 3 Model B+

Figure 3-4 likewise illustrates the measuring of the regulated 3.3 V supply from the onboard regulator of the Pi. The red Dupont wire in this figure is attached to P1-01 where the regulated output appears.
../images/326071_2_En_3_Chapter/326071_2_En_3_Fig4_HTML.jpg
Figure 3-4

Testing the +3.3 V supply for the Raspberry Pi 3 B+

Appendix B lists the ATX power supply standard voltage levels, which include +5 ± 0.25 V and +3.3 ± 0.165 V as a comparison guide.

Battery Power

Because of the small size of the Raspberry Pi, it may be desirable to run it from battery power (especially for the Zero or Zero W). Doing so requires a regulator and some careful planning. To meet the Raspberry Pi requirements, you must form a power budget. Once you know your maximum current requirement, you can flesh out the rest. The following example assumes that 1 A is required.

Requirements

For clarity, let’s list the power requirements that the battery supply must somehow meet:
  • Voltage 5 V, within ± 0.25 V

  • Current 1 A

Headroom

The simplest approach is to use the linear LM7805 as the 5 V regulator. But there are disadvantages to this approach:
  • There must be some headroom above the input voltage (about 2 V).

  • Allowing too much headroom increases the power dissipation in the regulator, resulting in wasted battery power.

  • A lower maximum output current might also result.

Your batteries should provide a minimum input of 5+2 V (7 V). Any lower input voltage to the regulator will result in the regulator “dropping out” and dipping below 5 V. Clearly, a 6 V battery input will not do.

LM7805 Regulation

Figure 3-5 shows a very simple battery circuit using the LM7805 linear regulator. The battery supply goes into VIN with the regulated output of +5 V coming out of pin 1 at the right.
../images/326071_2_En_3_Chapter/326071_2_En_3_Fig5_HTML.jpg
Figure 3-5

Battery regulator circuit using the LM7805 regulator chip

An 8.4 V battery supply can be formed from seven NiCad cells in series, each producing 1.2 V. The 8.4 V input allows the battery to drop to a low of 7 V before the minimum headroom of 2 V is violated.

Depending on the exact 7805 regulator part chosen, a typical heat-sinked parameter set might be as follows:
  • Input voltage: 7–25 V

  • Output voltage: 1.5 A (heat-sinked)

  • Operating temperature: 125°C

Be sure to use a heat sink on the regulator so that it can dissipate heat energy to the surrounding air. Without one, the regulator can enter a thermal shutdown state, reducing current flow to prevent damage. When this happens, the output voltage will drop below +5 V.

Keep in mind that the amount of power dissipated by the battery is more than that received by the load. If we assume that the Raspberry Pi Zero is consuming 350 mA, a minimum of 350 mA is also drawn from the battery through the regulator (and this could be slightly more). Realize that the regulator is dissipating additional energy because of its higher input voltage. The total power dissipated by the regulator (PR) and the load (PL) is as follows:
$$ {displaystyle egin{array}{l}{P}_d={P}_L	imes {P}_R\ {}kern2em =kern0.5em 5V	imes 0.350A+left(8.4V-5V
ight)	imes 0.350A\ {}kern1.75em =kern0.5em 1.75W+1.19W\ {}kern1.75em =kern0.5em 1.94Wend{array}} $$

The regulator must dissipate the difference between the input and the output voltages (1.19 W). This additional energy heats up the regulator with the energy being given away at the heat sink. Because of this problem, designers avoid using a high-input voltage on linear regulator circuits.

If the regulator is rated at a maximum of 1.5 A at 7 V (input), the power maximum for the regulator is about 10.5 W. If we apply an input voltage of 8.4 V instead of 7, we can derive what our 5 V maximum current will be:
$$ {displaystyle egin{array}{l}{I}_{mathrm{max}}=frac{P_{mathrm{max}}}{V_{in}}\ {}kern3.25em =kern0.5em frac{10.5W}{8.4V}\ {}kern3.25em =kern0.5em 1.25Aend{array}} $$

From this, we find that the 8.4 V battery regulator circuit can provide a maximum of 1.25 A at the output, without exceeding the regulator’s power rating. Multiply 8.4 V by 1.25 A to convince yourself that this equals 10.5 W.

DC-DC Buck Converter

If the application is designed for data acquisition, for example, it is desirable to have it run as long as possible on a given set of batteries or charge cycle. A switching regulator may be more suitable than the linear regulator because of its greater efficiency.

Figure 3-6 shows a very small pcb that is about 1.5 SD cards in length. This unit was purchased from eBay for $1.40, with free shipping. At these prices, why would you build one?
../images/326071_2_En_3_Chapter/326071_2_En_3_Fig6_HTML.jpg
Figure 3-6

DC-DC buck converter

They are also simple to use. The converter provides + and – input connections and + and – output connections. Feed power in at one voltage and get power out at another voltage.

But don’t immediately wire it up to your Raspberry Pi, until you have calibrated the output voltage. While it might come precalibrated for 5 V, it is best not to count on it. If the unit produces a higher voltage, you might fry the Pi.

The regulated output voltage is easily adjusted by a multiturn trim pot on the pcb. Adjust the pot while you read your DMM.

The specifications for the unit I purchased are provided in Table 3-2 for your general amusement. Notice the wide range of input voltages and the fact that it operates at a temperature as low as –40°C. The wide range of input voltages and current up to 3 A clearly makes this a great device to attach to solar panels that might vary widely in voltage.
Table 3-2

 DC-DC Buck Converter Specifications

Parameter

Min

Max

Units

Parameter

Min

Max

Units

Input voltage

4.00

35.0

Volts

Output ripple

 

30.9

mA

Input current

 

 3.0

Amps

Load regulation

±0.5

%

 

Output voltage

1.23

30.0

Volts

Voltage regulation

±2.5

%

 

Conversion efficiency

 

92

%

Working temperature

–40

+85

°C

Switching frequency

 

150

kHz

PCB size

 

45×20×12

mm

    

Net weight

 

10

g

The specification claims up to a 92% conversion efficiency. Using 15 V on the input, I performed my own little experiment with measurements. With the unit adjusted to produce 5.1 V at the output, the readings shown in Table 3-3 were taken.
Table 3-3

 Readings Taken from Experiment

Parameter

Input

Output

Units

Voltage

15.13

5.10

Volts

Current

0.190

0.410

Amps

Power

2.87

2.09

Watts

From the table we expected to see more power used on the input side (2.87 W). The power used on the output side was 2.09 W. The efficiency then becomes a matter of division:
$$ frac{2.09}{2.87}=0.728 $$

From this we can conclude that the measured conversion efficiency was about 72.8%.

How well could we have done if we used the LM7805 regulator? The following is a best case estimate, since I don’t have an actual current reading for that scenario. But we do know that at least as much current that flows out of the regulator must flow into it (likely more). So what is the absolute best that the LM7805 regulator could theoretically do? Let’s apply the same current draw of 410 mA for the Raspberry Pi at 5.10 V, as shown in Table 3-4. (This was operating without HDMI output in use.)
Table 3-4

Hypothetical LM7805 Power Use

Parameter

Input

Output

Units

Voltage

7.1

5.10

Volts

Current

0.410

0.410

Amps

Power

2.91

2.09

Watts

The power efficiency for this best case scenario amounts to this:
$$ frac{2.09}{2.91}=0.718 $$

The absolute best case efficiency for the LM7805 regulator is 71.8%. But this is achieved at its optimal input voltage. Increasing the input voltage to 12 V causes the power dissipation to rise considerably, resulting in a 42.5% efficiency (this calculation is left to the reader as an exercise). Attempting to operate the LM7805 regulator at 15.13 V, as we did with the buck converter, would cause the efficiency to drop to less than 33.7%. Clearly, the buck converter is much more efficient at converting power from a higher voltage source.

Signs of Insufficient Power

In the forums, it has been reported that ping sometimes doesn’t work from the desktop (with HDMI), yet works OK in console mode. Additionally, I have seen that desktop windows can freeze if you move them (HDMI). As you start to move the terminal window, for example, the motion would freeze part way through, as if the mouse stopped working.

These are signs of the Raspberry Pi being power starved. The GPU consumes more power when it is active, performing accelerated graphics. Either the desktop freezes (GPU starvation) or the network interface fails (ping). There may be other symptoms related to HDMI activity.

Another problem that has been reported is resetting of the Raspberry Pi shortly after starting to boot. The board starts to consume more power as the kernel boots up, which can result in the Pi being starved.3

If you lose your Ethernet connection when you plug in a USB device, this too may be a sign of insufficient power.4

While it may seem that a 1 A power supply should be enough to supply a 700 mA Raspberry Pi, you will be better off using a 2 A supply instead. Many power supplies simply don’t deliver their full advertised ratings.

The Micro-USB cable is something else to suspect. Some are manufactured with thin conductors that can result in a significant voltage drop. Measuring the voltage as shown previously in the “Voltage Test” section may help diagnose that. Try a higher-quality cable to see whether there is an improvement.

Summary

This chapter has been a brief introduction to some of the power issues that you may encounter in your work with the Raspberry Pi. You should now be prepared to make informed choices about power adapters or battery supply options.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.114.221