Pi On The Wall – wall mounted home server – Part 3: Reducing Power Consumption

If you missed Part 1 and Part 2, it’s probably best you at least read Part 1 to understand the scope of the project. Part 2 discusses how the hardware is modified to fit into a restrictive enclosure, measuring only 10mm deep.

PiOnTheWallFrom the start, I wanted to stretch the boundaries of the Pi On The Wall, and therefore, Raspberry Pi power consumption. It seemed like a rather fun exercise. This post describes what I did in reducing power consumption fairly drastically, given what can be done in this limited power space.

For those who want a jist of what follows: <tldr> I reduced power requirements of the Raspberry Pi with PiTFT and WiFi drastically. Had to plan for high inrush currents in the designs. Choose switching regulators wisely given voltage and load characteristics. Efficiency varies drastically! Espressos are expensive! </tldr>

Power outline – the situation as stands.

The major consumers of power are as follows

Pi model A: 300mA (source: RPi Wiki )

PiTFT: 100mA (source: Adafruit website )

Edimax Wifi dongle: unknown for sure. This uses the Realtek RTL8188CUS chipset. The only datasheet I could find for it was from a third party which suggested maximum 600mA at 3.3v. It did not provide minimum and typical current ratings, sadly. That’s nearly 400mA at 5v – Whoa.

So we are looking at around 400mA + wifi. Looking around, it seemed to be the WifF would cost about 100mA in active use, not the 400mA from the datasheet, so we’re looking at 700mA for the whole unit.

Since we are space constrained, the power supply situation is a sticky problem for me. The more power required, the more heat given off by the supply, so I want consumption to be low, and efficiency high. My original hope was that I could use the power supply provided with the thermostat casing, as it outputs 5v. Sadly, after testing it with an adjustable current load, it became clear the supply would not be suitable. At just below 200mA draw, the supply would give up, sending the voltage down to millivolts. In fact, even with 150mA, the voltage dropped by 600mV, so using it for the Pi isn’t very feasible.

From looking at various threads about power consumption online, I came to the figure of having this run at 250mA. I’d like this number at idle with the PiTFT backlight on, but peak will probably be higher. Nothing very scientific in how I came up with that number –it’s just a rough guess of what seemed reasonable to achieve.

Lowering Power

The first thing that jumps out at you when researching Raspberry Pi power consumption is the 3v3 linear voltage regulator, marked RG2. That component takes the 5v power input and outputs a stable 3v3 rail which powers most of the devices on the board.

rg2Linear regulators are inefficient, and the power difference between the input and output is dissipated as heat. As I stated earlier, heat is something I want to stay clear from, and when it’s generated by an inefficient component that is not acceptable. We will change this component, swapping in a more efficient, switching regulator. However, we need to be very careful about which switching regulator we choose – efficiency at the given input, output and load of the various switching chips can vary drastically, sometimes falling below that of a linear regulator! Do not use those LM2596/LM2598 devices you see everywhere, efficiency at the characteristics we use is a poor 77%.

lm2598_effI decided, in the first instance, to use an MP2307 based DC-DC unit. They can be had very cheaply at retailers like banggood.com, and as you can see by the datasheet, efficiency is very good at the values we require (over 90%). That cheap unit has L at 10uH, too!

mp2307_effOne thing to note about these cheap DC-DC converters is that they usually have a wide variable output range, and a terrible single turn pot as the adjustment pin. I spent at least 15 minutes attempting to get as close to 3.3v as possible. In the end, I settled for 3.34v. It would have been quicker soldering a 10-turn pot on here, but sadly I’m too constrained for space to have this luxury.

We will detach the stock 3v3 regulator from the circuit, and power the Pi using the GPIO 5v and 3v3 pins. Note: these pins bypass any protection circuitry on your Raspberry Pi. You’ve been warned!

Software Tips

We can also do some tuning in software. The tvservice, which operates the HDMI out of the raspberry pi, consumes power. Switching this off is simple, and can be done on startup.

Many people on the Raspberry Pi forums have indicated that underclocking the Broadcom SoC achieves nothing in terms of power saving. Despite this, as I’m going for a low-temperature solution, I’m still going to enable the OnDemand cpufreq governor, and set it to operate between 300-500MHz rather than flat out 700MHz. This basically makes the CPU clock down when idle, and ramp back up when under load. It’s a fairly common feature these days, and I must admit was surprised I had to enable it! Instructions for doing this can be found here and here. I installed cpufrequtils with apt-get and used that.

The GPU should handle itself and when idle (which, should be pretty much all the time) be very low power.

The measuring setup

