# Biasing voltage divider (R1 & R2) and C1

Hello all,
Using more than one CT sensor with correct burden resistor may I use the same biasing voltage divider (R1 & R2) and C1 to Arduino analog inputs?
Thanks all.

You can, but it is not advised. What you can do is use an op-amp buffer to provide a low impedance source of bias voltage, there is a diagram in Learn and the subject has been discussed here very recently.

Thanks Robert,
In my home automation project I am using CT sensor just to get information from current on circuit or not.
I’m using if function like if analogX > 0 turn on a led. But due to AC current from CT sensor the Led is blinking.
Will bias voltage fix this?
Another question is when no current from CT sensor will analogRead() see some value due to bias voltage?
Do you have some idea?
Thanks again.

I think you must read the Learn pages about measuring current, in particular this one.

Because the current is oscillating backwards and forwards, and the voltage at your analogue input is going up and down 50 times per second, you cannot just use analogRead( ). So yes, analogRead() will give you a steady 512 reading (or thereabouts) with no current flowing. When there is current flowing, it will give you 512 ± something, depending on where you catch it on the wave.

The easiest way for you is to use our emonLib. That will give you an accurate measurement of the rms current - that is the value you would read with a multimeter - and then do your logic using that. Then you will have something like

` if ( ct1.calcIrms(no_of_samples) > 0.100)`
` { do something }`

calcIrms( ) will read about 100 samples per cycle of mains, so you need at least one mains cycle to have a reasonable average current. We normally recommend aiming for 10 cycles for accurate measurement, but for you, one or two might be enough. It depends on the delay that you can accept between the current flowing or not, and you being able to detect it.

You will need to compare against a small number, not zero, because you will always see a small value (mA) even when there is no current flowing.

Look at the example sketch on the next page to see how to use emonLib.

Thanks Robert. But I’m​ not understanding how to use emonLib.
emon1.current(1, 111.1); // Current: input pin, calibration.
I didn’t understand this 111.1 , calibration.

``````double Irms = emon1.calcIrms(1480);  // Calculate Irms only
``````

I didn’t understand double Irms function and this 1480.
Sorry my inexperience.

If you look at the source code for emonLib, there are a lot of comments that explain what is happening.

111.1 is the calibration constant that gives you the correct current in Amperes. It depends on the value of burden resistor and the c.t. ratio. The “Learn” section has a complicated page telling you how this is calculated - it is the current that will give you 1.0 V across the burden resistor. 111.1 is correct for the old emonTx V2 with a 18 Ω burden and the SCT-013-000 c.t. If you use a different value of burden, or a different c.t., that number will be wrong. But if you have an ammeter, you can measure the same current with your ammeter and your c.t., and adjust “111.1” to give the right answer according to your ammeter.

calcIrms( ) measures (in this case) 1480 samples of current and calculates the rms value. (The root mean square average value of alternating current is the value of direct current that gives the same heating effect in a resistor.)

Hello Robert,
I guess I am almost there.
Please take a look in this sketch to see whether i am on right direction.
My CT sensor is 5A/5mA with a 220 Ω burden resistor.

``````#include "Emonlib.h"
EnergyMonitor ct1;
``````

`int pino_ct1 = A1;`

``````Void setup()
{
Serial.begin(9600);
ct1.current(pino_ct1, 4.54);

}
Void loop()
{
double Irms = ct1.calcIrms(10);
if (Irms > 0.100) {
led1.on();
}
else {
led1.off();
}
}
``````

I need just led 100% ON with current on CT sensor and 100% OFF with no current.
Question: The current flowing on CT primary side is about 200mA. Will it work?
Thanks again.

That is not many samples. You will only see a short segment of the sine wave, and if you happen to start reading 5 samples before the zero crossing and finish 5 samples after, you will read a very, very small value - certainly not the true rms current.

With 200 mA primary current, what is the secondary current, therefore what is the voltage across the burden resistor? Can you calculate that? And is that enough to detect reliably?

It’s only 2.75% of the maximum you can read with that c.t & burden. It might not be, in which case, as you are not worried about the shape of the waveform, you could increase the value of your burden resistor, maybe try 560 Ω?

500 could be a good samples value? What do you recommend?

Across 220 Ω burden resistor I got 0.0 V using digital voltmeter.
Using 39K Ω, I got 1.7 V. Its ok this value to burden?

I have not tried to time calcIrms( ), but calcVI( ) can measure about 55 samples per 50 Hz cycle, so I would expect calcIrms to be about twice that. I think 500 samples will measure about 5 cycles (0.1 s) so it seems a good number to start with.

39 kΩ seems too high. You want not more than 1.6 V across the burden at the maximum current you are likely to see. Any more ( more than 5 V peak to peak) risks damaging the input of your Arduino.

What value of burden resistor (“sampling resistor”) is recommended for your c.t.? Knowing that will give me some guide to its VA rating, hence the maximum voltage you can expect it to be able to generate at your 200 mA primary current.

It’s recommend 200 Ω and 1V for sampling voltage.

There you are then. You can safely increase the burden value to give you up to 1 V rms. Above that, you’re likely to see distortion and phase errors in the waveform. But as you’re not particularly concerned about that - you are only interested in measuring something or nothing - I’d increase the burden up to the point where you can reliably detect the difference between your circuit carrying the current you want to detect, and not.

It’s all working and I didn’t need to use bias voltage. Only Irms was enough.
Thanks Robert.

I measured & posted the sampling rate - did you see that post?
Those numbers meant that the smallest number of samples for a whole number of cycles of mains is 112 for a 50 Hz system, or 93 for a 60 Hz system (1 cycle) or the smallest universal number is 559 (100 ms, or 5 cycles of 50 Hz or 6 cycles of 60 Hz). The recommended monitoring period is 300 ms (1676 samples).

I didn’t. Where is this post?
I’m using 500 samples with 60Hz system. I will change to 1676 to improve like you said.