56
The Effect of CPU Clock Rate on Power Consumption Investigation by Marc Gong Bacvanski 7’th Grade

FinalDraft20140316

Embed Size (px)

Citation preview

Page 1: FinalDraft20140316

The Effect of CPU Clock Rate on Power Consumption

Investigation by Marc Gong Bacvanski

7’th Grade

Page 2: FinalDraft20140316

Table of Contents

1. Introduction...............................................................................................................4

1.1 Importance: saving energy used by computers...........................................................4

1.2 Factors impacting power usage..................................................................................4

1.3 Our focus: CPU clock frequency..................................................................................4

1.4 Impact of CPU clock frequency on power usage..........................................................5

1.5 Objective of experiment.............................................................................................5

2. Research....................................................................................................................6

2.1 Power........................................................................................................................6

2.2 Voltage.......................................................................................................................6

2.3 Current.......................................................................................................................6

2.4 Measuring Voltage, Current, and Power.....................................................................6

2.5 Clock Rate..................................................................................................................7

2.6 Clock rate’s relationship to power..............................................................................7

2.7 PC Power management.............................................................................................8

2.8 Raspberry Pi...............................................................................................................8

3. Hypotheses..............................................................................................................10

3.1 If the clock rate is increased, the power usage will increase......................................10

3.2 If the clock rate is decreased, the power usage will decrease....................................10

4. Technologies Employed in This Experiment..............................................................11

4.1 Hardware.................................................................................................................11

4.2 Software...................................................................................................................11

5. Materials/Software..................................................................................................12

5.1 Toshiba Portege Laptop M780..................................................................................12

5.2 Raspberry Pi.............................................................................................................12

5.3 Fluke 175 True-rms Multimeter................................................................................12

5.4 Kill-A-Watt Power meter P4400................................................................................12

5.5 Occidentalis operating system..................................................................................12

5.6 PiInstaller.................................................................................................................12

5.7 8GB Micro SD card & adapter...................................................................................12

5.8 Micro SD Card writer................................................................................................13

1

Page 3: FinalDraft20140316

5.9 Standard USB to mini USB cable...............................................................................13

5.10 5V, 1A power supply..............................................................................................13

5.11 Microsoft Natural Ergonomic Keyboard 4000 v.1....................................................13

5.12 Mouse M-UVDEL1..................................................................................................13

5.13 HDMI to VGA adapter.............................................................................................13

5.14 Dell 2001FP Monitor...............................................................................................13

6. Experiment Workflow: Laptop PC Measurements.....................................................14

6.1 Boot the laptop........................................................................................................14

6.2 Install CPU-Z.............................................................................................................14

6.3 Set the clock rate......................................................................................................14

6.4 Measure the power..................................................................................................16

6.5 Write a program to make the CPU go to 100% load...................................................16

6.6 Saturate the CPU to 100%.........................................................................................17

6.7 Measure the power..................................................................................................17

6.8 Repeat......................................................................................................................17

6.9 Plot the data collected on graphs..............................................................................17

6.10 Compare the data trends between the Raspberry Pi and the laptop PC..................17

7. Experiment Workflow: Raspberry Pi Measurements.................................................17

7.1 Write Occidentalis operating system onto a SD card.................................................17

7.2 Splice the USB cable.................................................................................................21

7.3 Connect the multimeter...........................................................................................22

7.4 Boot the Raspberry Pi at 700 MHz clock rate.............................................................23

7.5 Measure the voltage.................................................................................................23

7.6 Run a program with a loop to increase the CPU load to 100%...................................23

7.7 Measure the voltage.................................................................................................24

7.8 Shut down the Raspberry Pi......................................................................................24

7.9 Change the multimeter contacts...............................................................................24

7.10 Boot the Raspberry Pi at the same clock rate..........................................................25

7.11 Measure the current..............................................................................................25

7.12 Increase the CPU load to 100%...............................................................................25

7.13 Measure the current..............................................................................................25

7.14 Shut down the Raspberry Pi...................................................................................25

7.15 Repeat measurements with different clock frequencies..........................................26

2

Page 4: FinalDraft20140316

7.16 Plot the data collected on graphs...........................................................................26

8. Problems Encountered & Solutions..........................................................................26

8.1 Too low clock settings for Raspberry Pi resulted in non-working computer...............26

8.2 Pi cannot boot while using milliamperes setting on multimeter................................27

9. Results and Measurements......................................................................................27

9.1 Laptop PC.................................................................................................................27

9.2 Raspberry Pi.............................................................................................................30

10. Analysis.................................................................................................................35

10.1 Laptop PC...............................................................................................................35

10.2 Raspberry Pi...........................................................................................................39

11. Summary...............................................................................................................43

11.1 On the PC...............................................................................................................43

11.2 On the Raspberry Pi................................................................................................44

12. Acknowledgements...............................................................................................45

13. References.............................................................................................................45

3

Page 5: FinalDraft20140316

1. IntroductionIn this project, we investigate how CPU clock rate of a computer impacts the computer’s power consumption. We test this on CPUs from normal laptop computers and those commonly used in mobile devices. Results of this experiment determine what frequency is best used for the least power consumption.

1.1 Importance: saving energy used by computersAs the number of computers in our world rapidly increases, including both mobile devices and laptop computers, the issue of power consumption of these devices becomes crucial. To add to this, the cost of electricity is also rapidly rising, and the cost to run a computer for a certain amount of time also increases. Fortunately, there are many factors that can be changed in computers in order to save electricity; one of the most important factors is CPU clock frequency.