To measure the power consumption, I’m going to measure voltage and current on the 5v line which powers the Pi and also any replacement switching regulators we connect.

Something which may catch folk out here is that first instincts may make you put your multimeter reading current onto the mA range. This has a large effect on the voltage into the Pi, due to Burden Voltage. Dave Jones of EEVblog has a good video on this, as well as Martin Lorton. All of my meters are budget ones (Vichy VC99) and the burden voltage of the mA range meant the Pi would not even boot. On the Amps range it booted fine, with a much smaller Burden Voltage, but still enough resolution to see a reasonable figure. A good compromise for this is to find a decent 0.1 Ohm precision resistor, which can be had fairly cheaply – then you simply measure the voltage across this resistor and read it off the meter like 20.5mV == 205mA. I like this method as it also shows you instantly the burden voltage in your circuit and you can adjust to reverse any ill effects of it. I just live with it in these tests as it is small enough not to cause issue. I confirmed my results using this method as well as simply using the multimeter current measurement.

The setup looks like the following diagram.current_measurement_setup

Power Measurements

The measurements I found were an average over a few test runs. The current measurement was taken using my Vichy VC99 meter that should be accurate enough, but I’ve not used precision measurement techniques or equipment so the figures should really be taken as a decent ballpark figure. Multimeter set to its maximum mode – so it captures and always displays the maximum reading it had during the test run. We need to know the maximum, because the Pi is very fragile with sudden voltage drops and it will fail to boot if the power it demands is unavailable. Current readings are always taken from the main 5v line into everything unless specified otherwise. The main source of the 5v rail to remain close to the final setup is an HTC TCB250 5V 1A charger.

The test is as follows: The PiOnTheWall is booted to X, PiTFT backlight on, USB wifi enabled and configured to connect to an access point 7 meters away and through several walls.

setup_stock_376Test 1: Stock setup

The Pi booted and successfully completed the test with a maximum reading of 376mA.

This seemed promising already. It’s far lower than expected considering I was expecting 200mA alone for the WiFi and PiTFT.

Test 2: TV service off

The Pi booted and successfully completed the test with a maximum reading of 356mA.

That was a decent saving for doing pretty much nothing. All you need to do is add ‘/opt/vc/bin/tvservice –off’ to your init. This figure seems consistent with that observed by Dave Akerman.

Test 3: Replace 3v3 regulator with an MP2307 switching unit.

I simply desoldered the two bottom legs of the regulator off the board, keeping the tab on. This is in case I ever need it again, so it’s an easy change to revert.

The Pi booted and successfully completed the test with a maximum reading of 325mA.

This is disappointing, however, not unexpected. The biggest power draws, the WiFi and PiTFT take up 200mA alone, leaving just 156mA for the Pi (from test 2). If we assume the efficiency of the linear regulator is 70%, the maximum we could really get down to is in the 110mA area. But the MP2307 unit itself isn’t 100% efficient either, so if we consider it to be around 90% efficient (which is conservative, but still a great figure) we get a theoretical 121mA, which is very close when the 200mA is added back on to our 325mA figure.

Test 4: Power the whole setup – Pi, PiTFT, Wifi from a single 3v3 source, tying the 5v rail to 3v3.

This is supposedly doable – I’d read about it in the forums, and also via Dave Akermans blog mentioned above. If we look at the Schematic, we can see the +5v rail goes into the 3v3 regulator, which then becomes the main power rail, but +5v also goes to some pins on the Broadcom SoC, and the USB Power. The WiFi chipset datasheet indicated it ran from 3v3, however, I don’t know how that is delivered, so whether the USB +V pin being 3v3 would translate to an operating chipset is unknown. The Pins on the Broadcom SoC where 5v is present seems to mostly be sense pins for battery powered devices, and so hoped these were not actually used correctly, and that any significant voltage on them such as 3v3 would allow for boot.

pischematic_battery5vNote that for these tests, the mA current readings are on the 5v input before any 3v3 converters.

The first attempt at the test was conclusive.

The Pi failed to boot fully.

The initial linux boot sequence looked promising at 3v3. The backlight of the PiTFT module was, of course, less bright – but still very useable even under my bright bench light. After several attempts at booting the culprit was clear – the WiFi stick initialization. As soon as the WiFi was initialized and it’s activity light came on, the PiTFT screen failed and went white. The Pi Itself continued to boot as I was able to SSH in after a short delay, so the WiFi worked, it’s simply something else was happening.

Inrush Current

