Post series about creation of AuxPower1U device

AuxPower1U: Requirements

This is post 1 in the series (next: Features).


As part of my home server setup, I have a few devices that have “free-floating” power supplies. For example, my modem, my wireless PoE adapters, and a few test boxes all have their power supply pushed into rack’s nooks and crannies. Even worse, since I want to have the capability to reset them, they are connected via ResetBox (or its type-C variant) making cable situation even messier. It’s way beyond time to sort that out!

In this blog series, I will go over what’s needed to design a nice 1U box that can fit all (or as many as I can) different power supplies togethe. Their outputs should be resettable by physical buttons on the device’s front. Since I actually didn’t finish the project as I’m typing this, expect the series not only to last a few months while I gather all necessary equipment but also for my “specifications” to shift slightly as I discover new things or rethink my old ways.

At first, let’s look at what power supplies we have currently:

  • 12V 25W: Arris SURFboard Modem
  • 22V-57V 20W: Mikrotik hAP ac
  • 24-57V 30W: Mikrotik Audience
  • 12-28V 40W: Mikrotik hAP ax3
  • 19.5V 65W: Dell OptiPlex 3050 Micro
  • 12-19V 65W: Intel NUC
  • 54V 15W: Netgear GS305EPP (150W max)

If I squint hard enough, there are three distinct power supplies to use there; the first one being a simple 12V power supply for modem. Power usage will be really low on this one, so any hardware we place will run from it too.

To the second power supply, I had to give a bit more thought. Without question, it has to run of the UPS but its target voltage is a bit of an unknown. Currently, I am running my hAP ac and Audience from a 20V type-C power supply, and Audience doesn’t seem to love it as any minor transient causes reset. And yes, officially Audience doesn’t run that low, but I got lucky, I guess. Previously, I was running my WiFi routers on 48V and both were fine with that; so there are my two daya points. Considering other devices, I was leaning toward selecting 24V as a second power supply.

However, that leaves my NetGear PoE switch a bit of a loner and outside of The Box. For it, I would need to provide a proper 55V PoE power supply or at least 48V if stars align. The downside of this approach is that it leaves my Mikrotik hAP ax3 either on 12V or for the last, non-UPS power supply. But the upside is that it allows for a bit of future-proofing.

That leaves 2 non-UPS computers. Why are they not using UPS? Well, in my setup, UPS power is really limited and is reserved for only two categories: my main server and my Internet delivery devices (modem, router, WiFi APs). Anything else just needs to handle a power loss. These two computers fall into “anything else” category.

Intel NUC, we can already see, is flexible with a power supply specification. When it comes to standard industrial voltages, it can handle both 12V and 15V inputs. However, it Dell bretheren officially are not that flexible. While there is a possibility my 3050 micro would work on 15V, anything higher is a no-go. And since Dell authenticates its chargers, to figure this out, I’d need to trick it first into accepting such voltage - all of which smells like another sub-project. :)

If Dell doesn’t want to cooperate, the only way forward would be to use one of many buck modules intended for RVs that brings 24V to 19V. I would really like to avoid this, if possible, because the last thing I need is yet another power supply. However, it’s good to have options. And yes, ideally, I would find a 19V power supply; but I have a feeling that finding one that can be properly mounted inside a 1U case is not going to happen.

This brings us to the following rough power supply distribution (with a bit of derating on power specification):

  • 12V 150W (100W if I kick out Mikrotik hAP ax3 from my network):

    • 25W: Arris SURFboard Modem
    • 25W: Control boards
    • 40W: Mikrotik hAP ax3
  • 15V/19V/24V 200W (150W should be realistically more than fine):

    • 65W: Dell OptiPlex 3050 Micro
    • 65W: Intel NUC
  • 48V/55V 100W (going higher than this might be good for the future PoE devices):

    • 20W: Mikrotik hAP ac
    • 30W: Mikrotik Audience
    • 15W: Netgear GS30s5EPP

There is an alternative at a bit lower voltage:

  • 12V 75W

    • 25W: Arris SURFboard Modem
    • 25W: Control boards
  • 15V/19V/24V 200W (150W should be realistically more than fine):

    • 65W: Dell OptiPlex 3050 Micro
    • 65W: Intel NUC
  • 24V 150W

    • 20W: Mikrotik hAP ac
    • 30W: Mikrotik Audience
    • 40W: Mikrotik hAP ax3
  • Out-of-scope

    • 15W: Netgear GS30s5EPP

