Sen6-PDU: a Smart Power Distribution Unit

9.1K8718

Intro: Sen6-PDU: a Smart Power Distribution Unit

DISCLAIMER

WARNING: The work involved with building your own PDU is dangerous. Voltage and current levels are often high enough to cause injury or even death. If you aren’t equipped with sufficient experience and knowledge, DO NOT ATTEMPT TO DO THE ELECTRICAL WORK YOURSELF. 


Introduction


In most cases, when we talk about a PDU we generally mean a box that can power multiple devices at the same time from a single power source. A sort of "multi-socket" with the only advantage of concentrating the cables towards the same source.

This is not the case. 

A friend of mine and I were in the need of a programmable system, equipped with at least 12 sockets that can be individually controlled remotely, which can be integrated into the existing Home Automation system (Node Red) with an indication of the total energy drained by the connected devices. The unit will have to manage an existing multimedia installation and other appliances (audio ampifiers, HDMI matrix, TV-SAT decoders, fans, audio player, etc.)

This is how the Sen6-PDU project was born.

STEP 1: The Box

We first started looking for a suitable box. The idea was to find an economical PDU in which to install our project, removing the components, but the main limitation was that we needed 12 separate outlets and no commercial box seemed to be right for us. Additionally, cheap commercial PDUs typically didn't have enough internal space to house all of our components.


At that point the most drastic decision was: let's go to a blacksmith and have it custom built!

The pictures show the newly made box, made of sheet metal, and subsequently painted.

STEP 2: The "smart" Thing

The main requirement of the project was to make the 12 sockets individually controllable and integrated into the existing Home Automation system, managed by Node Red. Therefore, the most efficient solution seemed to be the MQTT protocol, while as regards the hardware the choice fell on an ESP32 microcontroller, with WiFi connection capability. The ESP32 was also well suited to the high number (12) of control channels needed. It has a total of 36 GPIO pins that can be used for various purposes, including interfacing with sensors, controlling relays and communicating with other devices. We opted to a model with an external antenna connector on the board, as the ESP32 had to be installed in a closed metallic box, therefore we could not know if the sensitivity of the internal antenna was enough to connect to the nearest AP.

Instead of developing a specific control software, we preferred to install the Tasmota-32 firmware in the device. This is because Tasmota provides the stability, updateability and configurability we needed to handle the whole project. It deploy a full MQTT communication for any command available and reports, through a configurable telemetry, all sensors data.

To manage the outlets we chose to use three 4-channels, opto-isolated relay modules. Each relay is capable of driving a device up to 10A at 220v, so the electrical sizing of the system had to take this data into account. This makes the project really scalable: installing more or less relays modules, you can customize the total sockets to your best needs.

STEP 3: Energy Monitoring

Once we had the full project designed on schematics, we asked ourselves: "Why not report the total energy consumption too?". Energy monitoring for the whole load on all the sockets would have been an useful information. After a quick search, the choice fell on the module PZEM-004T: it is capable of measuring four interrelated electrical variables as voltage, current, power, and energy with an accuracy of 0.5%. The sensor is composed of a Current Transformer that detects the parameters and a tiny electronic board which communicates with the ESP32 by means of a TTL Serial Communication in the RX/TX pins. The board is electrically isolated from the AC channel by means of 2 opto-isolators.

As the sensor is designed to work with 5v, but the ESP32 GPIOs can handle only up to 3.3v, we had to lower the resistance of a resistor on the board in order to power it with 3.3v, as it defines the current through the light emitter of the opto-isolator.

The PZEM-004T is also compatible with Tasmota firmware, so we closed the circle.

STEP 4: Schematics and Configuration

Although it may appear complex, the schematic is real straighforward. The power supply is a 220-12v switching unit, which directly powers the 3 relay modules. A step-down converter is installed to power the ESP32 and the PMEZ-004T.

