# Current Transformer – ElectroSchematics.com

In this post, we are going to look at some ways to convert the output of a current transformer into something useful for interfacing with a microcontroller. At first, this seems to be a tedious task, but as you go a little deeper, current transformers get more interesting, especially if you haven’t played with them before! ### CT – Introduction

Current transformers (CTs) are sensors that measure alternating current (AC). Like any other transformer, a current transformer has a primary winding, a magnetic core, and a secondary winding (the primary winding of the current transformer is the wire carrying the current you want to measure). The alternating current flowing in the primary produces a magnetic field in the core, which induces a current in the secondary winding. That current is proportional to the current flowing in the primary winding. It’s worth noting that current transformers are used to measure the current in a conductor, and typically use a single cable passing through the center of its core. A CT operates on a principle of flux balance, as shown in the below figure. If the primary winding is energized with the secondary circuit open-circuited, the transformer becomes an iron-cored inductor. The primary current generates a magnetic flux in the core as shown (flux direction can be determined by the right-hand rule). When the secondary winding is connected to a burden (or is short circuited), current flows through the secondary winding creating magnetic flux in the core in opposition to the magnetizing flux created by the primary current. If losses are ignored, the secondary flux balances exactly to the primary flux. This phenomenon is known as Lenz’s Law (source: https://www.littelfuse.com). Remember, A CT is useful for measurements made on AC waveforms, and it utilizes the strength of the magnetic field around the conductor to form an induced current on its secondary windings. This indirect method of interfacing allows for easy installation and provides a high level of galvanic-isolation between the primary and secondary segments.

### Ring-CT (Window CT)

Although there are other types of CTs, only the “ring” type (Ring-CT) will be discussed here. ### Burden Resistor (Sampling Resistor)

In principle, a CT must never be open-circuit once it is attached to a current-carrying conductor. A CT is potentially dangerous if open-circuited because if open-circuited with current flowing in the primary, its secondary will attempt to continue driving current into what is effectively an infinite impedance. This will produce a high and potentially dangerous voltage across the secondary. So, a CT needs to be used with a suitable burden resistor to ‘close’ the secondary circuit. The value of the burden resistor should be chosen to provide a voltage proportional to the secondary current, and it needs to be low enough to prevent CT core saturation. Now it’s worth noting that a CT with a burden resistor (often called as sampling resistor) gives a “volt” output, while one without the burden resistor delivers a “current” output. See the snip of a Chinese datasheet below. The first “current out” CT has a 0-50mA output for 0-100A input, and the “volt out” CT has a 0-1V output for 0-5A input. Naturally, if your CT is a “current output” type, you’ll need to add an appropriate burden resistor across its output terminals. The burden resistor calculation is not very difficult – we’ll get to that later!

### CT Ratio

The CT ratio is the ratio of primary current input to secondary current output at full load. For example, a “current output” CT with a ratio of 100:5 is rated for 100 primary amperes at full load and will produce 5 amperes of secondary current when 100 amperes flow through the primary (primary current is 20 times greater than the secondary current). To put it another way, if the number of secondary turns of a CT is 1000, then the current in the secondary is one 1000th of the current in the primary. Normally, this ratio is written in terms of currents in amperes as pointed above. If the primary current changes, the secondary current output will change accordingly. Remember, unlike voltage transformers, a current transformer has an inverse ratio!

### CT & Microcontroller

Having wired the current transformer as indicated below, you could simply route one output of the CT setup to the ADC input of a 5V (or 3.3V) microcontroller and the other to the GND rail in order to get your reading. However, this is probably not a good idea because the current transformer just converts the current on the line (simply provides a floating voltage across the burden resistor) which is not very microcontroller friendly. We’ll need to do something with the raw signal to provide a DC offset to the AC waveform to make it more usable (see below). Instead of tying one output terminal to ground, that terminal is wired to a bias DC voltage obtained through a resistive divider. This will provide a DC offset (~2.5V) to the AC waveform instead to keep it within the ADC’s range. Obviously, this offset DC voltage trick is the simplest way to play with a current transformer. You should also include proper TVS diodes to clamp the load to ensure it cannot exceed the microcontroller I/Os maximum input voltage rating during a current spike.

### My CT (5A) & Arduino Uno (R3) Experiment

I’m using a 5A CT module as the current sensor for the experiment in this article. The cheapo ‘eBay’ 5A CT module has a 1000:1 current transformer at its heart. Using Ohm’s Law (https://www.fluke.com/en-us/learn/blog/electrical/what-is-ohms-law), we can calculate the output voltage from the current output of the CT. Since this particular module has a 200Ω burden resistor onboard, it will generate a 1V RMS voltage for 5A on a wire through the current transformer. The Electricity monitoring library “EmonLib” (https://github.com/openenergymonitor/EmonLib) can be used for current measurement using Arduino. The library comes with example codes to get current (and voltage) readings.

However, my experiment is based on JChristensen’s “CurrentTransformer” Arduino Library (https://github.com/JChristensen/CurrentTransformer). This devoted library helps to measure RMS current values ​​in a 50/60Hz AC using the CT. Each read causes the ADC to measure a single AC cycle. The data gathered is processed using the standard RMS calculation to give the result in amperes.

Hardware Setup Diagram At this point, note that the 5A current transformer is rated at 10A maximum and has a 1000:1 turns ratio. A 10A RMS current in the primary will generate a 10mA current in the secondary and hence 2V across the 200Ω burden resistor. However, the peak voltage will then be √2 * 2V = ±2.8V (presuming a sine wave) which exceeds the 2.5V DC bias provided by the setup shown above. Therefore, the measured current should be limited to about 8.5A RMS (giving ±2.4V PP) or perhaps a smaller burden resistor (33Ω for instance) could be used if larger currents need to be handled.

```Arduino Example Sketch

#include <CurrentTransformer.h>

#include <Streaming.h>  // https://github.com/geneReeves/ArduinoStreaming

const float ctRatio(1000); // CT ratio

const float rBurden(200); // Burden Value

const uint32_t MS_BETWEEN_SAMPLES(5000);

const int32_t BAUD_RATE(115200);

CT_Sensor ct0(A0, ctRatio, rBurden);

CT_Control ct;

void setup()

{

delay(1000);

Serial.begin(BAUD_RATE);

ct.begin();

}

void loop()

{

uint32_t msStart = millis();

float i0 = ct0.amps();

Serial << millis() << F("  ") << _FLOAT(i0, 3) << F(" An");

while (millis() - msStart < MS_BETWEEN_SAMPLES);

}```

This example sketch reads the current transformer every five seconds and prints the measurements to Serial. The first test was with a 30W/AC230V incandescent barn lamp as the load. Below you can see a snapshot of my serial monitor window. The prototype on my Arduino Prototype Shield, however, is running in a messy and noisy lab environment, so my readings are not quite as accurate. This is what the output on the ADC (A0) would look like on my oscilloscope. Did you get it right? ### CT Polarity

The polarity of a current transformer is determined by the direction in which the coils are wound around the core of the CT (clockwise or counter clockwise), and by which way the secondary leads are brought out of the CT case. The markings on the transformers (sometimes indicated with an arrow) are often misprinted by the manufacturer. But you can verify the polarity of a CT with a 9V battery by following the test method described here https://testguy.net/content/190-Current-Transformer-Basics-Understanding-Ratio-Polarity-and-Class ### Going Further…

Next is the construction of a current transformer handler (CT Handler) which allows connection of most current transformers (current out and voltage out) to 3.3V/5V microcontrollers. Sadly, it’s still on the back burner, so check back later to get that new idea! 