1.2 Factors impacting power usage1.2.1 CPU clock frequencyInside every computer, the hardware chip that performs operations of the system is called the CPU (Central Processing Unit). The CPU circuitry performs many cycles per second to perform the operations. CPU clock frequency is how many cycles per second the CPU operates at. Within each cycle, power is used to perform a single calculation or operation. CPU clock rate greatly influences power consumption.

1.2.2 MemoryMemory includes the chips that store temporary information used by the CPU and other parts of the computer. Memory requires power to store information, although this power is minimal. Memory is not a significant factor for power consumption.

1.2.3 Hard drive / storageThe hard drive or storage system stores long – term information for the user and operating system. It requires power to read and write data to the disk.

1.2.4 DisplayThe display of a computer is where output from the computer is displayed to the user. Amongst other parts in a computer, the display draws a significant amount of power, especially in laptops and mobile devices.

1.2.5 External devicesExternal devices to a computer include keyboards, speakers, mice, and other accessories. These devices either do not consume much power, or they have an independent power source.

4

Page 6: FinalDraft20140316

1.3 Our focus: CPU clock frequencyCPU clock frequency is the focus in this experiment, since it is a major factor in overall power consumption. We will keep all other factors constant, and only change the CPU clock speed. The user, through an interface, can easily influence CPU clock rate.

1.4 Impact of CPU clock frequency on power usagePower usage is heavily influenced by CPU clock frequency, as shown in this formula. P is Power, C is capacitance of the CPU, V is Voltage, and f is the CPU frequency. If the CPU frequency increases and all the other factors stay constant, according to this law, the power usage should increase proportionally.

1.5 Objective of experimentIn this experiment, we examine the exact relationship between clock frequency and power consumption. We use CPUs from personal computers and from mobile devices.

5

Page 7: FinalDraft20140316

2. Research2.1 Power2.1.1 Physical laws for powerPower is how you measure the work potential of electricity. It is measured in Watts.

2.1.2 Power = Voltage * CurrentTo calculate power, multiply voltage and current together.

2.2 Voltage2.2.1 Voltage gives free electrons a push to moveVoltage is the difference in electric potential between points. Since differences want to equalize, this force gives free electrons a push to move from point A to point B. To visualize this, imagine a pipe. Voltage would be how quickly the water rushes through the pipe.

Source: http://www.creighton.edu/green/energytutorials/electricitybasics/

2.2.2 Voltage required to have current flowIn order to have current flowing between two points, voltage must exist between the two points.

2.3 Current2.3.1 Total charge per unit of timeCurrent is the amount of electricity that flows in a unit of time. In a pipe analogy, where the speed of the water is voltage, current is how wide the pipe is.

2.3.2 Measured in AmpereCurrent is measured in Amperes.

2.4 Measuring Voltage, Current, and Power2.4.1 VoltmeterVoltage is measured by a voltmeter. An ideal voltmeter draws no current and should have infinite resistance. A voltmeter is connected in parallel with the positive and negative wires.

6

Page 8: FinalDraft20140316

2.4.2 Ampere meterCurrent is measured by an ampere meter (also called an ammeter). An ideal ampere meter has no resistance. An ampere meter is connected in series on one of the wires so that electricity must flow through the ampere meter.

2.4.3 PowerPower is the amount of electricity used. In the pipe analogy, power is the volume of water flowing.

2.5 Clock Rate2.5.1 How many cycles the CPU performs per secondFor a CPU to perform calculations, the circuits in the CPU execute instructions in cycles in the rhythm of the clock rate. In each cycle, one instruction of the CPU is performed. The clock rate determines how fast the instructions are executed. More complex operations may require several clock cycles.

2.5.2 Measured in MHz or GHzCPU clock rate is measured in MHz (Megahertz) or GHz (Gigahertz). One megahertz is 1,000,000 times per second (10^6), and one gigahertz is 1,000,000,000 times per second (10^9). If a certain CPU runs at 850 MHz, it means that it runs 850 * 1,000,000 cycles per second, or 850,000,000 cycles per second. If a certain CPU runs at 2.4 GHz, it means that it runs 2.4 * 1,000,000,000 cycles per second, or 2,400,000,000 cycles per second.

2.5.3 UnderclockingUnderclocking a CPU is to lower the clock rate of a CPU. Through that, the computer should be slower. Since a single clock cycle takes a certain amount of power and with a lower clock rate the CPU does not perform as many clock cycles per second, the computer in theory uses less power.

2.5.4 OverclockingOverclocking a CPU is to increase the clock rate of a CPU. The main goal of overclocking is to make the computer faster by having more clock cycles per second. With an increased clock rate, the computer runs faster, but also draws more power.

2.5.5 Limits to overclocking and underclockingThere are limits to overclocking and underclocking. If a CPU is overclocked too much, it can burn out from the extra heat created. The heat can melt certain parts of the CPU and also can cause pieces to warp, thus destroying contacts on the chip and causing the CPU to fail.

While underclocked, a CPU can go below its lowest operating frequency. If it does so, the capacitors in the chip lose their output charge before the other circuits in the chip use that charge to do useful work. Hence CPU is not able to function anymore.

7

Page 9: FinalDraft20140316