I am strongly leaning toward option 1, but option 2 is a good alternative. And yes, Mikrotik is not as power hungry as it seems above; I’ve never seen it reach its maximum power usage. However, since I really love my network, I use those numbers to bring an additional margin to the dimensioning process. If I find a nice power supply that’s slightly below what I need, I will get it and not worry about it. But, before I get to that, this fudged accounting provides more visibility into what brings the most value.

For various protection circuits, I’, going to rely onto power supplies to protect themselves. Thus, at minimum, I expect any selected power supply to have over-voltage, over-current, short-circuit, and over-temperature protection built-in.

When it comes to controlling this, I would say that ability to reset my Modem and WiFi is a must. And these can be two buttons as I want to be able to separately restart modem. For the hAP ax3, I don’t care as much since it has “under test” status in my network at this time. But let’s argue that it needs to be a separate button. At this time, I do control each of my computers inside the rack via smart plug so moving them into The Box, I might want to see a button for each, but I wouldn’t really mind if both go down at the same time. This brings the total number of reset buttons to somewhere between a minimum of three and a maximum of seven.

Lastly, this blog post leaves us with the following action items I will probably get around to solving:

  • Chck can Netgear GS305EPP work on 48V
  • Make trigger board for Dell
  • Check does Dell Optiplex 3050 Micro work on 15V

AuxPower1U: Features

This is post 2 in the series (next: Case Selection, previous: Requirements).


In my previous post, I split all my desires into two categories: requirements and features; requirements being something mandatory while features being something that is nice to have. In reality, the line between them isn’t really as clear so you can view this just as an addition to the first post.

When it comes to features, the main externally visible functionality of my consolidated power supply box will be the ability to reset devices from the front as I currently have with ResetBox.

While this is a requirement, the exact button count is a bit more flexible since the primary function of them is to provide a quick reset of the Internet for my family when I’m not around. Considering that, the minimum would be something like this:

  • Button 1: Arris SURFboard Modem
  • Button 2: Mikrotik hAP ac, Mikrotik Audience, and Mikrotik hAP ax3

However, while I have other means of resetting devices, I also like buttons so my desired setup might be something like this:

  • Button 1: Arris SURFboard Modem
  • Button 2: Mikrotik hAP ac, Mikrotik Audience, and Mikrotik hAP ax3
  • Button 3: Dell OptiPlex 3050 Micro
  • Button 4: Intel NUC

Let’s add one more button to account for possible future needs, and this brings us up to a total of 5. Please note there is no requirement that the button count matches the physical layout (i.e., one button could reset two different outputs), but I like to have it setup like that nonetheless. It just simplifies configuration immensely if I keep that link.

Functionality of buttons is to remain the same as it is for ResetBox; i.e., they should handle brief touches without any action, and reset should be “hidden” behind a longer press. Also, if one keps pressing button for a long duration (e.g., more than 10 seconds), the reset should be cancelled.

I might as well try to include some monitoring for both voltage and current. This is easy enough to implement, and it would be a shame to miss such opportunity. As not to go overboard, just monitoring output lines will be sufficient since I can already see that monitoring both input and output would take a lot of board space.

In order to display that data, I would definitely like to go with OLED, albeit I can already see mounting it on the front will be a challenge no matter which case I select. Thus, I might not bother making it user-visible, but I would still like to have it on board so my development and troubleshooting can benefit from it. I trust 128x32 will do.

For real-time monitoring, I would like to have either UART, RS-232, RS-485, or CAN-bus output. Since each of those requires different components, I would need to make that decision eventually but not necessarily now. I am tentatively leaning toward CAN-bus due to its resilience; but let’s hold the final decision for now.

Lastly, having an idea of the temperature might be beneficial. While precision is not really important, there should be a sensor somewhere on the board that will give us a ballpark figure of how hot we’re running.

That’s all I really want from this project. Now, onto figuring out the details.

AuxPower1U: Case Selection

This is post 3 in the series (next: Dell Trigger, previous: Features).


Quite often, I like to start my projects with a case selection. Since I have quite a few hardware projects under my belt, I also have a fair idea of how much space things are going to take. Despite this, in reality, I sort-of overlap the selection of case with the selection of the largest components; in this case, power supplies. I will cover power supplies in a future blog post; suffice it to say that I determined 200 mm of case depth would suffice.

