DIY PDU with Switched and Metered Ports

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

llowrey

Active Member
Feb 26, 2018
167
138
43
I have wanted a PDU with per-port metering for a long time but have never found anything for a price I'd be willing to pay (< $250). I recently came across a category of WiFi based home automation devices that are supported by an open source firmware that I decided to kludge together into a DYI PDU.

The device I selected is a generic Chinese XS-SSA05 which can be had for around $12 each. I managed to find 8 for $5 each so there may be deals to be had. The device provides the switching of one outlet, power monitoring for the outlet, a bi-color LED (blue & red), and a button.

device.png

With a little work, these can be loaded with the open-source firmware Tasmota. The firmware allows the device to be operated locally, without any external services. I wasn't at all interested in these connecting back to the PRC mothership so I didn't even bother powering them up before loading the Tasmota firmware.

The Tasmota firmware offers up a web management interface and acts as an MQTT client. So, to create my DYI per-port metered PDU, I loaded up my 8 XS-SSA05s with a customized Tasmota firmware, pointed them at my MQTT broker, and threw together a simple web UI.


redneck1.jpg redneck2.jpg

redneck1.png

The firmware lights the blue LED when the relay is on, as indicated by the blue boxes above. I am coloring the power (Watts) indicator with green when power is above 10W, yellow between 1-10W, and no color if below 1W. The host "Foo" above is not running but the BMC is drawing a small amount of power. So, it's colored yellow to indicate that there is load present but it's a small load.

With a glance it is easy to tell which ports have power applied, which have loads attached and the power consumed by those loads.

Another handy capability is turning on/off the red LED to identify ports. The red and blue LEDs share a diffuser so there are effectively four states: off, red, blue, purple. So, tap the blue box to make the LED go purple then hunt for the port with the purple LED instead of tracing power cables from end to end.

redneck2.png redneck3.png

Caveats... there's always something...

  • The XS-SSA05s were either ultrasonically welded or glued together. It took some force to pop the shell apart and there was some damage, but nothing a little epoxy couldn't fix.
  • The PCB had to be desoldered from the power pins in order to be freed from the shell.
  • The PCB had only pads for vcc, tx, tx, gnd, and gpio0 so I had to solder wires to the boards in order to program the firmware.
  • The MCU (ESP8266) puts the GPIO pin used to control the relay in high-impedance mode during reset. This causes a split second of power loss for the load. Unfortunately, the Tasmota firmware will reset when certain configuration options are changed. You are motivated to "set it and forget it™."
  • The calibration of the power metering is insufficient. The response is not linear but the Tasmota firmware assumes that it is. I calibrated using a 100W incandescent light bulb and a Kill-a-Watt and found that power readings were about 5% high at 30W and about 10% low at 1400W. Power levels below 10W are probably not very accurate.
  • Communication is over WiFi. I put mine on an SSID on a VLAN so I could isolate them. It works better than I thought but I still don't like the idea of dozens of WiFi devices like this buzzing around.
  • The OOTB Tasmota firmware does not use TLS when connecting to the MQTT broker. The firmware is very easy to mod (there are great instructions) and loading a custom firmware isn't a big deal but still, not an OOTB experience.

Overall, I'm happy with how this turned out. I'd still prefer to have a proper zero-U PDU with per-port metering but this'll do.
 

ReturnedSword

Active Member
Jun 15, 2018
526
235
43
Santa Monica, CA
This is really great! Just another thing to put on my list of interesting things to do in the future with the lab :p

edit: This WiFi plug apparently uses a ESP8266, which can expose a hacky 10BASE-T interface. This project might give an idea. A lot of cheap Chinese IoT devices use the ESP8266. Not sure why they aren't moving to the ESP32, which supports a proper Ethernet interface. An ESP32 doesn't cost "much" more, though I suppose in large quantities that adds up.
 
Last edited:

Rand__

Well-Known Member
Mar 6, 2014
6,626
1,767
113

Jannis Jacobsen

Active Member
Mar 19, 2016
365
80
28
45
Norway
I'd never get cheap chinese power switches.
I've seen enough examples of how badly engineered they can be.
(Undersized wiring, components not specced for 110/220v etc etc).

Would not risk my house burning down just to save a few dollars.
Legit tested and safe wifi power sockets can be had pretty cheap all in all

-jannis
 
  • Like
Reactions: T_Minus

llowrey

Active Member
Feb 26, 2018
167
138
43
I'm currently feeding power data into cacti for charting purposes. A better approach would be to stream from MQTT into influxdb and then display with grafana.

Here's a chart from an old crusty dual socket Opteron with a 12 drive array that spins down when idle.


cacti.png


Idle is about 250W. Ouch. Streaming via Plex (no transcoding) spins up the drives which burns another 100W. At 1am the weekly mdraid check kicks off which spins up the drives and runs at max sequential read speed which starts out around 2.7GB/s for the 12 drives. I was surprised to see that the start of the raid check burns an extra 250W before settling down to 200W extra then tapering off to 150W extra as the drive heads march inward. The backup that ran at 2am didn't add much to the total load.
 
  • Like
Reactions: abq and T_Minus

llowrey

Active Member
Feb 26, 2018
167
138
43
edit: This WiFi plug apparently uses a ESP8266, which can expose a hacky 10BASE-T interface. This project might give an idea. A lot of cheap Chinese IoT devices use the ESP8266. Not sure why they aren't moving to the ESP32, which supports a proper Ethernet interface. An ESP32 doesn't cost "much" more, though I suppose in large quantities that adds up.
Yep. The ESP8266s are good enough for this application so there is no reason to spend the extra pennies for ESP32s. Given how robust the ESP32 development ecosystem is, and the fact that it has a 100mb/s MAC plus Bluetooth (incl BLE), it makes me think about phase 2 which would be to design a multi-socket integrated solution. That could make for a fun project.

Very nice :)

But o/c nowadays there are options...;)
Zero U
AVOCENT PM3000 PM3007H 520-902-502 PDU Power Distribution Unit | eBay
1U
AVOCENT PM3000 PM3007H 520-902-502 PDU Power Distribution Unit | eBay

Those are o/c EOL but FW is available, they are usable as stand alone unit or together with an Avocent KVM switch.
I think the only downside is that you need IE since FF/Chrome are not rendering the page correctly any more (iirc)
Excellent tip. Thanks! Finding one with NEMA 5-15 sockets and plug seems a bit challenging. An adapter for the plug is certainly doable. As long as full control is possible via SNMP I'm not sure I care much about the embedded web UI.

I'd never get cheap chinese power switches.
I've seen enough examples of how badly engineered they can be.
(Undersized wiring, components not specced for 110/220v etc etc).

Would not risk my house burning down just to save a few dollars.
Legit tested and safe wifi power sockets can be had pretty cheap all in all

-jannis
I get it. There's no UL mark. There is a CE mark but I would be surprised if it was actually approved. I definitely wouldn't plan on cycling the relays too often but then I've hardly ever cycled the outlets on my APC PDU. I'm mostly interested in the power monitoring capability.
 
Last edited:
  • Like
Reactions: T_Minus