When this happened, my first instinct was Inrush Current causing issues. Inrush current is the high draw which occurs when something first switches on, caps charging, etc. It’s well known that the Raspberry Pi does not cope well with this, and there are many mods that exist to make the Pi cope well with hot-plugging of USB devices. There is an article here which discusses inrush current and controlling motors, and indicated further filter capacitors on the input power would solve this issue. Remembering from Part 2, we removed the 220uF input capacitor, so there is certainly a lack of capacitance on the power inputs. In line with the article I link to, I fitted a 0.1uF ceramic, and some 1000uF Electrolytic capacitors I found in my junk bin to the power input. After I did this, it booted to X.

junkcapsThe Pi booted and successfully completed the test with a maximum reading of 254mA.

This seemed a huge jump, then I realized why: the LED backlight of the PiTFT. They were rated at 80mA, but on measuring them individually at 3.3v they were drawing only 22mA @ 3.3v! The brightness drop isn’t really a problem for me, so this is a welcome decrease in consumption. I’m not an expert at this, so it’s probably going to have a damaging effect on the LEDs life, but I’ll take that risk.

A problem remained, however – the PiOnTheWall was unstable. When I opened the web browser and pointed it to BBC news the PiTFT died like before. Damn. Additionally, there was a considerable flickering of the backlight of the screen. I initially thought it was synced to the activity light of the WiFi, but it wasn’t. Then I thought about it being activity on the SD card. I discovered this document on SD card stability which suggested a 22uF tantalum capacitor between pins 3 and 4 of the SD card. The Pi schematic didn’t show capacitance of this level in the SD card interface, so I added it. Thankfully I had a single 22uF tant left, albeit a slightly larger voltage one than I wanted. It still fits in the assembly, so soldered it direct to the SD card socket.

sd_tantBut sadly, the flickering remained!

Then I remembered there was a regulator on the PiTFT itself, as it was powered from the 5v GPIO. The TFT panel requires 3v3. I looked up the datasheet for the regulator and saw it would output around 2.8v for 3.3v in. This is actually still within the minimum spec of the raw TFT panel used in the PiTFT, but to make sure, I removed the regulator and bypassed the in/out pads on the board. The flicker remained. Ugh.

pitft_reg(Top tip: Keep the off cuts of through hole components for making jumpers like above!)

At this point I ordered some high quality ESR caps to use, but it still didn’t stop the backlight flicker. The quality caps did however make the device stable – I was able to load BBC news in the browser on the device fine. The backlight flicker pretty much ruled this solution out though.

Test 5: Power Pi & PiTFT from 3v3, Wifi from 5v

The Pi booted successfully and completed the test with a maximum reading of 269mA.newcapsThe flickering with this setup was drastically reduced – barely noticeable. The amount of capacitance on the input power could be reduced and it was still stable, loading web page in the browser well – the PiTFT screen remained on and active throughout. I think we have a winner!

caps_3v3The final input schematic contains several capacitors and they are rated for 6v. Interestingly I don’t need any on the 5v line that the WiFi is connected to, but this may change with other 5v power sources. I always needed to keep the 5v line, as my motion sensor runs off a very odd 4v4 – I couldn’t easily find any 3v3 PIR units that are small enough for my enclosure. Note, that the additional capacitors will fit in the enclosure fine, in the existing area where the old useless power supply was along with AC-DC converter.


I hit my power target. I’d expected around 250mA typical, in reality, I’m getting lower than that. I get around 270 peak, but during normal use, with the backlight on, and downloading a file over the WiFi it draws around 220mA. Idle, with the backlight off, with WiFi connected (but no traffic) we are at 140mA.

I don’t expect this device to be doing much; but when it is the backlight will no doubt be off. The backlight is controlled by a small motion sensor which automatically turns it off with no motion. With the WiFi active, it consumes around 200mA at 5v. A single watt of power, at a reasonable load. In fact, throughout these tests, the HTC adaptor was really only providing around 4.8V, so it’s even less than this!

Okay, when looking at the numbers this saving may seem a bit silly given the effort that went in to achieve it. But I’m confident this will achieve a cooler overall setup in terms of temperature and efficiency. As it’s inset into the wall, I don’t want a ‘phone charger’ type setup getting warm. I intend to power this device with a mains AC to 5V converter, and then a 5v to 3v3 switching DC-DC converter. As I said earlier, there are a variety of DC-DC converters for this purpose, and I ordered a variety in with different efficiencies to test. I may write another post looking at the efficiency of these units as they really do vary! For now I just used the MP2307 as it was easiest to procure and its datasheet suggested >90% efficiency.