Based on that, I wanted a 19" 1U rack case with a depth of 200-250mm. The width and height were fully determined by the 1U factor, while the depth was selected as not to interfere with other components. For power supply health, I also wanted to have some cooling slots.

Representative of a cheap case was AliExpress Lang Lang coming in at only $32. It’s made of aluminium, has slots, and gets offered in depths of 200mm (1), 250mm (4), and 300mm (3). However, the specification is a bit unclear as to the rear panel. One picture makes it seem as though it’s predrilled, but on another, it seems to be one-piece. I find this case to be as close as it gets match to my requirements.

Even cheaper variant is AliExpress Tokban at $28. It has no slots, but that’s not an issue since drilling aluminium is not an issue. And it already has power supply input cutout, so that’s a bonus. On the negative side, its dimensions seem to be higher than 1U would allow. There is a high possibility this is just a typo. Also, considering I need 2 AC inputs, I’m missing a second cutout.

All other cases I found on AliExpress were just a variant of these two.

My other source is always DigiKey and I started my search by filtering on basic case properties.

The cheapest case I found comes at $34 in form of Bud Industries PRM-14460. This one is 200 mm deep and already has some mounting options inside. I am not as worried about structural stability since it will sit on top of UPS, but structural supports inside do fragment the internal space a bit.

Another interesting case is Hammond RM1U1908VBK, but I try not to even look at it too hard due to its high price of $158. Yes, it’s built better than any other case in this list, but the premium cost doesn’t justify it for this project. That said, for some other projects, this might be a really nice option, so I’m placing it as an alternative here.

At this time, I am leaning toward a plastic option with Bud Industries PRM-14460 since plastic seems the most promising material to mount an OLED screen. If mounting stuff inside proves to be much of a challenge, my backup option is AliExpress Lang Lang since it allows for more freedom when it comes to mounting and it also has a deeper 250mm option.

AuxPower1U: Triggering Dell

This is post 4 in the series (next: Power Supply Selection, previous: Case Selection).


Illustration

One action item mentioned way back in the first post, was discovering if a Dell Optiplex 3050 Micro can handle voltages lower than its specified 19.5V. However, you cannot just check that by plugging in any old power supply. No Sir, you need to have a 19V charger blessed by gods and naked virgins who dedicated their life to making sure your Dell equipment is not using impure power like those other peasant computers do.

However, since I am unworthy of such service, I decided to see about bypassing the same for three reasons. The firs2024t one is that it makes my life so much easier if I can use any old charger in case my current charger dies. Secondly, it really messes with my goal of consolidating power supplies if I need to take special care of Dell.

Before I went onto deciphering the charger protocol myself, I decided to check if someone had already done the work. And, wouldn’t you believe it, someone did. Even better, the author provided all the information one might need. The only thing I had to do was to make a PCB. So make a PCB I did.

The final board consists just of a resistor in series with the EEPROM data line and a zener diode for overvoltage protection between the data and ground. The value of the resistor is not really important but original charger uses 330 so that’s what I went with. Zener is also not critical so I went with 5.1V one I had laying around - go, mini-MELF, go!

The main part is a 1-wire EEPROM memory, either DS2501 or DS2502. And yes, you can program that EEPROM yourself, but there is actually a source of preprogrammed memory on AliExpress. That is way easier than dealing with 12V pulses programming this memory requires. There are some reports suggesting you can use DS2431 (with much simpler programming model) but buying preprogrammed stuff was easier.

As for the Dell connector, I was originally planning to cut the existing cable but Amazon had some pigtails available so I opted to use them and keep my original charger for emergencies. On the barrel connector side I found that a DC 2.1x5.5mm connector intended for panel mounting has spacing that fits a 1.6mm PCB perfectly.

With PCB and all parts ordered, the only remaining work was to assemble, wrap it in heat shrink, and finally test whether 3050 is properly charging at 15V. Will it? Well, it will!

Based on the old method of “try and see what happens”, I could power on my Dell starting as low as 13V. While that was the lowest voltage it booted on but I found it would ocassionally “stutter” a bit. However, when I bumped it to 14V, all looked the same as when running at the official 19.5V. For all practical purposes, you can view the Dell Optiplex 3050 Micro voltage range as 14-20V.

And yes, all standard disclaimers apply, especially given that it’s a test sample of one. For this use case, I only care about my setup, so this is sufficient. However, I am willing to bet that pretty much all other similar Dell machines behave the same.

