Monday 14 November 2022

Powering a Home Data Centre - Part 1b

 Part 1 - Sensing The Mains

b. Measuring Current

It is a slightly less than trivial matter to measure the voltage of the mains supply using a simple ammeter, since you need to insert the ammeter into the circuit, which means cutting off the supply for a while, and then hoping that the current being measured doesn't overload the instrument.

On the other hand, we can use a device that measures the magnetic field around a current-carrying conductor. For a handheld meter, this is achieved by using a clamp probe. This takes the form of a split ring of magnetic material that can be opened and then closed around a single, current-carrying conductor.

When connected to a meter, it will allow the meter to display a measure of the current in the conductor.

These accessories are both expensive and rather unwieldy for permanent installation into a fixed power monitor. An inexpensive and much more compact solution is to use a current transformer that is installed permanently into some part of the power distribution system.

These devices do require some additional circuitry in order to bring the output waveform into range for an ADC.


In addition, a current transformer is a step-up transformer (1000:1 is typical), which means that if left unconnected, the output could carry several thousand volts - a painful (but non-fatal) mistake that could spell the end of the ADC and any associated semiconductor devices. The solution is to connect a load across the transformer's terminals, and this is done in the supplied circuit using a simple resistor.

The current transformer has no split, so it must be threaded onto the insulated conductor - usually the line conductor.

Looking at the circuit, you will see that it is substantially the same as the circuit used for measuring the voltage of the output of the mains transformer in the previous part. Since the device is designed for use with electronic sensors, there is no need to pre-scale the transformer's output.

As before there is a midpoint bias for one side of the measured output, voltage limit diodes and a voltage follower circuit to buffer the high impedance output from the transformer.

The only other addition is a substantial resistor placed physically adjacent to the transformer.

The circuit board is large enough, at 100mm square, to include four copies of the above circuit - sufficient for four single-phase circuits or one three-phase circuit. 

This may seem excessive, but making the board smaller saves nothing in cost, and the components are cheap enough to make multiple channel sensing viable, even to the hobbyist - besides which, this is for monitoring a complex load's demands on multiple circuits.

The sensor heads are on sub-boards which may be broken out for remote installation (purple lines) and an additional rectangular break-out which is designed to allow this board to be installed immediately above the voltage sensor board in the previous part.

No hazardous voltages should ever appear on this board.

For clarity's sake: on this iteration of the design, there is no offset compensation on the voltage follower amplifiers, but it will be included in a future release.

As before, the tiny 1kΩ resistor is installed under each amplifier integrated circuit.


