CT sensors - Interfacing with an Arduino
To connect up a CT sensor to an Arduino, the output signal from the CT sensor needs to be conditioned so that it meets the input requirements of the Arduino analog inputs: a positive voltage between 0V and the ADC reference voltage.
Note: This page give the example of an Arduino board working at 5 V and of the EmonTx working at 3.3 V. Make sure you use the right supply voltage and bias voltage in your calculations that correspond to your setup.
This can be achieved with the following circuit which consists of two main parts:
The CT sensor and burden resistor
The biasing voltage divider (R1 & R2)
Calculating a suitable burden resistor size
If the CT sensor is a current output type such as the YHDC SCT-013-000, the current signal needs to be converted to a voltage signal with a burden resistor. If it is a voltage output CT you can skip this step and miss out the burden resistor as the burden resistor is already built in to the CT.
1) Choose the current range you want to measure
The YHDC SCT-013-000 CT has a current range of 0 to 100 A so for this example let's choose 100 A as our maximum current.
2) Convert maximum RMS current to peak-current by multiplying by √2.
Primary peak-current = RMS current × √2 = 100 A × 1.414 = 141.4A
3) Divide the peak-current by the number of turns in the CT to give the peak-current in the secondary coil.
The YHDC SCT-013-000 CT has 2000 turns and so the secondary peak current will be:
Secondary peak-current = Primary peak-current / no. of turns = 141.4 A / 2000 = 0.0707A
4) To maximise measurement resolution the voltage over the burden resistor at peak-current should be the Arduino analog reference voltage (AREF) divided by 2
If you're using an Arduino running at 5V: AREF / 2 will be 5 V / 2 = 2.5 V and so the ideal burden resistance will be
Ideal burden resistance = (AREF/2) / Secondary peak-current = 2.5 V / 0.0707 A = 35.4 Ω
35 Ω is not a common resistor value we have a choice of 39 Ω or 33 Ω. We recommend going for 33 Ω ±1%
If you're using an emonTx operating off battery AREF will start at 3.3 V and slowly decrease as the battery discharges to 2.7 V. The ideal burden resistance for the minimum voltage would therefore be:
Ideal burden resistance = (AREF/2) / Secondary peak-current = 1.35V / 0.0707A = 19.1 Ω
19 Ω is not a common value, we have a choice of 18 Ω or 22 Ω. We recommend going for 18 Ω ±1%
Tool for calculating burden resistor size, CT turns and max Irms - thanks to Tyler Adkisson for building and sharing this.
(Note: this tool takes no account of the maximum power output of the current transformer. Saturation and distortion will occur if the maximum output is exceeded. Nor does it take account of component tolerances so a few percent should be taken off the calculated resistor value to account for this. There is more about component tolerances at ACAC Component tolerances.)
2) Adding a DC Bias
If you were to connect one of the CT (+ burden) wires to ground and measure the voltage of the second relative to ground, the signal would oscillate from positive to negative voltage. The Arduino requires a positive voltage only and so by connecting the end of the CT that we just connected to ground to a 2.5 V level (half of the supply voltage) instead, the signal voltage will now oscillate around 2.5 V and remain positive.
The resistors R1 & R2 in the circuit diagram above make up a voltage divider that provides this 2.5 V level (1.65 V for the emonTx). The capacitor C1 has a low reactance - a few hundred ohms - and provides an alternative path for the alternating current to bypass the resistor.
Choosing a suitable value for resistors R1 & R2:
Higher resistance lowers quiescent energy consumption.
We have been using 10 kΩ resistors for mains powered monitors. The emonTx uses 470 kΩ resistors to really keep the power consumption to a minimum as it is intended to run off batteries for several months.
To use the above circuit to measure rms current and with a fixed value for rms voltage (e.g. 240V) to indicate approximate apparent power, upload the Arduino sketch detailed here: Arduino sketch - current only