In any case, this smalll board enables me to emulate Dell charger at lower voltage, thus allowing use of 15V power supply. This gives me access to a more common voltage in embeeded electronics (way more common than 20V that’s usual for laptops) and it also proves that both my NUC and Dell can both drink power from the same faucet.

AuxPower1U: Power Supply Selection

This is post 5 in the series (next: Cooling, previous: Dell Trigger).


When it comes to power supplies for embedded electronics, it’s really hard to beat Meanwell. They are easily available, they have a wide selection, and they are reasonably priced. Thus, my search for power supply started with the first Meanwell catalog I found.

After testing the Dell trigger board, my power supply setup crystallized to 48/55V (for my routers), 15/20V for computers, and lastly (optionally) 12V for a modem. Why do I say “optionally”? Well, the option of using a buck regulator for the modem is always open. Since I have my case dimensions predetermined, the choice on whether to use 2 or 3 power supplies will be mostly driven by their dimensions.

As 1U severely restricts the height, my choice fell onto four power supply families:

I wanted to get as small as possible (can I fit 3?), a reasonable amount of power at each voltage (100W+, especially for 15V needed by computers), a reasonably small ripple (less than 200mA, if possible), tight voltage tolerance (1%, ideally), high efficiency (90%+ desired), and lastly robust overload controls (ideally with auto-recovery). Looking at the catalog, I placed the following power supplies on the short list:

ModelOutputPowerTolRippleEffDimensions
LRS-35-1212 V 3.0 A35 W±1%120 mV86%99 x 82 x 30
LRS-50-1212 V 4.2 A50 W±1%120 mV86%99 x 82 x 30
LRS-100-1515 V 7.0 A105 W±1%120 mV90%129 x 97 x 30
LRS-100-4848 V 2.3 A100 W±1%200 mV91%129 x 97 x 30
LRS-150-2424 V 6.5 A150 W±1%200 mV89%159 x 97 x 30
LRS-150-4848 V 3.3 A150 W±1%200 mV90%159 x 97 x 30
RS-50-1212 V 4.2 A50 W±1%120 mV84%99 x 97 x 36
RSP-150-2424 V 6.3 A150 W±1%150 mV89%199 x 99 x 30
RSP-150-4848 V 3.2 A150 W±1%250 mV90%199 x 99 x 30
RSP-320-4848 V 6.7 A320 W±1%240 mV90%215 x 115 x 30
UHP-200-1212 V 16.7 A200 W±1%240 mV93%194 x 55 x 26
UHP-200-1515 V 13.4 A200 W±1%240 mV94%194 x 55 x 26
UHP-200-2424 V 8.4 A200 W±1%240 mV94%194 x 55 x 26
UHP-200-4848 V 4.2 A200 W±1%240 mV94%194 x 55 x 26

ModelInputC OverloadV OverloadPFCFanCost
LRS-35-1285-264 VacY (auto)Y (repower)NN$13
LRS-50-1285-264 VacY (auto)Y (repower)NN$14
LRS-100-1585-264 VacY (auto)Y (repower)NN$17
LRS-100-4885-264 VacY (auto)Y (repower)NN$19
LRS-150-2485-264 VacY (auto)Y (repower)NN$19
LRS-150-4885-264 VacY (auto)Y (repower)NN$25
RS-50-1288-264 VacY (auto)Y (auto)NN$19
RSP-150-2485-264 VacY (auto)Y (repower)YN$39
RSP-150-4885-264 VacY (auto)Y (repower)YN$43
RSP-320-4888-264 VacY (auto)Y (repower)YY$54
UHP-200-1290-264 VacY (auto)Y (repower)YN$58
UHP-200-1590-264 VacY (auto)Y (repower)YN$54
UHP-200-2490-264 VacY (auto)Y (repower)YN$57
UHP-200-4890-264 VacY (auto)Y (repower)YN$59

After tinkering with a couple of combinations, including using power supplies from different families, I decided on a homogenous UHP-200-XX setup. They have ridiculously low profile, high power, and high efficiency. On the downside, they do have a bit of a ripple and their cost is quite a hit.

Another setup I could go with would still have UHP-200-15, but combined with LRS-50-12 and LRS-100-48. The downside of this approach would be a bit of a crowded central setup and less robust power supply.

The three power supplies I ended up with are UHP-200-12, UHP-200-15, and UHP-200-55. While the last one might be a surprise since I was leaning more toward 48V, the 55V version has unusually wide adjustment range (45-58V). This means it covers both 48V and 55V thus allowing me some flexibility.

