Showing posts with label power. Show all posts
Showing posts with label power. Show all posts

2025-08-24

Redudant power supply for home servers and devices

A well known story

All those who run a small infrastructure at home know this problem. It's Monday morning, while drinking your first coffee you're checking your e-mails, you find that you received surprisingly few during the night, and that the last one was from 5 hours ago. Then this well-known feeling starts to build up: "what is it this time? FS full, unregistered from all mailing lists at once, missed a domain renewal notification, or a machine died?". At this point you finish drinking your coffee quickly because you know that it will cool down faster than you'll get the problem fixed, and you start to ping various machines and devices while chewing some biscuits, to discover (in any order of preference):

  • a reverse proxy no longer responding
  • many machines no longer responding (likely indicating a switch issue)
  • the router not responding

Then you go to the office/lab/basement/garage/wherever the machines are located, and start debugging in underwear, thinking that it's really not a great moment because you planned to arrive early at work to prepare some stuff before a meeting...

Finally the culprit is almost always the same: a dead power brick whose LED (if any) blinks slowly indicating a dead input capacitor, or not at all anymore:

Then starts the moment of removing the dust from the sticker to find the voltage and amperage, and open all trays to find an almost equivalent one which should hopefully get the job done even if it's half the amperage because you know your devices are not pulling that much... And when you want to connect it, you notice that its connector is a 2.1mm inner while the previous one was a 2.5mm. But by forcing a lot you manage to establish a contact and consider that it will be sufficient for the time it takes to order another power block, then you can go to the shower.

There is a variant to that story: you're working in your office, notice the light flickering, and realize you had a micro power outage on the mains. Most of your small servers didn't notice, but one wasn't that lucky and experienced a brownout. You decide that enough is enough, it's really time to connect all of them to the UPS, but the UPS has too few outputs, all on C13 plugs and you have to modify a pair of power strips to install a C14 connector on them in order to connect all your small devices:

And once that's done, you discover the day your UPS fails to take over a short power cut and want to remove it, that you have no other C13 power strip to which you can connect the C14-equipped strips, something like this that I once had to build exactly because of this:


It's got only marginally better with USB power delivery because when a power brick dies, it's often easier to find another one (but rarely a high power one), or you can sometimes temporarily daisy-chain the device to another device (provided that it was not itself already daisy-chained).

All of this sounds familiar ?

Root cause 

The reason to all these problems is the multiplicity of low-power devices which all come with their own power block, each requiring a distinct mains outlet. And sometimes angled ones cannot even be placed close to each other and are masking some outlets. You quickly end up with this for 12V supplies:

And USB is not much better, all having to live together on the same power strips:


Oh by the way, for USB nowadays there is something way more appealing, the ubiquitous multi-output QC charger: 

Except you'll only try it once for servers, until you realize that it's a charger and not a power supply, and the difference is that each time you connect or disconnect something from a port, it renegotiates the voltages with all other ports, which are all cut for a second or two! That's absolutely not a problem to charge a laptop. But it is when you imagine powering multiple always-on devices from it.

The solution is in fact to set up a power distribution system which requires only one input. However if this one fails, it will be even worse, so it needs to be redundant. And if it's redundant, it can also be connected behind the UPS to get protection, as well as directly to mains (or another UPS) to survive a UPS failure.

Design of a solution

In my case I counted the number of devices I would need to connect there. It's roughly 16 in the rack, counting servers and switches. The total power is very low, around 70W, which means that I can use fanless power supplies.

Most devices take 12V on input. Some other use micro-USB and others USB-C.

I considered having multiple 12V power rails so that a short circuit would only affect a part of the components. I had found the perfect chip for that: TPS259571DSGR. It's a really nice electronic fuse, it supports programmable 0.5 to 4A and automatically re-triggers after a short. But this one comes in a tiny 2mm-wide WSON package with pins spaced by 0.25mm, and after trying for a few hours to solder one on a PCB I purposely made, I decided to postpone because my PCB quality is not good enough, at this level of thinness you definitely need a solder mask or it quickly shorts. I since ordered some PCB adapters for DIL to WSON and will try again later. I would love to spot an equivalent in SOP8 package! In the mean time I finally decided that all 12V connectors will be connected together and that this should be OK. I chose 5.5x2.1mm female jacks for which I will make male-male cables that will connect either to 2.1 or 2.5mm depending on what is needed:

