Site Network: Random Exploits | Desert Anarchy |



New, Improved Power Supply

The SheevaPlug is reputed to have a marginal power supply.  It seems to be more of an issue for the people in the UK running at 240VAC, and it also seems to be a problem to load the USB too heavily, as happens if you want to add an external mechanical disk drive.  Add to that, the fact that I live in a part of the world where the power is pretty unreliable in the winter.  Storms knock down trees and they take the power lines with them.  This project attempts to kill three birds with one stone:

The current circuit diagram is shown below.  Click on it for a full-size image.

SheevaPlug Replacement Power Supply Circuit

The premise of the circuit is simple.  The SheevaPlug, USB hub, and laptop hard drive are all designed to operate on 5VDC.  The circuit utilizes a DC-DC converter to provide +5VDC for the whole system.  The DC-DC converter is designed to take input power in the range of 11-24VDC and convert it to a constant 5VDC output.  The only bit of trickiness is to arrange for two separate sources of power to feed the DC-DC converter.  The main source comes from 120VAC house wiring through a standard laptop power adaptor.  The backup source is from a 12V lead-acid battery.

The laptop charger was chosen for easy availability, efficiency, small physical size, and a voltage output of at least 18 VDC.  I got a replacement charger for an HP Mini 1000/1100 netbook.  It is a 30W adaptor that puts out 19VDC at 1.6A.  It uses a 4.0mm connector with a 1.7mm center post, where GND is on the barrel, and V+ is on the center pin.  I got a replacement HP Mini 1000 adaptor on eBay for under $10, shipping included.

The battery backup power arrives in the form of 12VDC from a lead-acid battery.  Even with a charger attached, the voltage across the battery is less than 18 VDC.  I will be using a high-quality charger that does not overcharge the battery.  In practical terms, this means that you can leave the battery on the charger permanently without cooking all the water out of it.

My first attempt at the circuit combined the two power sources through a pair of Schottky diodes.  That is simple, cheap, and works.  The problem is that diodes are kind of power inefficient at low voltages.  The Schottky diodes drop about 0.5V across them.  The Sheevaplug plus disk draws about 8W at 5V.  Using a 12V supply, and assuming an efficiency of 80% for an average DC-DC converter, one can calculate that 0.8A would be going through the diode.  Running 0.8A through a Schottky diode with a drop of 0.5V would be 0.4W of power dissipated just in the diode.  That's a fair inefficiency when you consider that the idle power on my hard disk is also 0.4W.

In the interests of not throwing that 0.4W of power on the floor, I discovered that these days, you can buy what are called "Ideal Diodes".  They are actually a controller IC that drives a MOSFET in a fashion that makes the resulting circuit act like a diode, but without the voltage drop imposed by normal diodes.   The FETs I chose were IRF7469 N-channel MOSFETs, with a 17 milliohm resistance.  That means that with same 0.8A current going through the FET to the DC-DC converter, the power dissipated in the FET itself would be (0.8A2 * .017 Ohm) or 0.011 Watts, or about 1/40th of the power loss in the Schottky diode approach.

The new controller circuit uses an LTC4355 controller to combine the power inputs of the two power sources.  The controller can detect all kinds of faults in the system, like undervoltage on the inputs, blown fuses, or faults in the MOSFET drivers themselves.

The net result is that the two power sources are combined through the ideal diode controller ASIC.  In really simple terms, what this means is that whichever power source has the highest voltage will supply the power to the DC-DC converter.  We purposely choose the voltage output on the laptop power adaptor to be greater than the highest voltage you would see on the battery, even when the battery was charging.  This means that the laptop power adaptor will be supplying all the power to the system as long as it is powered.  If the 120VAC mains ever suffer a power failure, the battery instantly starts supplying power to the DC-DC converter.

The DC-DC converter has three requirements:

Fortunately, I found a DC-DC converter that fits the bill.  It is rated at 25 Watts, with an input range of 12V to 24V.  Conversion efficiency is supposed to be 90%, but who knows how close it really gets to that.  The whole thing was about $20 shipped from China.

The connections can be a sore point.  Power adaptor connectors come in a jillion different shapes and sizes.  Since I picked a particular HP adaptor, I know what size it is, and I designed in a DC power input jack that matches exactly.  However, to help make it easy to use any power adaptor regardless of the connector, I also paralleled the power adaptor input with some screw terminals.  That way, if the power adaptor connector does not match the input jack, you can just cut the end off and throw it away, and attach the wires to the input screw terminals. 

Here is the board layout (top view):

Sheevaplug Redundant Power Supply


I got the initial circuit boards back and stuffed them.  The hardest part is soldering the FETs: there is a lot of copper on the board for heatsinking.  That is great, except when you are trying to solder them down in which case the heatsink effect makes it harder to get the solder hot enough!

