USB Power Meter

RPi NAS: Extras – Power Consumption

12 January 2024

The NAS we’re building should be always on so power consumption matters. One of the major reasons for choosing a single-board computer like the Raspberry Pi is its low power consumption. But how low is it? And how much power do the storage devices use? Let’s find out.

This post is part of a series about building a Network-Attached Storage (NAS) with redundancy using a Raspberry Pi (RPi). See here for a list of all posts in this series.


Voltage, Current and Power

I’m going to assume that you are familiar with voltage, current and power. I’m planning to make a detailed introduction about them and I’ll update this post when it’s ready.

As a very short reminder, current is proportional to the number of electrons that are flowing through our setup, voltage represents the pressure that pushes them through (that’s a rough analogy to how water flows through pipes) and power represents the amount of work the electrons can do. Power is equal to voltage times current. The unit of current is Ampere (A), of voltage is Volt (V) and of power is Watt (W).

That’s neither the most accurate nor the best description of these terms, which is why I’m planning to make a dedicated post about them. But for now it will have to do.

Power Consumption Overview

All power measurements were done on a fully set up NAS. So they should represent the actual power consumed when the NAS is in operation.

It can be a bit dry to read about the process of getting these measurements. So in this section we’re just going to discuss the results. The next section will provide some details (I’ll try to not make them too dry).

DeviceSpin-Up / BootActiveIdleStandbyPower Save
3.5″ HDD13W7W4W1.2W0.3W
2.5″ HDD3W3W1W1W0.3W
SSDn/a2.5W0.275Wn/an/a
Raspberry Pi7.6W6.5W3.15Wn/an/a

I measured power consumption for five different situations. Spin-Up refers to when a HDD’s disks start spinning. This stage usually requires a lot of power (relatively speaking) for a short period of time1. SSDs don’t have moving parts so there is no spin-up. Boot refers to the boot process of the RPi.

Active refers to when data is written to the NAS, so when the drives and the RPi are actively being used. I didn’t do a separate measurement for reading from the drive but I’m going to assume the same value as measured for writing (although it may be a bit lower).

Idle refers to when the drive or RPi is not being actively used but not (yet) in standby or sleep mode. This doesn’t apply to SSDs2.

Power Save refers to a low-power state supported by some HDDs. If your HDD supports Advanced Power Management (APM) then you can influence the HDDs spin-down/standby behaviour by adjusting the APM settings. By default my 3.5″ HDD enters a low-power state after 30 minutes of inactivity. The same would be true for the 2.5″ HDDs. Unfortunately the USB Hub prevents the HDDs from activating it so they stay in idle mode (and keep using 1W instead of 0.3W).

If you are interested in more details about these measurements then keep on reading the next section. Otherwise you can jump right to the cost estimate.

Power Consumption Details

Power Meters

For the tests below I used two different power meters:

  1. A power meter which slots between the power plug (Type F) and the power socket.
  2. A USB power/current tester which slots in between the power source and the respective device. It has connections for both USB-A and USB-C.

Both of them are rather basic models so I’m expecting the numbers to be roughly accurate but certainly not to high precision.

I was a bit hesitant with the USB meter because it seems to affect data transfer. For example, the time it takes to copy data to the NAS whose shares reside on the SSD is a lot longer when the USB meter is connected (between Raspberry Pi and the SSD)3. So less data gets through to the NAS at any point in time, compared to when there’s no power meter attached. There is a chance that the power consumed (per unit of time) by this semi-busy SSD is lower than if it were writing at higher speeds. I try to control for this issue by using the first power meter to double-check the results obtained by the second (USB) power meter (when that’s possible).

There’s certainly one small issue with the USB power meter. When connecting a power source via USB-C it shows a power consumption of 0.125W. That’s although there’s no device attached that could consume any power. It could be measuring its own power usage but nothing of the sort happens with the USB-A connection.

One more point, both power meters I’m using only update about once a second so it’s very possible that there are large (but short) current spikes which I’m missing (for example during disk spin-up).

3.5″ HDD

The 3.5″ WD Elements HDD is self-powered. However, there is always the possibility that the power provided by the built-in power supply is insufficient4 and that additional power is drawn via the USB connection. To test if that happens I connected the power tester between the Raspberry Pi’s USB port and the USB cable of the HDD. Then I started the NAS, copied some files onto it and read some from it. At no point was there any power consumed over the USB connection. Good.