2.6 Clock rate’s relationship to power2.6.1 Power related to frequencyPower draw of a CPU should be proportional to CPU clock frequency. This formula (P = CV2f) calculates the power consumption of a CPU where P is Power, C is the capacitance of the CPU, V is the voltage, and f is the frequency of the CPU. Therefore, if the frequency increases and all other factors stay the same, the CPU will draw more power, as seen in the illustration below.

2.7 PC power management2.7.1 User can set some CPU settingsOn a PC, the user can customize power modes, such power saving, full performance, etc. One can set the CPU clock frequency.

2.7.2 Automatically adjusts clock within user set guidelines To adjust the clock rate of the CPU, the user can set a minimum and maximum percentage of the normal CPU clock rate. The CPU will then pick an optimum frequency between the user-set minimum and maximum settings. For example, if the user sets the minimum clock rate to be 50% and maximum to be 75% and the CPU runs at 1 GHz, the minimum clock rate will be 500 MHz (50% of 1 GHz) and maximum will be 750 MHz (75% of 1 GHz), assuming the CPU can attain the lower clock rate of 500 MHz. If the minimum and maximum percentages are set to be the same, the CPU executes at the given frequency.

2.7.3 System will not use unsafe settings for CPUAfter the user sets the percentage clock rate, the system checks the feasibility of the user’s settings. If the CPU can run at that frequency, the system uses it. Otherwise, if the user’s setting cannot be attained, the system changes the CPU frequency to a frequency as close as possible to the user’s setting, but a still feasible frequency. This prevents the user from damaging the CPU through excessive overclocking and underclocking, and prevents the system from crashing under extreme underclocking.

2.7.4 Keeping the CPU at a constant rateIf the user sets both the minimum and maximum CPU rate to be the same, the CPU stays at that set percentage of its full frequency.

8

Page 10: FinalDraft20140316

2.8 Raspberry Pi2.8.1 Small, $35 computer slightly larger than credit cardDesigned by Broadcom in UK, this tiny microcomputer was intended as an educational device for computer classes. It provides the user many options for hacking and customizing hardware settings.

2.8.2 CPUThe CPU on the Raspberry Pi is the same as that used in many smart phones and mobile devices, such as the Apple iPhone 3GS. On the Raspberry Pi, the user can control the CPU clock rate.

2.8.3 Hardware Settings on PiTo change the hardware settings on the Raspberry Pi, such as the CPU clock frequency, the user needs to access the file /boot/config.txt. It contains information for the CPU about how to boot and its clock frequency. Once the file is changed, the Raspberry Pi needs to be rebooted for the changes to take effect.

9

Page 11: FinalDraft20140316

3. Hypotheses3.1 If the clock rate is increased, the power usage will increase.Based on the law of power, if the clock frequency increases, the power usage also increases.

3.2 If the clock rate is decreased, the power usage will decrease.Based on the law of power, if the clock frequency decreases, the power usage also decreases.

10

Page 12: FinalDraft20140316

4. Technologies Employed in This Experiment4.1 HardwareTo test the hypothesis on a general PC, a laptop PC is used. To test the hypothesis on the Raspberry Pi, which is representative of smartphones and mobile devices, a Raspberry Pi Model B is used.

4.2 SoftwareFor both the Raspberry Pi and the laptop PC, an operating system is used. In order to manage the power usage and manipulate the clock frequency on the laptop, a power management application is required.

11

Page 13: FinalDraft20140316

5. Materials/Software5.1 Toshiba Portege Laptop M780The PC used in this experiment has the specifications as follows: 8GB RAM, 512 GB SSD, Intel Core i7 620M CPU at 2.67 GHz. This laptop is representative of present-day PC laptops.

5.2 Raspberry Pi Model BThe Raspberry Pi has the specifications as follows: 512 MB RAM, 8 GB SD card, ARM1176JZF-S (ARMv6k) CPU at 700 MHz. The Raspberry Pi, since the CPU is identical to those found on smartphones and mobile devices, represents how over/underclocking affects the power consumption in mobile devices.

5.3 Fluke 175 True-rms MultimeterThe Fluke 175 True-rms Multimeter is used to measure the current and voltage drawn by the Raspberry Pi. True-rms means that the multimeter can measure non-sinusoidal waveforms. From those measurements, the power consumption of the Raspberry Pi can be calculated.

5.4 Kill-A-Watt Power meter P4400 This power meter is used to measure the laptop’s power usage. Since there is no access to the power supply for the laptop, this device, which plugs into the wall outlet and into which the laptop can be plugged in, is used. Its display gives information on the power usage of the device plugged into it.

5.5 Occidentalis operating systemThe Raspberry Pi requires an operating system in order to function. The operating system used in this experiment is called Occidentalis, which is a derivative of Linux.

5.6 PiInstallerPiInstaller is a program that will write to an SD card and do all the necessary opening and closing of files. It is used to write the Occidentalis operating system to the SD card.

5.7 8GB Micro SD card & adapterThe Raspberry Pi’s method of long-term storage is an SD card. In this experiment an 8 Gigabyte micro SD card is used. In order that the micro SD card fits in the normal SD card slot that the Raspberry Pi has, a micro SD card adapter is used.

12

Page 14: FinalDraft20140316

5.8 Micro SD Card writerTo write to a micro SD card requires a special micro SD card writer. It plugs into a USB port and has a plug for the micro SD card.