The fault LEDs work as promised by the datasheet.  Removing either fuse causes the appropriate FUSE LED to go black.  Adjusting the input voltage down on either the MAINS or BATTERY inputs below their appropriate thresholds also causes the POWERFAULT LEDs to go black.

In the picture below, you can see the board connected to a laptop power suppy (the J-plug at the front of the green power supply PCB), a 13.8V power supply pretending to be a lead-acid battery actively being charged at 13.8V, and a Kensington 4-port USB hub.  The DC-DC converter is the thing in the silver heatsink at the top left.  The USB hub is connected to the output of the power supply board, and represents the only load while I am testing.

SheevaPlug power supply

The board is connected both to the laptop power supply at 19V and the fake battery in the form of the power supply.  You can see on the power supply display that the amps being drawn from the fake battery are 0.00A (the rightmost LED display on the power supply) because the 'battery' voltage is less than the 19V being supplied by the mains laptop adaptor.  Exactly as planned!

Note that all LEDs are on.  The diode controller ASIC is designed so that all LEDs are always on in normal operation.  Any dark LED means that a fault is present, or the LED is dead.  I tested all the failure LEDs: I pulled each fuse and made sure that the proper FUSE LED turned off.  Using the adjustable power supply, I lowered the input voltages on both the mains input and the battery input until the appropriate POWERFAULT LED came on.  Everything worked as advertised.

Below, the first real test.  Notice that the laptop power supply J-plug is pulled out, simulating a power failure. 

Sheeplug power supply

You can see three indications of success:

  1. The USB hub is still powered: its green power LED is still on.
  2. The POWERFAULT and FUSE LEDs for the laptop power adaptor (the LEDs closest to the power input jack) are both out.
  3. The power indication on the power supply (the rightmost LED display) indicates 0.03A now, which means that it is supplying the power to the USB hub through the DC-DC converter.

It is not obvious from a simple photo, but disconnecting the laptop power resulted in a perfectly seamless transfer of power from the laptop supply to the 'battery'.  The DC-DC converter is designed to tolerate changing input voltages while making sure that the 5VDC output remains stable.


I removed the power supply from the Sheevaplug and replaced it with a DC power jack.  The power to that jack comes from the new external power supply I made.  I ran the computer upstairs for a couple months to prove that everything was working OK.

But finally, I got around to putting everything under the house.  I have a network patch panel down there, so that's where the DSL modem, router and 16-port Cat-6 switch live.  Now the Sheevaplug lives down there too, along with its new power supply:

Sheevaplug improved power supply

OK, it's a bit of a mess down there.  The Sheevaplug is barely visible in the center, with a yellow GigE connection to it.  The red&black twisted pair wire is the new 5V supply for the Sheevaplug. The hard drive is underneath the Sheevaplug, and both items are sitting on some bubblewrap.  The new voltage regulator is mounted to the wall to get it out of the way, and for better cooling.  The regulator doesn't really need any help cooling though: it runs barely above ambient no matter how hard the Sheevaplug is working.

The battery is a maintenance-free Universal Power 12350 which it turns out is a standard-size battery for those scooter-mobiles you see people driving around at WalMart.  The upside for using that battery in this application is that a 12350 represents a pretty beefy power source at a really good price-point due to all those scooters out there.  By 'beefy', I mean that the battery is rated at 35 Amp-Hours.  Given that my whole computer draws about 0.5 Amp at 12Volts (6 watts or so), it means that the battery should run the computer for 2-3 days in case of a power failure.  That's what I call a battery backup!

I have one of those fancy battery chargers that you can leave permanently attached without worrying about boiling the water out of the battery.  It is not in the picture though.

Part of the wiring mess is because I added a USB hub (the round orange thing) to the Sheevaplug.  The hub only has a 2 inch cable, so it was kind of hard to move it anywhere out of the way.  I needed the hub so I could connect my Arduino board to the Sheevaplug at the same time as the USB hard disk.  The purpose of the Arduino was to have a convenient way to hook up to some simple circuitry on the plug board (the white board on the lower left).  The plug board has a pair of wires that run over to the water heater where I stuck a current monitor coil on the water heater, shown below.  The circuitry detects when current is flowing into the water heater.  The Sheevaplug is set up check the status of the current flow once per second.  The results are logged to a file on the Sheevaplug's hard disk.

Measuring current on water heater

Now the Sheevaplug is monitoring how much power I use over time heating hot water at the house.  Click here to see the power usage.  The Sheevaplug is serving that website.

Why do I care about all this?  Well, I'm trying to decide if I should add a solar hot water to the house.  This setup will tell me how much power goes to hot water every month, which should tell me enough to make a decision.  Putting the solar in would be a project to be sure, but probably an interesting one.

What's next?  An even better power supply...

It will be worth it in the end.