Bad things happen when programmer finds a soldering iron

AuxPower1U: Fan Controller

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


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: Fan Controller Design

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


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: 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: 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: 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: 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: 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: 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

Powering External Devices while Protected

Illustration

I have designed a few framework expansion cards already, but I tried to keep them data-only interface. That is, I avoided providing power as much as possible. And, in my opinion, that’s the proper way of doing it. However, what if I occasionally want to provide some power too? Can it be done (reasonably) safely?

Considering my intentions of using an expansion card, and thus sourcing power directly from the laptop, my goals were to avoid the two most common issues: current backflow and current limiting.

While using fuses for current limiting is a traditionally accepted method, it’s neither precise nor fast enough to protect a laptop. Fortunately, there are load switches that allow for not only precise current limiting but also for fast response.

My choice fell onto AP22652Wx family. These devices allow for quite precise current limiting using external resistor, short-circuit and reverse voltage/current blocking. All that in a small SOT26 (aka SOT23-6) package.

As it often goes, we do need a few external components too - at least one resistor (to limit current) and at least 100 nF decoupling capacitor. Realistically, if you’re not sure what gets connected on the other side, you need a few more capacitors. I usually opt for 100 nF/10 μF combo on both input and output. And here is the biggest disadvantage of using load switch - quite a lot of PCB real estate.

Second issue I mentioned (current “backflow”) is also known as reverse current. This happens when one accidentally connect a positive voltage to a power output. As often in life, bigger force “wins” and thus current will start flowing into the output pin. When that device is a framework expansion card powered by laptop itself, this is definitely not the most comfortable situation.

Load switch I selected does offer basic reverse-current protection, but I wanted a bit of a foolproof solution and that comes in the form of a humble diode. Such forward biased diode will allow current to flow towards output but it will stop conducting if output voltage goes higher than that. And yes, that comes at a cost of voltage drop. However, if you keep current low, voltage drop is still within a few hundred millivolts.

In my case I decided to limit current to 400 mA and thus CUS08F30 I selected has not only healthy headroom with current but it would drop under 400 mV at a full load. Yes, there are diodes that have even better characteristics but this one comes in quite a small package and I already had it lying around.

With theory solved, it was time to test it. For that purpose I’ve created a new Power framework expansion card https://github.com/Medo64/PowerFEC. I used PIC16F1454 to interface it to USB, small ZXCT1009 to measure current, in addition to load switch and diode described above.

PCBs were manufactured courtesy of PCBWay. When it comes to framework expansion cards, they became my go-to manufacturer for two reasons. The first one is their standard routing bit seems to be much smaller than the one used by competition. This is important when it comes to the Type-C edge connector which requires a really small feature that large routing bits will mangle. The second nice thing is that PCBWay doesn’t use break-away connections, opting instead for V-groove. This means the edge is as perfect as it gets, saving me from manual sanding.

And yes, they’re not perfect. They still put their screen markings (you can pay extra to keep it clean). They still use leaded HASL (you can pay extra for non-leaded or ENIG). And sometimes waiting for somebody to manually check PCBs really clashes with my habit of finishing PCBs just before my bedtime thus forcing me to wait (albeit never too long).

But, all in all, those are all things that are minor enough not to bother me too much. I haven’t had bad PCBs from them in ages. Quite often with small PCBs I would get a few more than I ordered. And HASL is fine for pretty much all my use cases. While this PCB was sponsored, I used PCBWay on my own dime without complaint.

In order to make it all work, I decided to reuse my old code and make device behave as a serial port. It will output voltage and current in addition to allowing for a few basic commands (e.g., enable and disable).

After messing with it quite a while, I found protection working pretty much perfectly, thus expect a few updated expansion card designs in store.

As always, hardware and software are available on GitHub

Rendering KiCAD PCB to PNG

Illustration

I have pretty much automated creation of KiCAD export files thanks to its command line interfacehttps://docs.kicad.org/8.0/en/cli/cli.html). However, there was always one thing missing - image for each PCB. Yes, not really necessary for manufacturing but it’s really handy when you want to just quickly check things without starting KiCAD and/or for any inventory system.

Before KiCAD 8, getting a PCB image required exporting to .step file and then converting stuff around. It got complicated enough with all the prerequisites that I have essentially given up. Fortunately, that’s not true anymore, and now we can get .wrl files that can be often used directly.

kicad-cli pcb export vrml --output "board.wrl" "board.kicad_pcb"

While exported files don’t include lights, this usually doesn’t matter to viewers who add their own. However, for our processing, we want to add light that is just slightly to the top-left (at 0.1 -0.1 -1) of the camera (at 0 0 -1).

head -1 "board.wrl" > "board.front.wrl"
cat <<EOF >> "board.front.wrl"
Transform {
    children [
        DirectionalLight {
            on TRUE
            intensity 0.63
            ambientIntensity 0.21
            color 1.0 1.0 1.0
            direction 0.1 -0.1 -1
        }
EOF
cat "board.wrl" >> "board.front.wrl"
echo "] }" >> "board.front.wrl"

And yes, this method is a bit crude but it does work.

In order to reduce this 3D model into 2D image, ray tracing comes in handy. However, for that we need an external tool. I found that RayHunter worked great from the command line. While you only need that tool, you might want to check Castle Model Viewer as it can show you parameters in a bit more interactive way. Please note you also need libpng-dev package for PNG output.

cd ~/Downloads
wget https://master.dl.sourceforge.net/project/castle-engine/rayhunter/rayhunter-1.3.4-linux-x86_64.tar.gz
tar xzvf rayhunter-1.3.4-linux-x86_64.tar.gz
sudo install -m 0755 ~/Downloads/rayhunter/rayhunter /usr/local/bin/rayhunter

sudo apt install --yes libpng-dev

With prerequisites out of way, now we can finally export our board, looking directly at its front side. Camera position is a bit further away than I usually need it for my board but resolution of 4320x4320 pixels is large enough to then later crop the unneeded pixels.

rayhunter classic 7 \
    4320 4320 \
    "board.front.wrl" \
    "board.front.png" \
    --camera-pos 0 0 6 \
    --camera-dir 0 0 -1 \
    --scene-bg-color 1 1 1

You can see what each parameter does in rayhunter documentation

If all went fine, this will give you PCB board nicely rendered but with quite a lot of whitespace. In order to remove those extra pixels, I like to use ImageMagick.

sudo apt install -y imagemagick

Using convert command I trim all the whitespace, resize it to 1060x1060 pixels, add 10 pixels boarder on each side, and finally extend it to the full 1080x1080 size.

convert \
    "board.front.png" \
    -trim \
    -resize 1060x1060 -normalize -density 600 \
    -bordercolor white -border 10 \
    -gravity center -extent 1080x1080 \
    "board.front.png"

Congrats, your PCB image should be looking good just about now.


PS: You can do this from any PCB orientation by just adjusting camera and light position.