To finish off, lets calculate how much it will cost to power this at a generous typical of 0.8W. If I assume a mains to DC voltage efficiency of 65% (i.e, the mains adapter used to produce the 5V and 3v3, which nobody ever takes into consideration in figures), we’re around 1.23W. For a year, that’s 1.23 * 24 * 365 = 10.78KWh.

Given 2013’s average KWh unit of electricity cost in the UK of 13.52p, it will cost £1.46 to power the Pi On The Wall. For a whole year. Around $2.45 USD.

tldr_costThanks for reading, I hope it was interesting. As always, you can reach me on twitter @domipheus and the flickr album is full (230+ high res images) of build progress shots. If you liked the article, please consider sharing it on social media of your choice!

To be continued… Part 4 will be putting it all together, temperature, and preparing the case! A teaser of what’s to come is below

– Espresso Image courtesy of Suat Eman / FreeDigitalPhotos.net –

Pi On The Wall – wall mounted home server – Part 2: Diet Pi

This is Part 2 of a series of blogs regarding the development of a wall-mounted server based on the Raspberry Pi, featuring WiFi and a colour touchscreen. Part 1 can be found here.


The enclosure I’m using, a re-purposed room thermostat casing, places some very tight constraints on the dimensions of the Raspberry Pi and PiTFT board.The plastic used in the case is quite sturdy, and is at least 2mm in thickness. Therefore the real inner depth of the case is about 12mm. As for the width of the Pi, we need to shave at least 4mm from the side. The Pi itself is 86mm wide, same with the PiTFT board, so we will need to find a way of making it closer to 82mm.
pitftThe board interconnect that comes with the PiTFT is a tall terminal connector. It is immediately ruled out for use, as it increases the depth of the assembly to well over an inch. Without using that, and bending the pins to grip the I/O on the PiTFT, the depth from SD card housing to top of the TFT is just over 20mm. Still far too much.
pi_identThe main space-wasters on the Pi are easy to identify. The composite out, audio out, USB, HDMI, and the camera and display interfaces all can be removed. The tallest of these, the Composite out, measures over 11mm alone. The only one we need to use is USB, and we can add terminals to enable an off-board connector for that. All the others need to go.

pi_componentsThe composite, audio and USB jacks were relatively easy to remove. Solder sucker & solder wick with some wiggling did the trick. The HDMI socket was another matter entirely. There were some components near the socket I didn’t want to destroy, and one of the soldered through-hole supports wouldn’t budge. Butchery was resorted to, using cutters to chip away at the metal surround and later the plastic. The connector itself is surface mount, and came off fairly easily after that. Once destroyed, the through hole-support gave in and came out with more wiggling. I apologise to all who were involved in designing the Pi for the following image.
pi_nohdmiSome PCB pads came off at the HDMI socket, but I was not concerned, as this was destructive change anyway. The camera and display interface connectors I simply cut away with pliers, again, a few pads came off.
powerschematicC6 is the large silver capacitor near the micro usb socket. This is the last item in the way on the top of the board, and as you can see from the Raspberry Pi schematic, is just a smoothing capactor for the power. It can be safely removed and if needed, put off-board in seperate power circuitry. I’ve identified D17, a protection diode on the opposite side of the PCB, as we will come back to this later. The board ends up incredibly bare and on the top side it’s only a few millimeters tall.
pi_bareAfter this I put a 90 degree set of terminal pins in the USB location so we can put the socket off-board. If we knew everything was going to work at this point the easiest thing to do would be to solder the PiTFT board directly to the GPIO pins of the PI. However, I wanted to remove the Pi from the TFT board to adjust things in future, so had to come up with a solution without using standard terminal connectors, which are too tall. I decided to try taking a DIP socket and using that, as they are only 3mm tall. The first two pins are not required, so sawing a 24-pin socket in half, inverting it for a flush fit and filing down worked exceptionally well.

interconnect_bodgeWith this the board is just over 14mm from top of the touchscreen to the bottom of the SD card holder.

interconnect_heightThe next thing I attempted was to cut around 5mm from the Pi and PiTFT PCBs closest to where the USB port used to be. Around there, especially on the model A, it’s sparce.

Boardlayout_cutraspberry_pi_pitftdiagramThe PiTFT is round the opposite way as the Pi, as you can see, it’s simply the adafruit logo mask and there are no important traces to avoid. I just dived right in, marked a line with a stanley knife and got out the hacksaw. After some effort and sanding with a rotary tool it came out pretty well.

pi_cutThe PCBs now fit well into the case in terms of width and length, but depth is still a problem. We need to hit 12mm at minimum. The only thing to now do is relocate the SD card socket from the bottom of the board to the space on top where the Display Interface used to be, on top of the logo to the left of the SoC.