To measure the 3.5″ HDD’s power consumption I put a power tester between it’s power plug and the power socket in the wall. During spin up the HDD requires up to 13W but only for a couple of seconds. When active but idle it uses about 4W. When copying to it the wattage fluctuates but a (rounded up) average is 7W. In standby mode (i.e. the disk is spun-down) it uses about 1.2W. After 30 minutes of inactivity that drops to 0.3W5.

By default my particular HDD is idle for 30 minutes after the last access. During that time it consumes ~4W. Then it goes directly to the low-power mode where it uses 0.3W6. So it skips the standby mode where it would consume 1.2W. You can affect this behaviour with programs like hdparm. There are two options

  1. set time until the disk spins down after the last activity with option -S, and
  2. set the Advanced Power Management feature with option -B.

For this series of posts I will stick with the default behaviour so I won’t cover hdparm‘s options here.

USB Hub

The powered USB Hub, without any other devices connected to it, uses approximately 0.5W. When the USB Hub is connected to the RPi and some HDDs are connected to the USB Hub, then the hub draws an additional ~0.1W from the Raspberry Pi, even though the hub is powered.

2.5″ HDDs

In our final setup the 2.5″ HDDs are connected to a powered USB Hub. So I connected the USB power tester between the hub and one of the 2.5″ HDDs. During spin-up the HDD requires up to 3W, again only for a very short period of time. When spun-up but not actively used it consumes about 1W7. When data is copied to it power consumption fluctuates between 1W and 3W. A conservative (i.e. rounded up) estimate for the average is of 2.75W.

Because of my doubts about the USB tester I double-checked these numbers. I put the first power tester between the power plug of the USB Hub and the power socket. With two 2.5″ HDDs attached I saw a maximum of 6W during spin-up8. When copying to the NAS power usage fluctuates but an average of 6W seems accurate. When spun-up but not in use consumption is 2W. So per drive that gives 3W during spin-up, 3W when active, 1W when idle. These numbers are already corrected for the 0.5W power consumption of the USB Hub.

It seems that the two sets of measurements are quite consistent with each other. So the USB power meter may be sufficiently reliable after all. Note, there are slight variations across each of the three 2.5″ HDDs.

The 2.5″ HDDs also have a low-power mode where they consume ~0.3W. By default, and if they are connected directly to the Raspberry Pi, they enter the low-power mode after 30 minutes of inactivity. However, as soon as they are plugged into the Vansunny USB Hub they don’t enter low-power mode (regardless of whether the hub is connected to the RPi or not). I tried a different, unpowered hub that works on my computer (but not on the RPi). That hub doesn’t prevent the HDDs from entering low-power mode. I’m assuming that the power supply of the Vansunny interferes with the HDDs in some way. That’s quite inconvenient because it triples the power consumption of each of those three drives (1W vs 0.3W). We’ll see below that the additional costs are not huge so I’ll keep this USB Hub for now9.

SSD Power Consumption

For completeness I’m also looking at the power consumption of the SSD, even though it’s not used in the final system. It’s actually quite tricky to measure power consumption of the SSD because

  • it’s not connected via the USB Hub (but directly to the RPi) so I can’t use the first power tester as for the 2.5″ HDDs, and
  • its performance suffers heavily from being connected via the USB power meter.

By heavily I mean that the SSD became almost unusable and I don’t really trust the numbers I’m seeing on the USB power meter. So I’m roughly estimating its power consumption by measuring:

  • The total power consumption of the Raspberry Pi when the self-powered 3.5″ HDD is used to hold Samba shares.
  • The total power consumption of the Raspberry Pi when the SSD is used to hold Samba shares.

The 3.5″ HDD doesn’t draw any current from the RPi. The SSD is fully powered by the RPi. Everything else should be equal. So the difference between those two measurements is an approximation of the SSD’s power consumption.

On to the numbers. There are no moving parts so there is no spin-up phase and no associated power peak. During operations the SSD uses approximately 2.5W. When idle it’s down to 0.275W.

Raspberry Pi 4b

The power consumption of the Raspberry Pi depends heavily on the computational load it has to deal with. I’ve also found it to depend on the devices that are connected to it. For example, when no device is connected then it uses less than 2W when idle. After connecting Ethernet that increases to 2.3W with occasional spikes at around 2.7-3W. Connecting HDDs, even if they have their own power supply, further increases power consumption10.

The numbers I’m reporting now refer to the hardware setup of the final NAS from the main series of posts. So one 3.5″ HDD is directly connected to the RPi, three 2.5″ HDDs are connected via the USB Hub. The maximum I observed during boot was a brief spike of 7.6W. When copying data to the NAS the RPi uses somewhere between 6W and 7W. The numbers fluctuate and vary depending on what is being copied. I’m going to use 6.5W for the calculation below. When idle the RPi uses 4W. Finally, after the 3.5″ HDD has gone to low-power mode the RPi still uses 4W.