For the USB outputs, we now find a number of QC-compatible multi-port USB adapter boards like this one. They are in fact 4 independent power supplies connected to the same input. They're convenient because you can also use them to extract a fixed voltage (e.g. 12V) using a tiny adapter. I decided to use one to provide 4 USB-A ports and another one for 4 USB-C ports. On another project (controlled USB outputs) I had successfully stacked two USB-C ones and that's what I initially intended, but drilling holes is a real pain and I didn't need that many ports at that moment:

For the power supplies, I thought that blocks designed for LED would be a good fit. These are not very well regulated because they focus on power and not on a perfect voltage. But nowadays their regulation is pretty good, the voltage is accurate to +/- 5% usually, which is much better than what 12V devices accept on input. Contrary to a PC power supply which must deliver a very stable voltage, here the 12V output is never used as-is but passes through other DC-DC regulators, and usually anything between 10 and 14 will be OK. The advantage is that such power supplies are simple, small and very efficient, like the one below that can run fanless up to around 500W. I found various models here and here which looked appealing:

I decided to place the power switch after the PSU, not before, in order to isolate a faulty one from the system. The idea here is probably a consequence of the trauma of replacing faulty power supplies: I want to be able to replace a dead PSU without turning everything off. The switch on the output allows to isolate a PSU from the circuit and replace it. 

Switching power supplies can be connected in parallel. But if for any reason one dies with its output short, it will bring the second one with it. Also, there's no way to know that one is dead when they're in parallel. So I decided to think about a circuit that would connect them together (just two diodes) and also report which ones are working or not (LED before the diode).

My concern was to find diodes that could stand high current but I had not much difficulty finding 20A diodes and stopped on 20SQ045. And since I didn't want to have many LEDs on the front, I had fun scratching my head a little bit to combine colors on common cathode RGB LEDs in order to report the various possible states among:

  • all down (off)
  • this PSU is unconnected or dead (red)
  • this PSU is connected but not enabled, no output (blue)
  • this PSU is connected but not enabled, output from other PSU (purple)
  • this PSU is connected and enabled but diode is dead (cyan)
  • this PSU is not connected and diode is short-circuited (orange) 
  • this PSU is connected and delivering power (green)

All this only with passive components. The final diagram is here:

and the trivial PCB here:

Both can be downloaded in eagle format from my GitHub repository.

I just decided to place everything on the copper side so that I could leave it flat on the bottom of the enclosure.

Construction

Once I received all the components, I started assembling everything. As usual for me the most difficult is dealing with hardware (drilling, cutting etc). I think I did reasonably well overall on this one, without even scratching the front panel:




OK, the holes for the jacks could have been better centered...

It's made of two aluminum corners constituting the front and back panels, screwed to an MDF plate. The MDF is interesting for being an insulator, and also because it's easier to cut than a metal plate:

The PCB was made with my laser engraver with all components soldered on the copper side. The power diodes had their legs rolled as this slightly helps spread the heat if needed. The copper pads were large to stand high currents and permit to be generous with the solder for the large wires:




All the cabling was done using 2.5mm² wire made for house circuitry. It supports 16A under 250V, which means it will not heat enough to melt the insulator over many meters in your walls. Here on short distances like this even at 20A it will become barely warm. And I don't intend to reach 20A anyway. The advantage of using such wires is that they're rigid and make excellent contact on solder joints. Two were stripped and used as bus bars on the jack connectors. Overall I find that the result is not bad at all:

 

Tests

Tests are reasonably simple, I just operated with all 4 combinations of on/off state for the two switches, multiplied by the 4 combinations of on/off state for the mains inputs. I could confirm that the colors are as intended (not well reflected on the photo):






Installation

I initially planned on installing this horizontally in my rack, but found that it was even better vertically on its external side. It allows me to see the LEDs, it helps with cables distribution, improves ventilation and eases operation and checks if ever needed, though for now both power blocks remain cold to the touch:

I have not checked if the overall power consumption has reduced or not. It would be very possible since every power block has a minimum current leak, at least to power the oscillating circuitry. But that should be marginal. What could make a higher difference is the expected higher power conversion ratio of such high-power blocks which can reach 92-94% compared to very low-power ones which rarely aim beyond 70-80%. Anyway I'm not going to reconnect everything just to check!