5.9 Standard USB to mini USB cableThe Raspberry Pi’s power cable goes through mini USB. At one end, where it is plugged in to the power supply, the cable is standard USB. At the other end, where it plugs into the Raspberry Pi, the cable is mini USB.

5.10 5V, 1A power supplyThe Raspberry Pi requires a steady power supply at 5 Volts, 1 Ampere in order to function correctly. This power supply plugs into the wall outlet and has a standard USB plug.

5.11 Microsoft Natural Ergonomic Keyboard 4000 v.1.The Raspberry Pi has no other devices attached to it; it is a single board microcomputer. Therefore, it is necessary to connect input devices such as this keyboard. This keyboard is selected because it is representative of the commonly used keyboard.

5.12 Mouse M-UVDEL1As mentioned above, the Raspberry Pi has no other input devices attached to it, so it is necessary to provide a mouse.

5.13 HDMI to VGA adapterSince the Raspberry Pi has only an HDMI port to connect a display to and the display used in this experiment has only a VGA connection, this adapter from HDMI to VGA is used.

5.14 Dell 2001FP MonitorThis is the monitor connected to the Raspberry Pi during this experiment.

13

Page 15: FinalDraft20140316

6. Experiment Workflow: Laptop PC Measurements6.1 Boot the laptopFirst, set up the laptop so that the battery does not affect the power consumption and set up the Kill-A-Watt power meter.

1. Take the battery out of the laptop so that the battery does not affect the power consumption.

2. Plug the laptop power cord into the Kill-A-Watt power meter, and plug the power meter into a wall outlet.

3. Turn on the laptop.

6.2 Install CPU-ZCPU-Z is the CPU clock rate monitoring software used in this experiment. It is free and gives information about the CPU running in the computer.

1. Download CPU-Z, a CPU monitoring software, from http://www.cpuid.com/downloads/cpu-z/1.67-setup-en.exe

2. Go through the setup wizard.3. Open up the CPU-Z application.4. Note down the current CPU clock frequency: it’s under Clocks: Core Speed.

6.3 Set the clock rateSet the clock rate of the laptop through the control panel application. Even though the exact clock rate cannot be changed, the user can change two percentages, minimum and maximum state of the CPU. The minimum state means that at lowest, the CPU should be underclocked to that percentage of the highest CPU clock rate attainable. The maximum state means that at 100% load, the CPU should not reach above that percentage of the highest CPU clock rate attainable. However, the lowest or highest values may not change the clock below or above the minimum or maximum safe value.

14

Page 16: FinalDraft20140316

1. On the PC laptop, open up “Control Panel”, then “Hardware and Sound”, and “Power Options”.

2. Select the “High Performance” power option.

3. Click on “Change Plan Settings”.

15

Page 17: FinalDraft20140316

4. Click on “Change Advanced Plan Settings”.

5. Open “Processor Power Management”.6. Change the ‘Minimum Clock’ to 5%, and ‘Maximum Clock’ to 5%.

6.4 Measure the powerMeasure the power consumed by the laptop 5 times.

16

Page 18: FinalDraft20140316

1. Set the Kill-A-Watt to measure Wattage.2. Record the actual clock rate of the CPU using the CPU-Z application.3. Measure and record the power consumption of the laptop 5 times.4. Find the average of those measurements.

6.5 Write a program to make the CPU go to 100% load.This program contains a simple loop that runs in circles and therefore increases the CPU load to 100%. Although the program is different from that run on the Raspberry Pi, the result is the same as the CPU load goes to 100%.

1. Open up a text editor, such as Sublime Text 2.2. Write a simple program that has a loop. My program is below. At the begin

statement, it means to begin a loop. In the second line, goto :begin means to go back to the begin section of the loop. Save it in a file as loops.bat.

begin goto :begin

6.6 Saturate the CPU to 100%.Run the loop program 5 times to completely saturate the CPU. Since the CPU in the laptop has 4 cores, 5 instances of the program were run to completely saturate the CPU to 100%. With less than 5 instances, the CPU did not go fully to 100%.

1. Open 5 Command Prompt windows.2. In each of them, type loops.bat and press [enter].

6.7 Measure the powerMeasure the power usage of the laptop when the CPU usage is 100%.

1. Using the Kill-A-Watt power meter set to Watts, measure and record the power consumption 5 times.

2. Find the average of those measures.

6.8 RepeatRepeat the steps to change the clock settings and measure the power consumption.

1. Repeat steps 7.2 – 7.62. Use clock settings as 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, and 100% of

the full CPU for both minimum and maximum CPU states.

6.9 Plot the data collected on graphs.

6.10 Compare the data trends between the Raspberry Pi and the laptop PC.

7. Experiment Workflow: Raspberry Pi MeasurementsThese are the steps I followed to gather data on Raspberry Pi power usage.

17

Page 19: FinalDraft20140316

7.1 Write Occidentalis operating system onto a SD cardFirst, we need to write the Raspberry Pi’s operating system onto an SD card, which the Raspberry Pi uses as its boot disk and storage. To write the operating system onto the SD card from a normal computer, it is necessary to use a micro SD card writer.

18

Page 20: FinalDraft20140316

3. Download Pi Installer onto your computer from: https://github.com/RayViljoen/Raspberry-PI-SD-Installer-OS-X (for Mac only). This program makes writing the Raspberry Pi operating system to the SD card easy.