Expected Annual Cost

To estimate the annual cost we need to specify how the NAS will be used. I’m going to do this estimate for my personal usage, yours may be very different.

I think on average I use the NAS for approximately one hour per day. That’s an average, so I use it more on some days, less on others11. That includes any interaction with it, i.e. copying to it and reading from it and the additional processing that Greyhole does afterwards. I’m also assuming that on average that one hour is split up into three separate sessions.

Overall, that’s quite a light usage but it’s appropriate for my situation. Your usage pattern will be very different if you use the NAS for streaming films or music!

I’m ignoring boot and spin-up times because boot happens very infrequently and the spin-up spikes only happen very briefly.

The RPi will be on 24/7 so there are no phases of standby or sleep modes. For 1h per day, when data is copied onto the NAS, it uses 6.5W. During the rest of the day it uses 4W. So that’s 98.5Wh per day and 40.1kWh per year. Assuming a price of EUR 0.35 per kWh that’s roughly EUR 18.25 per year.

For the 3.5″ HDD I have one hour of activity @ 7W. This hour is split up into three sessions. After each session the HDD will be idle for 30 minutes. During that time it consumes 4W. For the rest of the time the HDD is in a low-power mode @ 0.3W. The total power consumption over a day is thus

1h * 7W + 3 * 0.5h * 4W + 21.5h * 0.3W = 19.45Wh.

For one year that’s 7.1kWh, which is approximately EUR 2.50. The same calculation for one of the 2.5″ HDDs gives 9.49 kWh per year which is approximately EUR 3.33 per HDD. So for three HDDs that’s EUR 9.97. If our USB Hub didn’t prevent the 2.5″ HDDs from entering low-power mode then that number would fall to EUR 5.02.

The USB Hub uses 0.5W when connected. That corresponds to 4.38kWh or EUR 1.54 for a year.

DeviceEstimated Annual Cost
Raspberry Pi 4bEUR 18.25
3.5″ HDDEUR 2.50
2.5″ HDDsEUR 9.97
USB HubEUR 1.54
TotalEUR 32.26

So, we now have an estimate of how much this NAS is going to cost me. I think that’s quite good, especially considering how much more safe our data is with this NAS. What do you think? What cost do you estimate for your system?


Footnotes:

  1. As also described in the section on power meters, my power meters only update about once a second so it is very possible that I missed higher spikes. ↩︎
  2. SSDs don’t normally go into standby. On the one hand their power consumption is already very low. On the other hand it seems that there can be some difficulties when waking up (unfortunately I lost the link to more information about it, I’ll update this comment if I ever find it again). ↩︎
  3. I want to be more explicit, because I find that often websites are not super clear and I rather err on the side of over-explaining. Consider the situation where the SSD is connected directly to the Raspberry Pi. The 2.5″ HDDs are connected to the RPi via the USB Hub. The Samba shares are saved on the SSD. When data gets copied onto the NAS then it is first written to the SSD and later copied from the SSD to the HDDs. First the USB power meter is connected between the Raspberry Pi and the SSD. Then the power meter is removed. The transfer speed of the first case, without the power meter, is a lot higher than in the second case. ↩︎
  4. The device could also be constructed badly … ↩︎
  5. The drop to 0.3W is probably due to WD’s power management. The utility hdparm allows you to alter the Advanced Power Management settings with option -B but not all drives support that. My 3.5″ HDD doesn’t. Also note, you can manually put your drive into standby mode with command sudo hdparm -y /dev/sdX for testing. ↩︎
  6. I found that time by making a timelapse with my camera. The timelapse also allowed for monitoring the consumed wattage. A smarter power tester may be able to do that by itself but mine couldn’t. ↩︎
  7. The value is a bit higher right after writing finishes. After a few minutes it settles on 1W or a bit lower. ↩︎
  8. As mentioned further above, the update frequency of the first power meter is only about once per second. So it’s easy to miss very brief power spikes like the ones during spin-up. ↩︎
  9. Also, I’ve already ordered and returned five USB Hubs which, I think, is enough for the time being. ↩︎
  10. I’m assuming that’s due to the power required by the USB host controller. I’m not sure though, let me know if you know! ↩︎
  11. And sometimes not at all. ↩︎

This post is tagged as:



Comments

Leave a Reply

Your email address will not be published. Required fields are marked *