If you look into their datasheet carefully, one will notice that these power supplies require quite a big heatsink. But alas, we cannot solve everything today; there needs to be something for a future me to deal with too. For now, I need to order these three before I change my mind again.

AuxPower1U: Cooling

This is post 6 in the series (next: Fan Controller Design, previous: Power Supply Selection).


Illustration

While power supplies are selected, a huge elephant in the room remained - how are we going to cool these? Well, good news - strictly speaking, we don’t have to, thanks to the miracle of derating.

If we check the datasheet, there is a derating curve where it tells us that (without any heatsinking, at 70°C, using puny 110V) we can count on about 40% of the power. So, if we don’t go over 80W, everything is awesome. And I would argue that even running two NUC machines on my 15V power supply (most loaded one) will be under that.

But we can do better. The 1U case doesn’t allow for a lot of natural air circulation. Even though UHP series is fine with being restricted, for their longevity, it’s better if we get rid of at least some of those darn Celsius.

First thing we can add here is an aluminium plate. Adding a small 200x175x3 mm chunk of aluminium will not only do wonders for distributing heat, but also make their mounting easier. And it’s surprisingly cheap these days to get a pre-cut plate with holes at the perfect location for the power supplies. I got mine at SendCutSend for $35, delivered. It’s not as cheap as if you have tools and/or patience to do it yourself, but it’s not going to break the bank either.

With the plate in hand, we can use M3x6 screws and nuts to fasten power supplies. Adding a bit of thermal paste and screwing 4 screws per power supply is all it takes. Yes, we’re not using a plate as big as recommended in the datasheet, but this isn’t nothing to laugh about. Even better, I can actually use this plate to stiffen the whole case a bit after I mount it. How? 3D printed rails sound as a good idea.

In addition, I have decided to add a few fans to keep the air circulating so we don’t get even close to overheating. Realistically, as long as we have some air movement, these power supplies are going to be fine. On other hand, since I am overbuilding this thing to start with, I can build temperature-sensitive fan controller too.

But that’s a story for the next blog post.

AuxPower1U: Fan Controller Design

This is post 7 in the series (next: Fan Controller, previous: Cooling).

This post is sponsored by PCBWay.


I haven’t tried to build myself a fan controller, I swear. My original plan was to get one of many PC fan boards and call it a day. However, I was surprised at how little of those fan controllers could properly work without PC. Even worse, most of their fan profiles would cause my 1U fans to scream. So, making my own became easier solution than figuring how to make the existing ones work.

First, about the fans. I had 1U case that was made of quite thick plastic. That left only 36.576 millimeters to work with. If we round down this overly precise number in order to account for some tolerances, the biggest fan I can place here is 36x36 mm in size. And that’s definitely not a standard size you’ll find in your desktop computer. However, it’s standard enough for there to be multiple fans of that size. I opted to got with Delta FFB03612EHN primarily due to its 36x36x28 mm dimensions that would just fit into my case. But my second concern was not less valuable - it was a PWM controlled fan. When it comes to fans, you have 3-pin ones that always run at the same speed and the only way to slow them down is to lower the voltage. This wasn’t what I was interested in. I wanted 4-pin fans that have PWM signal for speed control. And my Deltas were just such fan.

To control pretty much any fan speed, you need to have a 25kHz PWM signal. There is quite a bit of latitude allowed (for Delta fans, it’s usually 20-30 kHz) but different fans have different tolerances, so keeping it as close to 25 kHz is probably the best idea. Fan speed itself is not controlled by PWM frequency but by duty cycle. If the duty cycle is 50%, you run fan at 50%; if the duty cycle is 25%, fan runs at 25%; if the duty cycle is 75%, you get the drill…

Officially, a duty cycle control needs to be done by an open-drain output. That is, you only ever pull the PWM signal down, letting it go to the fan’s internal 5V pull-up for the rest of a PWM cycle.

Keeping this in mind, I went to search for a microcontroller I could use for the project. It had to be low-pin count, so I don’t waste a lot of PCB space; it had to have hardware PWM, so I don’t need to bit-bang; it had to have open-drain PWM output; it had to have an analog input for temperature; and lastly, I had to have one available in my drawers.