pi_sd_depth_ Desoldering the SD card holder was a bit more nasty than I’d imagined. I only have an iron, solder sucker and some wick. Ideally I’d have the correct tools, but for this I resorted to the ‘pull enamelled wire through the joint as it is molten’ trick, which worked in this case. If you use this method watch out as the pins themselves can come out from the plastic housing very easily.

wire_sm_desolderAfter it was removed, I used 0.2mm enamelled copper wire soldered to the existing pads, through the hole in the board to the front side and soldered direct to the holder. It wasn’t very well done, I tried to keep the lengths of wire of a similar length but it shouldn’t matter too much. The main thing is making sure you have a good clean solder joint and you remove the enamel at the right places. Scraping with side cutters and tinning with too much solder (so much that you waste some) usually does the trick.

pi_sdAn interesting thing to note is that the card detect and write protect switches do not seem to have an effect at runtime. The schematic shows the write protect pins are unconnected, so that’s expected. The card detect pins are connected to the SoC. My plan was just to short the pads on the underside to save soldering 2 wires that don’t really matter. There are two very small SMD components where the SD card holder now sits (C1 & C5), I made tiny holes in the underside plastic of the holder so it can be mounted flush on the PCB without those components being damaged.

Additionally, I removed D17. This protection diode will be mounted off-board when the power system is looked at along with (potentially) C6 that we removed earlier. Note D17 and C6 technically are not needed to run the board, they are for protection, so I can still test via the microUSB socket as in the picture below.

slim_piAt the moment i’m measuring just over 10mm to the end of the terminal pins on the underside of the RPi board. Of course there are some surface mount components also on the back, but they don’t change depth much. The D17 diode was the biggest one, and we moved it off-board. I’m going to grind the back of the GPIO pins off a bit just to save some more space, but I think there is no need to go further than 10mm. There is still space between the Pi and PiTFT boards for the USB terminal connector to carry a socket off-board, and also something I’m looking at is heat dissipation from the SoC and whether I need to increase the surface area for some better passive cooling.

The final dimensions of the unit assembled is 80mm x 56mm x 10.5mm.

As for the Pi On The Wall project, the next steps are to sort the casing out with the tactile switches matching the switches on the PiTFT, and also affixing the USB socket in the case so a mini USB WiFi stick is flush with the exterior. After that, I’ll be running some power consumption tests and heat dissipation tests. I want this to be extremely low power, and will experiment with replacing the regulators, turning off services, possibly even running the whole board off 3.3v instead of 5v, which is said to be possible.

If you have got to this point in the post, I hope you found it interesting. If you have any questions, please either comment here or message me directly on twitter @domipheus.

Update: Thanks for all the feedback! Here is a taste of things to come in the case fitting:

pi_casefitpitweet(used a hub in the usb socket to type for this shot, obviously the idea is once done I’ll make some specialized frontend so that’s not needed, and all config done over ssh)

All pictures of the build and more can be seen here on Flickr.

Pi On The Wall – wall mounted home server – Part 1: Introduction

I’ve been working away at an idea I had that seemed too good to sit on, so jumped at it. It’s easier to explain the purpose in an image:

PiOnTheWall I’ve been meaning to set up my Raspberry Pi to monitor the Heatmiser WiFi thermostat I use, as well as being a small home server. I have a standard wall mount plate free in the hall of our house, the sort of thing the above would mount into and be wired direct to mains for 24/7 operation. I thought it would be cool to take a cheap thermostat, gut it, and replace it’s internals with Pi goodness – throwing in a colour touchscreen for good measure.

The Pi On The Wall was born.

41zJZupMBKLI discovered a cheap thermostat on Amazon which had mains power to 5v built in. The power unit may need to be replaced which is something I’ll write about later, but as you can see there is not much space in here for a Raspberry Pi and associated TFT screen, WiFi stick, SD card, etc.

thecasecase_dims There will be quite a bit of customization going on. The Pi board itself doesnt fit in here for length, let alone it plus the standard PiTFT mount for depth.

erm_deepThat’s not going to look good on the wall.

I’m quite progressed with this project as I type this, and will post a few updates shortly. Spoilers: In total, the current depth of the Pi + TFT is currently 14mm. This is after some serious hacking at the board itself. It’s not pretty, but it’s working. There are some fun hacks in here to share!

 [Part 2 can be found here – showing how the Pi + TFT slims down to only 10mm!]

To be continued… if you are too impatient for the next part, i’ll be updating the following flickr album with various shots, and posting on my @domipheus twitter.