The ESP32 configuration is shown in the pictures: 12 GPIOs are directly connected to the respective relay modules inputs, while TX and RX are inversely connected to RX and TX of the PZEM-004T. The configuration of the ESP32 was then completed with the assignment of the MQTT broker address. 

STEP 5: Home Automation

In the picture there is a screenshot of a partial Node Red implementation for the PDU. In addition to the 12 switches to directly control the sockets, there are several other flows. For instance, one of them controls only a subgroup of the sockets: this is because often you don't need to switch ON/OFF the whole 12 outlets at once, instead you can define one or more groups (i.e.: audio rack, video devices, etc) to be operated individually.

Another flow takes care of a specific device which has its own power on procedure (i.e.: it has to be powered on only 30 seconds after a related device has been turned on). Every outlet can then be individually assigned to a scheduled ON/OFF calendar. The power of the MQTT communication protocol allows you to have an unlimited flexibility in using this smart PDU.

STEP 6: Specifications

Model:                  Sen6-PDU (twelve)
Input Voltage: 100-240 VAC
Output Voltage/Current: 100-240 VAC / 10A total (or 10A on 1 socket)
Communication: WiFi 2Ghz
Network protocols: TCP/MQTT
Sockets: 12
Dimensions: 250x500x60 mm
Monitoring: Individual output monitoring and control - Total unit power monitoring

16 Comments

Hi, this is a great idea (I have something similar) and work with these connectors a lot. 


Reading through the other comments, I can see there has been some concern over it appearing that you are switching neutral, mainly because you’ve used a blue wire for live. Actually, I can see checking your photo and the wiring diagram of the C14 fused input socket, that looking down from on top the input pins are: earth is furthest right, neutral is middle and live is left (see attached). So I can see that it is just that you are using a blue wire for live (and black/orange for neutral). This isn’t best practice so I’d suggest correcting it. 


However! Now checking the 12 outputs, a C14 in that orientation (earth pin to right) would mean that the pin closest to the lid of your chassis is actually the neutral pin. So all your outputs would appear to have their live and neutrals reversed! If you look at it self contained without the input socket, the wire colour appears to match the pin - another reason you were being told you were switching neutral but since you’re actually taking live through that blue wire, you’re taking live to the neutral pins of the outputs!


So not for the same reasons people were saying here, but you actually have the same result. Parts of the circuits are live when they shouldn’t be. I expect you wired the input socket using blue for live, then when you came to wiring the outputs, you took blue to neutral as this is the colour we would expect on that pin. 



I really would urge you to:


  1. correct all cable colours to follow standards
  2. double check your C14 output wiring
  3. Remove some of that black paint, spot weld either directly (or a small bolt) to the bottom plate of the chassis and connect a dedicated earth strap
  4. Ideally fuse each output but this is just my safety hat and not strictly needed


I mean no disrespect by this - but I’ve personally seen people killed tinkering with high voltage. I would suggest anyone who is thinking of copying this concept, really have an understanding of high voltage and not blindly copy!

Hi, thanks for the info and I agree that for your particular situation where you are in a country that uses non-polarised connections, this is less of an issue. However, I would add that you are a featured article essentially instructing others. Connecting the live/line to the neutral would be bad for those countries that do use polarised connections and is just generally not best practice. Even if it can be reversed at the socket by the user, internal wiring should still go line/live > line/live and neutral > neutral. This can only be sensible. Perhaps you should include additional information about this in your article.

Bob,

taken for granted that I have installed the earth strap (I will update photos soon) I want to spend few words on the line/neutral issue. Yes, the color of the cables may have been chosen incorrectly but this is not a severe issue. Consider that here we have wall sockets as the one in the attached image: it is not "polarized", so the user is free to insert the plug in any direction, also upside down. There is no guarantee as to which cable will carry the line and which will carry the neutral. So, yes, the color of the wire is important, but it will never be related one-to-one to line or neutral.