Amusingly, initially I connected the two inputs on the same UPS, and forgot about it the day I decided to turn the UPS off for a repair... That's when I decided that only one input would be connected to the UPS and the other one directly to the mains. It's also convenient to use color tape on your power strips to indicates which ones are UPS-protected and which ones are not. I'm using red for UPS and blue for mains.

Now let's see how long my devices stay up.

2020-05-03

Build your own Tiny USB Battery

Background


After having successfully built a few tiny USB batteries in the past, I was always left with a bit of frustration about the difficulty to build them. My previous model has been working flawlessly for the last 2.5 years now despite the hackish way it was built, that's undeniably a success!



Once I got my laser engraver and managed to create some quite fine PCBs, I thought it might be a good use case to try to make a PCB for this tiny battery project. This would save me from having to destroy existing PCBs and would make the project much more replicable. It would also standarize the power LED and the button that were added as a hack on top of the previous one. Last thing I wanted was to increase the output voltage to 5.2-5.4V in order to compensate for cable losses, especially when powering various single-board computers (SBC) which drain a lot of power and tend to become unstable under 5V.

Creating a PCB for the battery.


I already mentioned, I'm not good at using Eagle, I find it pretty complicated to do trivial things, even though maybe it allows to easily do complex things. Thierry Fournier offered some help on the project as he's much more fluent with Eagle than I am. He first created the library of components, the schematic matching my needs, and a dual-layer PCB. To be honest I wasn't very impressed with the resulting size, and attributed this to the dual-layer design: vias take a lot of room, and some of the components there appeared large enough to support having copper tracks passing underneath them.

So based on Thierry's schematic I tried my luck with a single-sided approach. I moved and rotated components around until I managed to route it without a single via nor strap. A first version was created, at about 33x22mm, with the charge and power connectors on two adjacent sides:


The result was already quite good:


Given that I had 240mAh batteries of exactly 30x20mm I really wanted to squeeze it further, which led to the final version documented here, whose PCB is 30x20mm, exactly the battery's dimensions.

The result is great, it's flat on one side (PCB), flat on the other side (battery), with the components in the middle between the two. The final version is very dense and requires careful placement of the SMD components, but I had no problem soldering them all with a thin solder iron tip (0.2mm) and thin solder wide (0.5mm). The USB connectors are both on opposite sides this time:


In fact for the final version I even tried my luck with solder paste. For this I produced the GCODE for the stencil mask in Eagle, and used it to cut holes in a 150 microns-thick Post-It paper. It appeared to be exactly the appropriate thickness for the paste. I attached it with duct tape to the PCB and scraped some solder paste on it:


But it seems that paper is not that great for solder paste, it seems to extend a little bit while pulling the paste, and it looks like some places were slightly thicker than expected, probably because more paste accumulates in corners and isn't totally removed.  I purposely did not put paste on large components like the inductor nor for the USB connectors' ground because I didn't want to risk seeing them move under the heat gun and ruin the rest of the circuit, I preferred to solder them by hand.

Despite not being perfect, the result remains impressively good though, and there were very few errors, so I think it will have to be attempted again, maybe with Kapton tape, or with sticking paper, I don't know yet.


Looking closer, it appears that some of the micro-USB connector's solder joints were joined together, that that the capacitors were not properly soldered. This is because they were salvaged from an older PCB (all components were desoldered) and were not clean enough for the solder paste to properly take on them:


This is why I said above that I had to re-solder a number of components using the soldering iron's tip. However the solder paste is very convenient for the IC's thermal pad under the package, which must be connected to the ground plane. And fortunately the IC was properly placed.

Choosing components


The module is still based on a TP5400 or TP5410 IC. The only difference I found between the two is the resistor value to program the charge current, any can be used. One nice thing about this circuit is that it contains a 4A switch with a low on-resistance, and that the voltage sensing is external so it's trivial to adapt it to increase the voltage a bit (there is even such an example in the datasheet).

I salvaged most of the components from a previous TP5410-based module. I wanted to use a higher current inductor. I found that 2.2 and 4.7 uH do work fine and allow the module to deliver up to 2.5A and even peak up to 2.8 at 4.5V output. It's better not to do this for too long though because the IC cooling is performed through the PCB on a single side and is a bit less efficient than the one from the original design. I soldered the battery's positive terminal directly on the inductor's pin:


Regarding the battery, I used LiPo batteries made for drones. The 602030 ones are perfect. They must withstand at least 15C of discharge capacity. However most of these batteries have an internal protection board and most of them are of poor quality resulting in a huge voltage drop as the current increases, to the point of being barely capable of delivering 1.5A under 5V. It's not very difficult to remove the board from the battery, but I'd rather find some unprotected batteries to avoid this annoying step. Till now I didn't find any (the rare ones available are reported as out of stock).


I intended to use a 0.2 Watt LED driven by a 39 ohm resistor, but found that I had in stock a few PCBs salvaged from 220V LEDs. These ones are made of series of five 0.5W LEDs in parallel in a very compact form factor. So I used these PCBs as a replacement for the power LED and reduced the resistor to 15 ohms, after successfully trying 18 ohms on the first version. This gives me roughly 0.5W of LED power without overheating the LEDs, which illuminates very well in dark stairs or in my garage for example.


The USB connector on the final version was larger than expected because I ordered short ones (10mm) but due to lockdown measures in place here I still haven't received them, hence the reason why on the final version it's a bit too deep, and the button was placed slightly outside to align with it.



Some users might prefer to put a male USB-C connector (e.g. to charge a smartphone). But this would require a protuberant part which risks to be damaged. Also instead of a micro-USB connector for the charge it should be possible to use a USB-C female connector. But micro-USB is still more available for me, and this matches what most existing batteries do. Also, there exist tiny USB-A to micro-USB adapters that insert directly into a USB port and which automatically provide a male micro-USB connector. Maybe these even exist for USB-C now, I don't know. The ones I have look like this:



As an enclosure, I used transparent heat shrink tube, then filled everything inside using hot glue, just like for previous models. This keeps the device very compact and solid. I tried throwing it on the ground and it doesn't have any problem. Maybe some people will want to try 3D-printed enclosures, or even molded plastic.



Download files


The source files (schematic, board and library) as well as the output files (schematic in PNG, board in PNG and PDF) are available here. There's nothing particularly tricky in the assembly process, except maybe hacking with the battery's connections. It's particularly important to be careful not to make a short circuit while soldering the battery, especially the one without the protection board! I don't have any good recipe for this except lots of care.


There's a dual-color LED to indicate the charging status. The common track is the anode (+), the left LED (connected to pin 2) is the red one (indicating it's still charging), and the right LED (connected to pin 4) is the greed LED (indicating standby mode or end of charge). The layout was made to also support installing individual LEDs (which I did on my second version). When connected to a charger, it should light red during charge and green once fully charged. The LEDs are never lit without a charger.


Tests and conclusions


With a 602030 240mAh battery, which is roughly 0.9 Wh, I can power my GL.iNet WiFi router for about 1 hour. This makes an ideal companion to every WiFi/3G pocket router! Below it's connected to my GL.iNet either with a short USB cable or with the tiny adapter shown above.



I can also use my bike's powerful front light for about 20 minutes at normal power level, or about 10 minutes at full power (6W), which is more than I usually need when crossing woods at night.

At this point it goes beyond a proof of concept as it's possible to build them by hand in about 2 hours, including the battery modification. What takes most of the time is finding suitable components like the high current inductor, or soldering tabs on the LED bar. But for anyone able to source components, the circuit has nothing difficult.

I think that these dimensions are really great, I don't feel the battery in my pocket and have it with me every day. I've even replaced the v3 that I had been using since last article. Some people might prefer to have a bit more energy. There are slightly larger batteries with even more capacity. I like a lot what can be found in the range of 800 to 1200 mAh, with widths up to 35mm and lengths up to 45-50mm. But many of them are much thicker, up to 10mm. It's possibly not that big of a deal when using a thinner PCB, as it's possible to save one millimeter here.

Another idea would be to replace the flat, empty PCB surface with a solar panel and have it charge the battery. But at such dimensions, even the most efficient panel would take ~10 hours in full sun to charge a small battery so it doesn't seem really interesting in the end.

Overall I'm extremely satisfied with this design. The next step for me would probably be to be lucky to find it pre-made by someone who can design complete devices and source the components! I think I'd be OK with paying up to about $5 for such a device, maybe a bit more if the capacity gets slightly larger, provided the strong power is still present.