4. Unzip the program when it finishes downloading.5. Download the Occidentalis (version 02) operating system image from

http://adafruit-raspberry-pi.s3.amazonaws.com/Occidentalisv02.zip

6. Unzip that file as well.7. In the directory where the Pi Installer is downloaded, paste the Occidentalis image.

8. Insert the micro SD card into the writer, and insert it into a USB port on your computer.

9. Open up the terminal application. Navigate to the folder where the installer and the

image are in, using cd to change the directory. For example, if the path to the folder with the installer and image is:

/PiBackup/Raspberry-Pi-SD-Installer-OS-X-master

then to change the directory one would type:

cd /PiBackup/Raspberry-Pi-SD-Installer-OS-X-master

You will now be in the directory

Raspberry-Pi-SD-Installer-PS-X-master/

19

Page 21: FinalDraft20140316

10. Once you are in the directory where the operating system image and the Pi installer are, type in sudo ./install Occidentalis_v02.img and then hit enter.

11. Terminal may or may not prompt you for your computer’s password. If so, simply type it in and hit enter.

12. Pi Installer will then run, and ask you on what disk to install the operating system.

20

Page 22: FinalDraft20140316

13. Select the disk on which to install Occidentalis. Make sure that you have got the right disk number; Pi Installer will not check, and will truncate all the data already existing on the disk you select.

21

Page 23: FinalDraft20140316

14. Double check that you have got the right disk. In our case it is /dev/disk1s1, but yours might be different. Press Enter, and Pi Installer will do the rest.

This operation may take a few minutes.When Pi Installer is finished writing, it will close up by ejecting the disk.

15. Pull out the SD card from the writer. It is not necessary to eject it because Pi Installer does so when it is done.

22

Page 24: FinalDraft20140316

16. Insert the micro SD card into its adapter, and slide the whole thing into the SD card slot on the Raspberry Pi.

17. Plug the keyboard and mouse into the USB ports of the Raspberry Pi.18. Plug the monitor into the VGA side of the VGA to HDMI adapter, and plug the other

end of the adapter into the HDMI port on the Raspberry Pi.19. Plug in the 5V, 1A power unit, and plug the standard end of the USB cable into the

power supply and the mini USB end into the Raspberry Pi’s mini USB port. A red and green light will then light up, and the Raspberry Pi will boot.

20. Go through the first time configuration after the Raspberry Pi starts. Use the arrow keys to select the items you want. I used: Boot straight to desktop: TRUE; Enable SSH on bootup: TRUE; Keyboard: Generic, 101 key U.S. When done, exit the configuration.

21. Shut down the Raspberry Pi by typing sudo shutdown –h now. When the green status light on the Raspberry Pi flashes 4 times and then goes off, unplug the Raspberry Pi.

7.2 Splice the USB cableIn order to access the power wires in the USB cable to measure the voltage and current consumed by the Raspberry Pi, it is necessary to cut the USB cable.

23

Page 25: FinalDraft20140316

1. Carefully strip away the outer insulation on a section of the USB wire using a hobby knife. Take care not to cut the delicate data wires inside. Remove the shielding mesh and metal so you can see the red, black, green, and blue wires inside.

2. Using wire snips cut the red and black leads and strip 5 mm off the insulation on each cut end of them.

3. Attach jumper wires to each end correspondingly so that the black jumper wires connect to the black leads, and the red jumper wires connect the red leads. This color-coding makes it easier to distinguish the positive and negative leads.

7.3 Connect the multimeterIn order to measure voltage, it is important to connect the multimeter correctly.

1. Connect one of the red jumper wires to the red terminal of the multimeter. With another red jumper wire, connect the red terminal of the multimeter back to the red jumper wire connected on the USB cable.

2. Connect one of the black jumper wires to the red terminal of the multimeter. With another black jumper wire, connect the black terminal of the multimeter back to the black jumper wire connected on the USB cable. The circuit schematic should look like the one above, where the voltage meter is connected in parallel to one the load.

7.4 Boot the Raspberry Pi at 700 MHz clock rateBoot the Raspberry to measure power draw when its CPU is at idle usage.

24

Page 26: FinalDraft20140316

1. Connect the standard USB side of the spliced cable to the 5V, 1A DC power supply, and the mini USB end of it to the Raspberry Pi. Do not plug the power supply in yet.

2. Turn on the Fluke 175 True-rms multimeter and set it to volts, DC (autoranging). 3. Plug in the Raspberry Pi power supply and measure the amount of time the

Raspberry Pi takes to boot. When it finishes booting, it should show a screen with some desktop icons.

7.5 Measure the voltageMeasure the voltage used by the Raspberry Pi when the CPU is at idle.

1. The CPU clock frequency is at 700 MHz currently, which is the default. When the Raspberry Pi has finished booting and the CPU is at idle, measure and record the voltage drawn 5 times in order to make sure the tests are accurate.

2. Find the average of these measurements.

7.6 Run a program with a loop to increase the CPU load to 100%In order to test the CPU power consumption when the CPU is at 100% utilization, we will write and run a loop to increase the CPU load to 100%. This simulates a situation where the user is running applications that require a high CPU clock rate.

1. Open up LXTerminal by double clicking on the desktop icon.2. Type in nano loops.py3. Type in a python program with a loop to increase the CPU load to 100%. The

program that I used is below.

while True: newNum = 123456789 * 987654321