Looking at Microchip PICs I had available, I quite quickly went toward the PIC12F1501. This one is a little gem. It has not one, but four PWM channels thus allowing me to control 4 fans in a completely independent manner. It also has 4 ADC channels (some pins overlap) thus allowing for an external temperature sensor (I had MCP9701A lying around). It even has an internal temperature sensor which is the fact I noticed only once I already had my PCBs made, so I ended up not using it.

But you will notice it didn’t have one thing I needed - an open-drain PWM output. However, since the pull-up value within the fan is specified to be a maximum of 5.25 V, I was reasonably sure I could ignore that. Any voltage differential would be small and thus any extra current going through pull-up resistor would be way lower than the current it already had to carry during its “off” cycle when it gets connected directly to GND. In short, I was willing to ignore this part of the specification.

After messing around in KiCAD for a while, I had my design finished and it was off to my sponsor, PCBWay, to manufacture the PCBs. But let’s continue that part of fan controller story in the next post.

AuxPower1U: Fan Controller

This is post 8 in the series (next: Switching the High Voltage, previous: Fan Controller Design).

This post is sponsored by PCBWay.


With all design decisions done in the previous post, it was time to get PCBs made. As PCBWay was interested in the project, it was an easy choice. :) That said, if you go to my GitHub, you’ll notice I have many more electronics projects that I haven’t gotten around to write about and they are not sponsored by anybody (patience of my wife, excluded). Yet still, I quite often go for PCBWay anyhow.

Illustration

In this particular case, PCB was simple enough that any manufacturer would be able to produce it. Or so I thought before PCBWay contacted me due to an issue. You see, my KiCAD export workflow relies on a script. Thus, usually results are quite repeatable. So I thought it was a false positive. But nope - PCBWay was right, I had some of my layers swapped - darn copy/paste when I was updating the script. I am not saying that some other manufacturers wouldn’t catch this, but it wouldn’t be a surprise if I got wrong PCBs due to this mistake on my part. With PCBWay, I never managed to sneak an error by them.

Once the board arrived, I started creating firmware and the first step was generating the 25 kHz PWM signal. A few initialization settings later, I had a perfect 50% duty cycle signal. So I connected my fans only to be surprised by their noise. I mean, I expected some noise - those are server fans after all. But I also expected that noise at 50% wouldn’t be that bad. Then again, they did move a lot of air, so I decided to bring PWM down to 10%. And… fans were equally loud and moved an equal amount of air.

It took me a few visits to the fan datasheet to notice one discrepancy. Unlike normal PC fans that have PWM on wire 4, Delta’s have PWM on wire 3. Wire 4 is the tachometer output. Why the heck they opted for a non-standard pinout is beyond me; but I am sure there is some historical reason behind it. In an case, I swapped wires to be in a standard fan arrangement and what I got was almost silent cooling.

Illustration

Since I don’t know how much cooling I’ll need, I opted to have 3 fans together. And while this was probably an overkill because these beasts move air like there’s no tomorrow, it also enabled me to keep fans at low speed by default, going up in speed (and noise) only when temperature requires that.

So, after consulting the power supply datasheet, I decided on the following curve:

  • 10% speed until it reaches 40°C
  • speed linearly increases up to 50% between 40-60°C
  • stay at 50% up to 70°C
  • if above 70°C, go to full 100%

The idea behind this is to balance fan noise and cooling, unless we get into temperatures that might jeopardize power supplies. Since my selected power supplies shutdown at 85°C, giving them some cooling buffer seemed like a good idea. Mind you, I don’t expect them to ever reach that temperature, but it’s nice to know that fans will do their best, if they do.

Those reading fan datasheet will notice that, while fans work just fine at low RPM, they do require 30% PWM to start. Such requirements are the reason why, on servers, you will hear fans running at 100% for a few seconds before slowing down to normal speeds - they have to ensure successful startup. For me, I didn’t need to be that aggressive but I still wanted to give them a decent chance. So, every time power is applied, the fan controller will push 30% PWM out for 500ms, followed by a 250ms burst to full speed.After that, speed goes down to 10% and temperature control loop takes over. Just to be fancy, not all fans spin at the same time, but are offset by 250ms. There is literally no reason for this other than it giving an interesting sound profile.

Illustration

I mentioned temperature a few times now, so you might be wondering how I am measuring it. The nswer is the MCP9701A temperature sensor. It gives you a temperature range from -40°C all the way to 125°C with a slope of 19.53 mV/°C. While this number looks a bit crazy, it actually translates almost perfectly into 4 bits (10-bit ADC) per °C if you use a 5V reference input. Since I don’t expect sub-zero temperatures, my temperature calculation is as simple as removing 82 bits from the raw reading to make the scale start at 0°C and then dividing the whole thing by 4 (those wanting to optimize would simply use shift operation here).