That's great but it would be good if you corrected the errors, photos and details so that others do not think this is how high voltage should be wired - and perhaps include a disclaimer on the dangers of undertaking such a project just to keep it airtight.


Again, these things are all said with good intentions, I am not trying to attack your project (as mentioned in my original comment, I have something similar myself - it's a great concept), I would just hate to see anyone hurt by high voltage - as mentioned, I've seen this first hand and it's not pretty.

Concerning the earth strap, I installed it after a week of testing, but I didn't take a new photo. Thanks for the suggestions.

Hi, thanks for the reply - but I’m not quite sure what you mean by this:


the earth wire is the yellow/green in the middle, between the black and the blue ones


I can see you have used correct earth cable colour but would still urge the use of a dedicated ground strap. If you mean earth is the middle pin on these connectors? Then yes, it always is on the outward facing side. On the inward side of the fused inputs it does differ, but the “plain” C14/13s are straight through.

Hi Bob, thank you for your message, I will go through it when I'll be back home. In the meantime I must tell you that the earth wire is the yellow/green in the middle, between the black and the blue ones.

Don't mess with safety "there is no inductive/motor/industrial appliance connected to the outlets, only multimedia electronic devices" doesn't make a difference. Switching neutrals is dangerous and will not pass any countries electrical safety testing that I am aware of.

Anyone who touches part of your multimedia setup can be at risk.

The reason @PhaseAngle is adamant you’re switching neutral is because you’ve connected your blue live wire to the neutral pin of the outputs. Please see my main comment and screenshots with annotations. You’ve got your output live and neutral reversed, which is still bad.

@PhaseAngle, your are right. But I am not switching neutral

actually many non electricians seem to think switching neutral is not a problem but it leaves a live neutral coming back from the connected appliance appliance witch can be dangerous especially when fault finding. I have seen it personally a few times when diagnosing shocks reported by customers.

Thank you for your kind concern, but no one is switching neutral!.

Only the colors have been swapped. In any case it makes a difference, as multimedia devices power supplies are not concerned about neutral/phase. I find your last sentence: "Anyone who touches part of your multimedia setup can be at risk." a little threatening and not very truthful, as the case is connected to ground.

You put a low power wifi transceiver inside a grounded steel box. Does it work with the lid on?

fortunately yes, the router is very close to the box. Anyway, the ESP32 I choose has an antenna connector on the board, so I was ready to install a small external antenna, but it wasn't necessary.

Hello, this looks like a really cool box, with great current monitoring.

I'm a little concerned about the cable sizing and apparent lack of fusing? If each relay is cable of switching 10A, the main supply needs to be rated for 120A, which is roughly 36mm^2 cable. From the picture, I'm not sure that's the case? Also, the supply that is controlled through the relays seems to be distributed through the relay board, not by cables as indicated by your wiring diagram (the blue wires only go to the first and last relay on each board). Is the first board rated to supply over 80A through it (as the other boards will pass their power through it)?

As a minor point - are you switching the live or the neutral? The blue cable colour say neutral to me, which isn't considered best practice.

I may have missed it, but I don't see any fuses in your diagrams. if a load on one of the outputs faults/shorts - what will protect your design from overload? If the load device draws more than 10A, does the whole unit shutdown, or does the relay set on fire?

I think it's a great design, and please don't take this as criticism, but just trying to check the design is safe.

Hi Gargravarr42, thank you for your post!

About the fuse, it is included in the main power socket (bottom left in the picture), no worries. A 10A fuse.

The device will be installed in a multimedia rack, where each appliance will not load more than 150W maximum, so there is no concern for the cables (they are oversized for that amount). Same consideration for the distributed supply, I wasn't able to connect 12 separated wires from the socket to each relay, and the wiring diagram is consistent with the installation. All the "commons" of the relays are connected by means of cables under the PCB.

Concerning the cable color, you are right, but there is no inductive/motor/industrial appliance connected to the outlets, only multimedia electronic devices.