This program runs in a loop forever, and calculates a variable, newNum, which is 123456789 * 987654321. Since the condition for the loop is true, the condition will never be false, and the loop will never terminate unless the user terminates the program.

4. To save the program and exit, type [ctrl] x, y, then [enter]5. To run the program, type python loops.py

7.7 Measure the voltageMeasure the voltage consumed by the Raspberry Pi when the CPU is at 100% utilization.

1. Measure and record the voltage 5 times.2. Find the average of those measurements.3. Stop loops.py by typing [ctrl] c

7.8 Shut down the Raspberry PiIn order to change the multimeter contacts to measure current, the Raspberry Pi must be shut down first. Since reconnecting the multimeter in another circuit will temporarily cut off the power, it is crucial to power off the Raspberry Pi first.

25

Page 27: FinalDraft20140316

1. Shut down the Raspberry Pi by typing in terminal: sudo shutdown –h now

7.9 Change the multimeter contactsIn order to measure current, the multimeter must be set up in series with one of the power wires.

1. Change the contacts for the multimeter so that one red jumper wire from the USB wire connects to the red contact on the multimeter.

2. Connect the other red jumper wire from the USB wire to the black contact on the multimeter.

3. This connection is made to measure current, since to do so the multimeter needs to be connected in series with one of the power wires. The finished schematic should look like the one above.

7.10 Boot the Raspberry Pi at the same clock rateBoot the Raspberry Pi at the same clock rate that was used to measure idle CPU voltage and 100% CPU utilization voltage.

1. Set the multimeter to measure amperes.2. Plug in the Raspberry Pi to the power supply to boot it at the same clock rate.

7.11 Measure the currentMeasure the current consumed by the Raspberry Pi.

1. Measure and record the current 5 times.2. Find the average of those measurements.

7.12 Increase the CPU load to 100%To measure the current consumed when the CPU utilization is 100%, we will run the program with a loop to increase the CPU load.

1. Open up LXTerminal by double-clicking on the desktop icon.2. Type loops.py to increase the CPU load to 100%.

7.13 Measure the currentMeasure the current consumed by the Raspberry Pi when the CPU utilization is 100%.

1. Measure and record the current 5 times.2. Find the average of those measures.3. Type in terminal [ctrl] c to stop loops.py

7.14 Shut down the Raspberry PiChange the clock frequency to the next frequency to be tested before shutting down the Raspberry Pi and rewiring the multimeter circuit to measure voltage.

26

Page 28: FinalDraft20140316

1. Before shutting down the Raspberry Pi, change the clock frequency to the next frequency to be tested – see the next step.

2. Type in terminal cd ../../boot/3. Type in terminal sudo nano config.txt4. Find the line where it says #arm-freq=8005. Delete the hash mark in front of the line, and change the number to the clock

frequency (in MHz) you want to set the CPU to. The default clock frequency is 700 MHz.

7.15 Repeat measurements with different clock frequencies1. Repeat steps 6.4 – 6.14. At 6.14, use clock frequencies at 600 MHz, 800 MHz, and

900 MHz.

7.16 Plot the data collected on graphs

8. Problems Encountered & Solutions8.1 Too low clock settings for Raspberry Pi resulted in non-working

computer8.1.1 Raspberry Pi does not boot at 500 MHzTo test the lowest underclockable frequency, the clock rate was set to 500 MHz. When plugged in, the Raspberry Pi began to boot, but then stopped midway, the screen went all black, and the boot process began all over. At a low clock frequency, the capacitors in the chip lose most of their charge before that charge can be used for other parts of the chip. When the clock frequency is decreased, the amount of time between the capacitor discharge and when the charge is actually obtained by another component is greater. Therefore, sometimes, by slight chance of a few nanoseconds, a part does not get the needed power that it should get from the discharging capacitor. Thus, the chip and boot process crashes, and it starts right over again with the boot process. As this graph shows, as the time increases, the charge from the capacitor discharge decreases rapidly, and less and less voltage is received. Without enough voltage, the parts that require this nominal voltage cannot properly function, and the chip crashes.

8.1.2 SD memory card corruptedSince the Pi did not fully boot, there was no way to change the boot setting to a more reasonable CPU clock frequency, so it was necessary to re-install the operating system image on the SD card. I followed the exact same process as described in step 6.1 of the procedure.

27

Page 29: FinalDraft20140316

8.2 Pi cannot boot while using milliamperes setting on multimeterTo measure current draw of the Raspberry Pi, I set the multimeter to measure milliamperes. However, when the Raspberry Pi was connected, the Pi did not even start to boot at all. Therefore, I tried to use the amperes setting on the multimeter, and the Raspberry Pi booted.

8.2.1 Multimeter drew too much current at milliamperesThe reason why the Raspberry Pi could not boot when the multimeter was set to milliamperes was because the multimeter drew too much current. Therefore, the Raspberry Pi did not get enough current through the power cable in order to start booting. Although it is not certain exactly why the multimeter draws more current at the milliamperes setting than at the amperes setting, it is related to the internal circuitry of the multimeter. This is why on the multimeter there are several settings for a user to choose from to measure the same thing.