Now, PIC12F1501 does have an internal temperature sensor you can use. And that would work in a pinch, but it’s not without its drawbacks. The first one is that it measures the die temperature, that varies not only due to external temperature, but also based on what’s happening in microcontroller itself. If you drive a lot of things, your reading will be higher even though external temperature remains the same. Other, probably related issue, is its instability. It’s not what you would call a precise sensor to start with, but then you’ll have to deal with smoothing out data coming out of it because it can change value by couple degrees in mere seconds. It’s not that you cannot filter those things out - an long-period averaging will take care of that - but it’s just a pain in the butt. Thus, I went with a proper temperature sensor.

There are some things I intentionally omitted. But one that causes the most doubt is speed readback. There are two ways I could have gotten that feature for free. One is to only have 3 channels, which would allow me to use 3 pins to control PWM and 3 pins to read back the speed. Yes, that would also mean switching to the internal temperature sensor, but I could make that work. Other way of doing that would be to have just 1 PWM signal going to all 4 fans, 4 speed inputs, and that even leaves 1 pin for a temperature input. But then the question becomes “why”.

Since this board is a standalone thing, there is literally no way of letting the user know that one fan is stuck. Yes, it could have enabled an even smoother startup (since I can verify it’s started instead of blindly going to 30%) but, other than that, there is simply no use for it. It would only make sense if I went onto a bigger microcontroller so I can have UART or I2C connecting it to the rest of the system, and I think that would be overkill.

And no, the system as a whole will not kill itself if fans stop spinning. My other part is controlling power supplies and that board will have its temperature sensor. If temperature goes dangerously high (e.g. because fans are not spinning), that board is in a situation to either stop overloaded power supply, inform the user, or do whatever I deem necessary in that situation. After giving it a lot of thought, I decided to keep it simple.

Source for PCBs and firmware can be found on project’s GitHub pages. And in video below you can see the fan controller startup in action.

AuxPower1U: Switching the High Voltage

This is a post 9 in the series (next: Main Controller PCB, previous: Fan Controller).


Illustration

Using a MOSFET as a switch is easy. Select any P-MOSFET, make sure it works at your board’s logic level, supports enough sweet amps, and you’re golden. I can almost guarantee that any MOSFET that satisfies those parameters will be good enough. Just pull it down to earth when you want lights to go out.

However, this doesn’t work for high-voltage DC circuits. Now, people can disagree on where the “high voltage” begins. When it comes to switching DC power, for me that limit is somewhere around 20V. This is the limit where you cannot use “normal” components without care, nor can you expect your circuits that worked just fine to continue operating. It’s the land of magic smoke.

For AuxPower1U, power supplies go up to 60V. And it’s not hard to find a MOSFET that goes that high. However, driving that MOSFET is another story. In order for it to be fully off, you cannot just use 5V - that’s not high enough to turn the MOSFET off if there’s 60V passing through it.

Illustration

A simple solution is just pulling the gate up to your switched voltage - 60V will definitely turn it off. The only problem is that this also brings 60V at your microcontroller’s doorstep. But, with a bit of thought, you can see it’s not a catastrophic issue - an optocoupler or even a simple transistor will provide enough isolation to keep the microcontroller happy.

But more devious problem lurks underneath - often overlooked Vgs specification. Most of the time, you only get a 20V difference between gate and source to play with. In practice, to drive 60V, you can only go as low as 40V on the gate. Going all the way to ground is definitely out of question.

Illustration

To resolve this, we can (ab)use the fact that a MOSFET has quite a high input impedance. Thus, a humble voltage divider will allow us to keep it at just below 20V of difference. In a 60V case, that means 10K/24K resistor values resulting in about 18V of voltage difference. If we want to be extra safe, placing a zener diode will further limit the maximum voltage. Ideally, you want the zener’s voltage rating to be slightly above the expected voltage (while still under 20V) in order to minimize power usage. In this case, an 18V zener will do nicely since the voltage divider sits just under that voltage.

Making this circuit usable for many different voltages involves a decision on the minimum voltage and setting up a voltage divider to the minimum viable Vgs value. We expect the zener to “clip” higher voltages so that’s the only calculation you need. Zener’s power rating is not really important in this case since the currents involved are low enough.