Gerbers and DipTrace files can be found here: [ https://github.com/AlyssonRowan/HomeDataCentrePower ]


< Previous Index | Next >


Saturday 12 November 2022

Powering a Home Data Centre Part - 1a

 Part 1 - Sensing The Mains

a. Measuring the Mains Voltage

It is a trivial matter to measure the voltage of the mains supply using a voltmeter, just switch to the correct range, put the probes on a pair of exposed electrical parts and read the number. It is not so easy when you want to use a computer to measure that voltage.

 

In order to bring the voltage into a range that can be measured, we need to use some means to scale that voltage. In the case of a voltmeter, a voltage divider connected across the voltage to be tested is used. This is fine, given that the whole of the test meter is insulated, isolating us from hazardous voltages.

For a computer to read that voltage, we need to both scale the voltage and to isolate the mains from the measuring circuit. Isolation and scaling is best done using a device that has been around for a very long time - a transformer.

Transformers are well known as the heavy, rectangular block of steel and wire in many domestic appliances. They may scale the voltage on the input up or down, depending on the way the transformer is made. In this application, we will be using a small, encapsulated isolating power transformer. One small enough, in fact, to be mounted on a printed circuit board.

Without going into the physics and the mechanical construction of a transformer, the device operates thus:

An applied AC voltage is applied to the input of the transformer, and a small current flows through that half of the device.

The output of the transformer will follow the waveform of the input but scaled by the ratio applicable to that transformer.

Example:

A 1:20 transformer with 240V AC applied will output an identical waveform at 12V AC
The same transformer with 110V AC applied  will output 5.5V AC

As the output current delivered by the transformer increases, the output voltage will decrease. Under no-load conditions, the output voltage can become erratic as well as excessive due to the design of the transformer being optimised to deliver at least some current. It is therefore important to draw a small, fixed current from the output side of the transformer - since we are subverting the function of the transformer. 

The low voltage output of the transformer can be further scaled to meet the input requirements of an Analog to Digital Converter (ADC), which converts a voltage to a binary number.

The transformer and output scaling circuit is shown to left.

The transformer has two identical output windings that are connected in parallel. The output is capable of delivering about 250mA into a load.
R1 and R2 form a voltage divider that scales down the transformer output to a usable level.
R3 and R4 form a voltage divider that fixes the bottom end of the transformer at half the 5V supply while C1 buffers any changes to that.
D1 and D2 act as over and under voltage protection for the input of the ADC

The normal output waveform is bracketed entirely within the input range of a 5V ADC.

The circuit with the values shown requires considerable care to calibrate, which will also require a single meter measurement of the input voltage. It is possible to optimise the values of R1 and R2 for the transformer used.

In order to improve performance, stability and accuracy, it is possible to remove capacitor C1 and resistors R3 & R4, and connecting pin A3 to a buffered midpoint voltage source.


The output from the circuit is high impedance, and may be subject to interference if the connection to the ADC is too long. To obviate this, and to introduce a level of protection for the expensive ADC, a voltage follower circuit is included. This uses an inexpensive op-amp chip that simply reflects the input voltage  on its output.

The potentiometer, R5 on the diagram, may be considered to be optional, and serves to improve the precision of the circuit.

The full circuit is below:


The whole may be assembled on a 100mm x 100mm printed circuit board -

Note that the fuse is soldered directly to the PCB and that R6 is installed under the centre of an IC socket.
R5 (optional) is adjusted to give a zero volts output at analog out when pin 3 is shorted to ground.
SCR is the screen if connection to the ADC is made via coaxial cable.

The purple areas on the PCB above are cut-outs.

Gerbers and DipTrace files can be found here: [ https://github.com/AlyssonRowan/HomeDataCentrePower ]


< Previous Index | Next >



Saturday 5 November 2022

Powering a Home Data Centre - Part 1

Part 1 - Sensing The Mains


In this first part, I will be discussing how to detect and to measure mains voltage and current. Whilst detection and current measurement may be carried out indirectly (i.e. without connecting to the mains circuit), there is no convenient way in which to do this  for voltage measurement.

Why measure the mains?

There are two main reasons for measuring the mains - 

●  Monitoring the power usage
●  Ensuring that the electrical supply circuit is not being overloaded

There are two measurements used for assessing overload - 

●  Ensuring that the current drawn is within the specification for the circuit
●  Ensuring that the voltage drop on load due to the length and size of the cable is less than that allowed.

The first of these is less critical if an appropriate protective device (a fuse or similar) is used in the circuit.

The second impacts both the efficiency of the device(s) being supplied, and the amount of heat being generated in the cable. Overheating cables lead to short circuits, to overheated flammable materials, and to fires in both cases.

Here in Britain, the incoming mains is pretty stable, so we don't need to measure that voltage, so measuring the voltage at the point of demand will be sufficient. The 18th Ed. wiring regulations say that we are allowed a 5% voltage drop on non-lighting circuits - which comes to 11.5V (Lighting circuits are allowed 3%, or 6.9V).

The amount of voltage drop is related to the amount of current being consumed, so there is no point in measuring this with no load connected.

The amount of power being consumed by a circuit in Watts gives a measure of how much the circuit is costing to run.

Finally, detecting the presence of a mains voltage on a the line side of a circuit tells you whether the circuit is energised or not, an important factor when using digital control systems.

Isolation - keeping the voltages apart.

Digital systems operate on a very low voltage - usually 3.3V or 5V DC. If we connect the mains to a digital control board, there will be a loud bang, smoke, bits of circuitry flying and complaints about the waste of (expensive) parts.

In order to prevent this, especially when interacting with the mains from control circuits, we use various forms of isolation. This may involve the use of transformers and/or optical links of various sorts. It also requires particular care when designing printed circuit boards. Slots (air-gaps), surface spacing and earth barriers all have their place in the design.

Where possible, non-contact sensing should be used - where the sensor itself is fully insulated from the mains conductors - usually by passing the insulated wire through an aperture in the sensor head itself.

Currently, there is no convenient or accurate means of measuring the voltage on an AC conductor without making electrical contact with that conductor - therefore, that circuit will use a small, encapsulated isolating transformer to effect the connection.

 

The following parts will cover

1. Voltage Measurement circuit
2. Current Measurement circuit
3. Supply Detection circuit by both live connection and non-contact methods
4. Ancillary circuits
5. Microcontroller (Arduino) hardware and example firmware.

 

A note about the PCBs

 Some of the published PCBs may seem to be rather underpopulated, but there is a method to my madness.

The PCB production service that I use has a minimum charge which covers PCBs up to 100mm square.

By using a templated PCB footprint, it has been possible to design these modules so that they can be conveniently stacked using nylon standoffs. The current sensor board is designed so that by breaking out the sensor head sub-boards, a suitable shape is left that will sit above the voltage sensor board, with the transformer filling the gap.

The files for the project (images, circuit schematics and circuit board sources, gerber files) can be found on my GitHub project repository, which may be found here: https://github.com/AlyssonRowan/HomeDataCentrePower

 

More information on capturing data about your mains supply can be found at:

The Open Energy Monitor website  https://openenergymonitor.org/ 
and particularly at https://learn.openenergymonitor.org/


 < Previous Index | Next >

 

Powering a Home Data Centre

 

Introduction.

This project is all about control. Controlling the mains supply to a bank of network servers and the necessary ancillary devices, while incidentally, monitoring said mains supply. I want to do this from my desktop computer in another room because servers are not good neighbours in a house (noisy things that they are).

Because this is something being run from my domestic supply, the whole project is based on a UK 230V single-phase supply. The same circuits (with tweaks for supply voltage) will work anywhere in the world. Three-phase supplies need more complex circuits for monitoring and control. Three-phase is outside the scope of this project.

The project is a thing of many parts which I intend to document pretty thoroughly.

The System Stack.

The stack, a mobile 12U high 19" rack, incorporates five assorted HP servers of various vintages, a gigabit network switch, a 100Mbps network switch and a KVM, with keyboard, mouse and monitor on top of the cabinet.

Worst case power demand: the whole lot, if running at maximum power would draw about 17 Amps off of the mains (UK domestic sockets are rated at 13A), with a potential power-on surge of in excess of 40A.

In order to mitigate this, the final system will require a separate power supply brought from the mains consumer unit - which has a two spare ways currently occupied by a 30A MCB and a 20A fuse. In the short term, while testing the installation, a 13A plug will be sufficient to supply one of the computers and the ancillary equipment.

Regardless of the supply used, the power will need to be sequenced onto the systems in order to reduce the power-surge at connection. In these lean times, I want to be able to monitor the mains power usage, and the presence or absence of mains to various parts of the server rack.

For safety's sake, the control and monitoring system will be integrated with smoke, heat and general environmental monitoring - with alarm levels that will shut down the systems with prejudice in case of fire (or smoke-rich failure).

The Project

Part 1. The mains monitoring sub-system comprising mains detection, mains voltage and circuit current sensors.

Part 2. The power control sub-system, including logic-level power relays and mains contactors.

Part 3. Ties the first two parts together using a microcontroller.

Part 4. Installation of the system.

Finally will be the environmental monitoring sub-system including the creation of a custom smoke detector and a custom rate-of-rise heat detector.

There will be microcontrollers used, which will even talk to the wired network - this is not an IoT project by any means. All data handled by this project will be internal to the network.

Electrical Safety

 

Mains voltages are dangerous. If you are not experienced with working with mains voltages, you should have any and all wiring checked and tested by a qualified electrician. In some countries, this is a legal requirement in any case.

Disconnect anything you are working on from the mains - either by unplugging it, or by using a lockable isolator. Do not reconnect until the wiring has been checked for safety.

Some circuit boards will have both logic level voltages and mains voltages on them. You should not consider doing anything around these boards unless the mains is isolated.

If in doubt - don't do it.

 

< Previous Index | Next >