9. Results and Measurements 9.1 Laptop PC9.1.1 Raw Data TablesThe following tables are the raw data obtained by sampling the Kill-A-Watt power meter at different clock frequencies. At the top right hand corner of the tables is a percentage that corresponds to what percentage of the full clock rate the CPU was set at those measurements. The column of numbers underneath is the five trials (denoted T1, T2, etc.), and the average of those measurements (denoted Average). These that follow are simply the data I collected; analysis of this data is in section 10.1. All units are in watts.

28

Page 30: FinalDraft20140316

9.1.2 Graphs and ChartsWe will analyze the graphs that follow in section 10.1. All units are in watts.

9.1.3 ComparisonThis following chart shows how idle CPU power consumption is related to percentages of full CPU clock usage.

This chart below shows how idle CPU power consumption is related to actual clock frequencies.

29

Page 31: FinalDraft20140316

The chart below shows how 100% CPU utilization power consumption is related to percentages of full clock speed used.

The following chart shows the same data as the above chart, except showing actual clock frequencies.

This following chart shows how the idle CPU power consumption compares to 100% CPU load power consumption in percentages of CPU clock.

This following chart shows how the idle CPU power consumption compares to 100% CPU load power consumption in actual clock frequencies.

30

Page 32: FinalDraft20140316

9.2 Raspberry Pi9.2.1 Raw DataThe following table shows the results I got from measuring the Raspberry Pi at different clock rates. There are no values for 500 MHz since the boot failed because of the low clock rate. At the very last row, I have measured the boot time as a measure of system performance at that clock rate. Voltage is in Volts, and current is measured in amperes.

31

Page 33: FinalDraft20140316

9.2.2 GraphsWe will analyze the graphs that follow in section 10.2. Voltage is in volts, current is in amperes, and power is in watts.

The following graph shows how, at idle CPU, voltage drawn by the Raspberry Pi is related to

clock rate.

The next graph shows how, at idle CPU, current usage is related to clock frequency.

32

Page 34: FinalDraft20140316

This following graph shows how, at 100% CPU usage, voltage drawn by the Raspberry Pi is related to clock frequency.

This graph below shows how, at 100% CPU usage, current drawn by the Raspberry Pi is related to clock frequency.

33

Page 35: FinalDraft20140316

Following is the chart for the power consumption of the Raspberry Pi when the CPU is at idle.

Below is the chart for power consumption of the Raspberry Pi when the CPU is at 100% utilization.

34

Page 36: FinalDraft20140316

This following chart shows both the High CPU Voltage and Low CPU Voltage – voltage drawn by the Raspberry Pi when the CPU is at 100% and idle.

This chart below shows both the High CPU Current and Low CPU Current – current drawn by the Raspberry Pi when the CPU is at 100% and idle.

35

Page 37: FinalDraft20140316

Here is the chart that combines High CPU Power and Low CPU Power, power consumption by the Raspberry Pi when the CPU is at 100% utilization and idle.

As a measure of system performance, the graph for boot time follows.

10. Analysis10.1 Laptop PC10.1.1 Hypothesis holds trueThe data collected from the laptop PC supports my hypothesis. As the clock rate increases, the power consumption also increases. When the clock rate decreases, power consumption

36

Page 38: FinalDraft20140316

decreases. The units are in watts.

Each clock cycle takes a certain amount of power to perform, and when the number of clock cycles decreases by underclocking, the power consumption also decreases.

10.1.2 Underclocking at idleSince modern CPUs can turn off certain sections that are not in use when the CPU is at idle, the power usage is little affected by underclocking at idle CPU. The units are in watts.

Even though it looks like a big difference on the graph, the increase is not actually very large; only the large increments make it seem significant. However, the main trend is that with an increased clock at idle CPU, only little power usage is increased. Another graph follows, but it has the actual clock frequencies in Gigahertz listed and the power consumption. The units are in watts.

37

Page 39: FinalDraft20140316

Notice how at the beginning of the X-axis, which is the CPU clock rate, all of them say 1.20, even though, as seen in the first chart, the frequency percentage is at 5%, then 10%, and so on until 50%. At 50%, the clock frequency becomes 1.33 GHz, and increases from there on. This means that the system cannot go below 1.20 GHz, so it puts it for 5%-40%, even though the percentage CPU should be lower.

10.1.3 Underclocking at 100% CPU utilizationAt 100% CPU utilization, at every cycle the CPU is busy doing an operation, which uses more power than simply idling. When the CPU is underclocked and the CPU usage stays 100%, the power saving has a significant reduction. Units are in watts.

The next graph shows the same data, but with the actual CPU clock as well. Units are in watts.

38

Page 40: FinalDraft20140316

The general trend of the data is that as the clock rate is increased, the power consumption also increases. Note the fast growth on the chart after 1.16 GHz.

10.1.4 ComparisonThe graph that follows shows both trends for 100% CPU utilization (High CPU) and idle CPU. Units are in watts.

The graph below shows the same data, except with the actual CPU clock rate.

39

Page 41: FinalDraft20140316

Notice how the first 5 clock frequencies all say 1.20, even though the percentage CPU set was different: 5%, 10%, etc. The reason for that is because below 50% CPU, the CPU will not be able to function with a lower clock frequency than 1.20. If the CPU went below that frequency, the chip would crash, and the computer would become inoperable. Therefore, the operating system does not let the CPU go below the minimum frequency threshold.

