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 >



No comments:

Post a Comment

Comments and suggestions are warmly welcomed.