# Computing stuff tied to the physical world

## A 220 : 6.3 V transformer… backwards

In Hardware on Sep 17, 2011 at 00:01

A new day, a new setup:

The schematic of this new setup was shown yesterday.

Wait – a regular transformer AND it’s connected the wrong way around?

My first reaction when I saw this article was that this couldn’t possibly work. After all, a 220 -> 6.3 VAC transformer has a 35:1 step down ratio, so when connected in reverse, that would simply generate 7.5 kiloVolt!

The first reason this doesn’t happen, is that the transformer is connected in series with the load. It’s not measuring voltage but current. This is in fact exactly what a current transformer does.

The second reason why the high voltage never gets generated, is the 0.1 Ω (2W) resistor placed in parallel with the 6.3 V winding. With a 1000 W load, there’s 4.5 A going through the resistor, which leads to a 0.45 V voltage across the transformer. Together with the 1:35 step-up, that’s “only” 15 VAC or so on the “primary” side.

There is a risk, though: if the 0.1 Ω parallel resistor were to ever get disconnected during use, then the secondary winding will instantly turn into a little fuse, heat up, and blow. And while it does, a very high voltage spike might come out the other end!

Still, 15 V is far too much for an ATmega. But this voltage is not directly connected between the I/O pin and ground. Instead, one side is connected to a 22 / 22 kΩ voltage divider, which nicely puts the AC signal in mid-range for the ADC. When the voltage exceeds the ± 1.65 V (VCC/2) swing supported by the I/O pins, it will start to flow through the ESR protection diodes of the ATmega. With 22 kΩ on the other end to limit the current, these currents will be less than 1 mA – this is not high enough to do any harm.

Anyway, let’s see what comes out:

``````    \$ jeemon examples/driver-demo
...
reading:RF12-868.5.17:oneLong:value = 171745  <- 100 W light bulb
...
reading:RF12-868.5.17:oneLong:value = 111262  <- 1 W power brick
...
``````

How can this be? A jump from 8 mV to 175 mV for the light bulb, and then 210 mV for a much lighter load?

It gets even weirder:

``````    reading:RF12-868.5.17:oneLong:value = 8642
``````

This time, there is no load! I just turned on power without anything attached, i.e. an open circuit!

There’s something completely wrong here. My hunch is that this is either due to some extreme level of noise or an improperly-dimensioned burden resistor.

Noise might explain it, since the code tracks maxima, including any high-frequency spikes there might be. Maybe a digital low-pass filter could help, but I haven’t found a good source for calculating the coefficients of a FIR filter.

Further investigation will be required – this setup is useless!

1. JC,

Your reversed transformer is best analyzed as a cheap and cheerful current transformer. From the basic transformer action, whatever flux is generated from the “mains” side (I1*n1) must be approximately in balance with a flux from the current forced on the “detector” side (I2*n2). Even though you are diverting much of the “mains” current through that parallel resistor, the balancing current (I1*n1/n2) has to flow somehow. Since you have not provided a distinct path for this, it is flowing through the various stray capacitances and momentarily “through” the sampling capacitor of the ADC. Try shunting ADC IN by say 1Kohm to local ground and I expect the seemingly bizarre readings will start to behave. (Roughly equivalent to the “burden” resistor you mentioned in the SMD current transformer case) The same safety issue remains – if the shunt resistor goes open circuit, the full load current will flow through the n1 turns. The voltage across the n2 turns will rise, trying to force a balancing current to flow – this voltage will get high enough to zap something, often the interwinding insulation on the transformer. When using current transformers (formal or informal), standard practice is for the output side to be shorted with a link, and only when you have double checked that there is a “burden” load securely in place, is the link snipped. We are so used to regarding transformers as voltage driven devices, when using a current source, our intuition gets some surprises.

• Thanks for these notes, I’m learning a lot! I’ll see what I can do with a burden resistor – in the setup above I had 1 kΩ across the transformer, not between the ATmega I/O pin and ground. I’ve also been experimenting with some filtering/smoothing, in case there is a lot of HF noise.

2. for creating FIR filter coefficients, use Octave (open source clone of matlab and almost 100% compatible with it) it is as simple as specifying the -3bd point and the number of taps

3. Great, that you continue with the current measurement experiments. I’m very much interested in this!

The Talema current sensor, I mentioned here on Sep 14, is doing basically the same thing as your inversed transfomer. But it is especially made for that purpose and probably much safer. Maybe you should try one of those.

They are not very expensive, about 1 € for the 10 Ampere version, which is the smallest. You can get them at Elpro. Currently this type is out of stock, but if you want, I can send you one.