The main trend in data is that as the clock rate increases, power consumption also increases. Underclocking at 100% CPU load is more effective than underclocking at idle CPU because at 100% load the CPU is actively using power for each cycle, and reducing the number of cycles effectively reduces the amount of power the CPU draws. With underclocking at 100% CPU load, over 15 watts of electricity were saved, with the full clock using over 45 watts, and the underclocked CPU using only 30. However, with underclocking at CPU idle, only 2-3 watts of electricity were saved, with the full clock using 26 watts, and the underclocked CPU used 23 watts.

10.2 Raspberry Pi10.2.1 Hypothesis not supportedThe data graphs collected from the Raspberry Pi measurements were singularly peculiar. The power, voltage, and current measurements seemed to jump all over the place, as seen in these diagrams. Voltage is in volts, current is in amperes, and power is in watts.

40

Page 42: FinalDraft20140316

41

Page 43: FinalDraft20140316

42

Page 44: FinalDraft20140316

10.2.2 Built-in energy management unitFurther research was conducted after observing these singular diagrams, including consulting technical documentations about the chip. It was found that the Arm ARM1176JZF-S CPU, which is used in the Raspberry Pi, has an internal energy management unit built into the chip. Since this exact CPU is used frequently in mobile devices and phones, it includes an automatic energy management unit that would measure numerous chip factors, such as temperature, clock rate, load, etc., and regulate the voltage and current going to the CPU to optimize performance and reduce energy usage. Particularly, the energy management is critical for mobile devices such as phones since they would quickly run out of power without this unit. By manipulating input voltage and current going to the CPU, the energy management unit is able to control the energy usage of the chip as our measurements show. Surprisingly, the lowest power use is at the standard clock frequency, showing that this is an optimal setting for this CPU.

10.2.3 Overrides other CPU settingsEven though the user can set up specific options and settings for the CPU, this energy management unit can automatically override many of those settings, among them voltage and current. The energy management unit is preprogrammed to optimize chip performance, reduce energy consumption, and reduce excess heat production by the CPU.

10.2.4 Buck RegulatorThe crucial part of the energy management unit, the Broadcom BCM2835, is the Buck Regulator. The schematic below shows how a Buck Regulator works. At the supply (circle), an input voltage is passed. When the switch is closed, the electricity goes through the inductivity (coily thing), being the only way for it to travel. When an inductivity sees an increase in voltage, it builds up an electromagnetic field, thereby smoothening out the increase in input voltage and slowing down the change of voltage in time. When voltage is passed in from the source, the inductivity slows down the increase in voltage by building an

43

Page 45: FinalDraft20140316

electromagnetic field. The voltage then goes through, in parallel, a capacitor (two parallel lines) and the load (rectangle). In our case, the load is the CPU because it causes resistance and uses power. The load gets power, but at a reduced power than at the source because of the slowdown of increase of voltage over time by the inductivity. At the second state, when the switch is closed, the capacitor wants to release all its electrons. However, the inductivity, being reluctant to change its state, smoothens out that sudden burst of electricity from the capacitor to make it useable to the load. The diode (triangle with a line on top) forces the electricity to go only that way, and does not let the electricity flow back. Therefore, when the switch opens, the inductor’s momentum (when it converts the electromagnetic field back into electricity) does not burn out the switch. The load now gets power, at a reduced voltage, without any loss of power throughout the circuit! Then, when the switch closes again at state 1, the voltage slowly increases, the capacitor charges, and the load gets electricity at a reduced voltage than the source.

Through regulating the switching by controlling the amount of time in each state, a different power can be given to the device, without any loss through heat! This is different than a normal regulator, as in a regulator the excess power is converted into heat, and in the Buck Regulator no electricity is lost due to heat or other losses.

11. Summary11.1 On the PCPower usage on the PC significantly decreases by reducing the clock rate. This is because each clock cycle requires energy to perform. By reducing the clock rate, we reduce the number of clock cycles per second; hence, power usage decreases.

44

Page 46: FinalDraft20140316

11.2 On the Raspberry PiOn the Raspberry Pi, power consumption decreased by reducing the clock rate and first increased by increasing the clock rate at 800 MHz, and then decreased significantly by increasing the clock rate to 900 MHz. This erratic power usage is due to aggressive power management on the CPU by the built-in hardware power management system. As the power management system noticed the CPU was going at a higher clock rate, it decreased the power given to the CPU.

45

Page 47: FinalDraft20140316

12. AcknowledgementsI would like to thank my mom for her continued support of my project, and my dad for his practical advice and suggestions.

13. ReferencesSafari Books Online. Hacking Raspberry Pi. Retrieved from techbus.safaribooksonline.com/print?xmlid=9780133476637%2Fch18lev1sec3 on 2/1/14.

Windows. Power Policy Configuration and Deployment in Windows. October 21, 2010.

Safari Books Online. Practical Electronics for Inventors. Retrieved from techbus.safaribooksonline.com/print?xmlid=9780071771337%2Fch2_13_html on 2/1/14.

Windows. Processor Power Management in Windows 7 and Windows Server 2008 R2. October 19, 2012.

Wikipedia. Raspberry Pi. Retrieved from http://en.wikipedia.org/wiki/Raspberry_Pi on 2/1/14.

Safari Books Online. Raspberry Pi User Guide. Retrieved from techbus.safaribooksonline.com/print?xmlid=9781118464496%2Fa2_10_9781118464496_ch06_html on 2/1/14.

Windows. Using PowerCfg to Evaluate System Energy Efficiency. March 26, 2010.

46