Of course, having a working switch is just the start of the story. Depending on your needs, you might need to fiddle with the circuit a bit. For example, increasing resistance lowers power usage but it might not work properly over the whole range (moslty dependant on the MOSFET input leakage). And let’s not even go into what happens if we want to do fast switching.

This is a generic, high-voltage MOSFET driving circuit intended for “slow” switching of DC voltage, and it’s a good starting point.


PS: Yes, I know that I am missing a minus (-) sign in front of many voltages since we are dealing with P-MOSTFETs. I decided to remove them for clarity.

AuxPower1U: Main Controller PCB

This is a post 10 in the series (previous: Switching the High Voltage).


Well, after many posts about my AuxPower1U project, it came time to show the star - the main controller board. Its function is to pass voltage from input to output, interrupting it when necessary.

Illustration

Due to cost and limited space for actual mounting, I first defined the size. Since I wanted to use Phoenix MC connectors, the width had to be 90mm in order to accommodate 5 4-pin outputs. Since I will be mounting power supplies on its right side, all 5 2-pin inputs will go there. On the bottom, I have 5 3-pin connectors for a switch and its LEDs, so the height ended up being 90mm too. And yes, that’s under 100x100 mm limit that stays within PCBWay’s $5 offering.

That said, mounting the board, which is 90x90 mm, would be problematic since it almost touches my power supplies. To avoid having everything too crowded, there is a 30 mm deep cutout allowing for much easier plugging and unplugging. And yes, that did make routing slightly more complicated thus requiring slightly narrower traces than I would usually prefer.

Upload to PCBWay was as easy as always and I probably had my order ready in 10 minutes. Manufacturing was a bit slower for blue PCB I decided to get, so you mgiht want to go with green soldermask if speed is of essence.

PCBs that arrived from PCBWay were as good as always. I opted for a standard HASL surface since I didn’t use any troublesome components. The smallest pitch on my board was 0.5 mm and PCBWay’s HASL is more than sufficient for this. There was an option to go with 2oz on the the board but I opted to use wider traces instead. Yes, a 2oz pour is better for temperature, but it does bring the price signigicantly up.

Illustration

PCBWay offers FR-4 at their baseline PCB material and, during my testing, I went over 100°C for multiple hours with multiple cool-down cycles. There was no sign of delamination and thus I am fairly comfortable this PCB will handle all the power I need without any issue, especially since there will be fan cooling it down. Furthermore, since I do measure current, firmware can easily cut off power if things go crazy.

All connectors and status LEDs are on the top of the PCB, with the actual chips delegated to the bottom. I believe this gives it a better look overall and greatly reduces the chance of me accidentally knocking a component off udring installation. As you can see, this whole thing sits in a PCB case with a brace holding it down. What you don’t see are the holes underneeth, alowing for air to pass.

On top, there are also UART and I2C connectors. The UART connector goes into a 2.5mm audio jack, allowing me to both connect and control the device via computer. The I2C connector goes to an OLED display, which provides a bit more feedback than just buttons on its older sibling ResetBox had. Both are really optional for the functioning of the device but they’re a nice addition to have.

Illustration

On the electronics side, everything is driven by a PIC18F26K83. I had a few leftover from the previous project so I decided to use it despite not having sufficient pin count for what I wanted. I wanted to measure voltage and current (5 pins each), react on buttons (5 pins), control button LEDs (5 pins), control the output (5 pins), use UART (2 pins), I2C (2 pins), and a few auxiliary functions (e.g., temperature). Add ICSP, and it’s clear that the PIC doesn’t have enough pins. But an IO expander does.

So, PI4IOE5V6416LEX got the duty of controlling output, buttons, and LEDs, while ADC measurement and communication were left to PIC. The only loss of functionality was LED dimming, which I used to indicate different states before. However, I can still do blinking, and having an OLED actually alleviated the need for dimming greatly.

One downside is that, if I2C communication goes down, so does my capability of turning outputs on and off. With a benefit of hindsight, I should have probably kept the outputs on the PIC - I even had exactly 5 pins extra available. But that thought only occurred to me after I both designed the board and wrote the majority of the firmware. Since testing didn’t show any issues with I2C despite my best efforts to break it, I will keep that change for potential revision C.

Revision C? That implies that my current board is revision B, and thus it follows that something bad happened to revision A. Well, story of mistakes will follow in the next blog post.