### Current sensor TA17-03 from elecfreaks.com

Hi guys.

Could I have one question?

I have current sensor TA17-03 from elecfreaks.com and I don't know how setting current constant in sketch emon1.current(1, 111.1) and value for result in EmonLib.cpp (original value is result = 1126400L / result; for current sensor SCT-013-000 -> 1100mv*1024 ADC steps) because I don't know which values I have to use from datasheet for this current sensor (http://www.elecfreaks.com/store/noninvasive-ac-current-sensor-ta17030405-p-85.html).

I have another one current sensor which used Hall's sensor (ACS712 variant for current 20A). For this sensor I used current constant 111.1 and value for result I used 102400. Because resolution is 100mV per 1A so 100mV*1024 ADC steps. This sensor works fine and results are good.

Do you have any idea?

Thanks.

### Re: Current sensor TA17-03 from elecfreaks.com

Firstly, readVcc( ) in emonLib is nothing directly to do with your current sensor. It calibrates the battery voltage (if you are running your emonTx from a battery) - which is the analogue reference voltage - against the internal reference in the AVR. So don't change it unless you know the value of the internal reference voltage (somewhere in the range 1.0 - 1.2 V). It may introduce a 9% error but you correct that with the calibration procedure.

The c.t you have is 10 A / 10 mA, so read up on how the constant is derived and plug those numbers into the maths here: CT and AC power adaptor installation and calibration theory

The maths will work for your Hall effect sensor too, when you know that the c.t. current multiplied by burden resistance is the voltage you get across the burden resistor and that is exactly equivalent to the Hall effect sensor voltage.

Remember when choosing your burden resistor that the c.t's maximum output voltage of 1.5 V is satisfactory for a 5 V Arduino but too much for the 3.3 V emonTx.

### Re: Current sensor TA17-03 from elecfreaks.com

Thanks Robert.

So constant will be: 10 / 0.010 / 33 (when I use 5V supply, over USB and burden resistor is 33ohm).

Is it correct? :-)

Thanks

### Re: Current sensor TA17-03 from elecfreaks.com

That sum is correct, but your burden resistor is a bit small - if you have a 5 V Arduino (as distinct from a 3.3 V emonTx) you are only using less than 20% of the input range. I'd increase it but be aware that increasing the value too far will overload the c.t. and lead to saturation and distortion. The web page indicates it should be good ( <0.2% linearity ) up to 1.5 V - that's rms so you'd be using 85% of the 5 V input range, and that's fine.

### Re: Current sensor TA17-03 from elecfreaks.com

Hmmm.

So I read datasheet for TA17-03  more one time and I found out - TA17-03 has three pins Vcc, GND and Signal and SCT-013-000 has only two pins.

Is possible use TA17-03 for metering with emonTx?

### Re: Current sensor TA17-03 from elecfreaks.com

What you are saying is not what the data sheet that you linked to tells me. I can only know what the data sheet says, and that clearly shows 4 terminal pins, only two of which are used and connect direct to the secondary winding. If your TA17-03 has three pins Vcc, GND and Signal, then it is not the same thing. You need to take that up with your supplier, what you have is not what they described, and to sell something that is not as described is illegal in the UK.

### Re: Current sensor TA17-03 from elecfreaks.com

No, no.

I'm sorry, I forgot write that I have TA17-03 Brick (!) which it has three pins, really. Previously I wrote TA17-03 (only). Look at this http://www.elecfreaks.com/store/octopus-noninvasive-ac-current-sensor-ta1703-brick-p-648.html . So I'm confused. This current sensor brick probably isn't suitable for emonTx.

### Re: Current sensor TA17-03 from elecfreaks.com

That link still does not tell me what is inside the device. "For details, see product manual." Where is that?

My best suggestion is to remove the current transformer from the circuit board and use it according to the circuit diagram in the first data sheet, i.e. exactly like the standard YHDC c.t.

### Re: Current sensor TA17-03 from elecfreaks.com

Why did I asked on it? I need gauge current on one phase on which I have one solar panel (240Wp) with microinverter (Grid-Tie Involar - http://90.182.76.49:8090). Because I can't deliver electricity to distribution system (behind my electricity meter; Czech rules - laws) so I wanted measure current with this method. And when will be current very small (consumption will be same then production) I must improve load (few watts) and preclude overflow to distribution system.

It is big problem for me. :-(
I'm not an electrician. I'm a builder. :-)
So I try testing miscellaneous methods.

### Re: Current sensor TA17-03 from elecfreaks.com

I cannot find out what is between the 3-pin connector on your module and the pins of the c.t. I guess (and I can only guess) that it is similar to the bias components R1, R2 & C1  in "CT sensors - Interfacing with an Arduino". If my guess is correct, then you do not need to remove the c.t. from the module, and you use the module instead of those 2 resistors and capacitor. Is it possible for you to see what other components might be there - I cannot see from the photographs.

### Re: Current sensor TA17-03 from elecfreaks.com

I used brick directly to Arduino - signal pin to analog pin on Arduino. Results were interesting and maybe usable. For bulb 60W where current is 0.25A - I set current constant in sketch [emon1.current(1, xxx)] on 10. Current on serial monitor was same (sometime 0.256A, sometime 0.248A - average was 0.25A ). When I used bulb 40W where current is 0.17A so calculate was with fault. Serial monitor showed sometime 0.16A, sometime 0.15A. 0.155A average.

I don't need to measure consumption but I have to secure any overflow to distribution system.

If will be constant consumption from 9AM to 4PM, when I'm in work and nobody at home, about 150W (NAS,Home server, RPI, Arduino etc.) then will be current 0.652A (150W / 230V). And if production will be smaller than consumption so it will be good. And when will be sunny so my microinverter will produce more than my consumption. It will be problem. And so I wanted measure current and if it was near to zero (production will be higher and higher) so I wanted increase consumption (about few watts with PWM and SSR relay and small bulb).

### Re: Current sensor TA17-03 from elecfreaks.com

What value of burden resistor are you using?

### Re: Current sensor TA17-03 from elecfreaks.com

Hello Robert.

I use current sensor directly. Signal pin from current sensor I have connected directly to analog pin on Arduino. Without burden resistor. See on picture bellow

http://90.182.76.49:8090/Temp/WP_003330.jpg

### Re: Current sensor TA17-03 from elecfreaks.com

There must be a burden resistor, but it is hidden inside the assembly. I still have the problem of not knowing what is inside there. As I cannot find any useful data, I cannot tell you how to calibrate it. All you can do is measure the primary current and adjust the current calibration coefficient until the current reads the same as your meter.

### Re: Current sensor TA17-03 from elecfreaks.com

Hi. I am also using the TA17-03 brick. i also connect the signal pin to analog of arduino.  My load is 100W bulb for the testing. So i think, i must get 0.416A. But I did not get it. The current sensor is connected to  light or natural cable?  Ground is disconnected.

### Re: Current sensor TA17-03 from elecfreaks.com

can someone provide the code for arduino since i am using TA17-03 Brick current sensor?

### Re: Current sensor TA17-03 from elecfreaks.com

I do not understand what you mean by "The current sensor is connected to light or natural cable?". Can you explain using different words? If your first language is not English, can you repeat what you are trying to say in your own language, please?

If you are using Google Translate, do this: Translate your words to English, then translate the English back into your language. If it is not what you want to say, choose different words and try again.

The elecfreaks website information for this device is not accurate, you do not get 1.5 V when you have 10 mA and a 200 Ω burden resistor, the diagram does not show 3 pins like the photograph, and no 5 V is shown on the diagram but 5 V is specified; so we cannot believe that information.

What output do you get? What sketch are you using in your Arduino?

### Re: Current sensor TA17-03 from elecfreaks.com

Hi. Sorry that I make you confuse. I use TA17-03 brick current sensor to measure the current value. That current sensor brick contains 3 pins as you know in order to connect to arduino easily (such as 5V, Signal and Ground pins). So, I directly connect the current sensor to arduino according to the information available via internet.

Then, , I used 100W light bulb as my load to test whether my current sensor is working or not. What I believe is, if the load is 100W, I think, I should get 0.416A using my current sensor because I apply P=V*I. But now what I am getting is not stable value. Sometime, it goes up to 5A or remain 0A though I  turn on the load.

The code that I am using to get the current value using Arduino is exactly the same as the website link that I attach here.

So, I would like to know where I am wrong. What I think is, the coding that I use to retrieve the current value using Arduino is not the right one.

Hope, you understand what I am trying to say now.

Thx.

### Re: Current sensor TA17-03 from elecfreaks.com

Would be nice to see your code.

Are you using a 100W light bulb connected to your AC mains? Then you should expect an AC current through this (highly resistive) load. Means that the current value is changing all the time between negative and positive values.

If your sketch is just using analogRead() without any sort of 'integration' (usually RMS calculation for AC mains values) then you cannot expect to see the 'real' AC current.

Look into one of the many sketches written for AC power measurements with the EmonTX hardware to get an idea what has to be done.

BR, Jörg.

### Re: Current sensor TA17-03 from elecfreaks.com

Hi All.

I am also using the same TA17-03 current sensor brick. I test my current sensor with 60W ac load. I suppose to get 0.256A based on the theory

I connect the current sensor to arduino as shown in the following website link.

The code that I write to get the measurement current value using arduino as shown belowed.

#include "EmonLib.h" // Include Emon Library

EnergyMonitor emon1; // Create an instance

void setup()

{

Serial.begin(9600);

emon1.current(1, 111.1); // Current: input pin, calibration.

}

void loop()

{

sensorValue=sensorValue*0.7071;

//double Irms = emon1.calcIrms(1480);

// Calculate Irms only //Serial.print(Irms*230.0); // Apparent power Serial.print(" ");

// Serial.println(Irms);

Serial.println(sensorValue); // Irms

}

I know my code is sth wrong but i dont know what is wrong and what it should be.

Thx.

Pls give some suggestion.

hi

### Re: Current sensor TA17-03 from elecfreaks.com

This is the code that I program it on arduino to meaure the current using TA17-03 current sensor. I know it is sth wrong. But I dont know what is wrong with that code.

void setup() {
Serial.begin (9600);
}
void loop() {
sensorValue=sensorValue*0.7071;//to get RMS value

Serial.println((sensorValue)*20/1023);
delay(1000);
}

I am using 100W light bulb to test my current sensor and the code.So, I attach the current sensor to the cable of the light bulb and 5V, Gnd and Signal pins are connected to the arduino.Pls help

Thx.

### Re: Current sensor TA17-03 from elecfreaks.com

Sorry. I forgot to copy the top part of my arduino.So, it makes my arduino code incomplete. The rest are the same.

#include "EmonLib.h"                   // Include Emon Library
EnergyMonitor emon1;                   // Create an instance

void setup()
{
Serial.begin(9600);

emon1.current(1, 111.1);             // Current: input pin, calibration.
}

Apologize again.!!

### Re: Current sensor TA17-03 from elecfreaks.com

Hi. I also writing the same code like you. May be our referring references are the same. Haha. But I still dont get the correct result. Update me if you manage to get it.

Your help will be much appreciated.

### Re: Current sensor TA17-03 from elecfreaks.com

Hi.  Actually, I would like to get the answer that you got. How did u achieve it? What was the code that you used to get the correct result?

### Re: Current sensor TA17-03 from elecfreaks.com

Sorry, This question is asking to bis69 because i saw his post that  he managed to get the acceptable result.

### Re: Current sensor TA17-03 from elecfreaks.com

micheal: I've sent this in a PM answering yours:

In:

emon1.current(1, 111.1); // Current: input pin, calibration.

"1" is the input pin for your current. You are using "A0", which is actually pin 0. So if you change it to

emon1.current(0, 111.1); // Current: input pin, calibration.

you should read the current. You must calculate the calibration number to suit your sensor and the burden resistor you are using. Unless your current transformer has one internally - it will be "voltage output" if it has - you must have a burden resistor. That page you linked to shows many different things and I do not know what you have. Look again at our Building Blocks section and the page I sent you to, to see what you must do. There is also a page that tells you how to calculate the calibration constant.

### Re: Current sensor TA17-03 from elecfreaks.com

thx you Robert.

I will try to your instruction and work on it tomorrow. Then I will update you in this forum with the working code.

### Re: Current sensor TA17-03 from elecfreaks.com

I would like to thx to Robert and Micheal for helping and answering my questions patiently. Finally I can measure the current of my AC load using TA17-03 brick though the accuracy is not good enough but it is acceptable. The working and correct code are as followed. Good Luck.

#include "EmonLib.h"                   // Include Emon Library
EnergyMonitor emon1;                   // Create an instance

void setup()

Serial.begin(9600);

emon1.current(1,6.7);             // Current: input pin, calibration.
}

void loop()
{

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

Serial.print(Irms*230.0);        // Apparent power
Serial.print(" ");
Serial.println(Irms);//print Irms
delay(2000);

}

### Re: Current sensor TA17-03 from elecfreaks.com

Hi there,

I just signed up to comment on this. I want to be able to detect if a hot-water heater is active or not. The heater is controlled by a thermostat, so I need to sense the current draw when the thermostat is on. I don't care about the amount of current (since it cannot be changed), just an on/off indication. It's a 2.5 kW heater running from 240 Vac, so the current is about 10 A (the max. value for this sensor).

I could attach a neon bulb to the heater element, and detect that optically, but in this region people are a bit twitchy about mains wiring, so using the TA17-03 would be better. Inside the wiring box for the thermostat the power cable is opened up, so I can run the live wire by itself through the sensor.

To get to this point I have followed many interesting discussions of the web, but none of them quite conclusive. It seems that "non-invasively detecting that a mains appliance is on" is a common problem, but without a common solution.

Anyway, what struck me most is not what is there, but what is /not/ there. And so to my question.

Has anyone simply stuck a bridge rectifier on the output of a TA17-03 to give a dc signal whose magnitude is proportional to the ac current in the primary? With a smoothing cap. and an assumed infinite input resistance into an ADC the output ought to be linear.

If not, why not?

I would try it myself, but I am going to have to order a TA17-03 and wait for it to arrive. I assume you guys have tons of them on your various workbenches, and little else to do but leap into action and test my idea.

### Re: Current sensor TA17-03 from elecfreaks.com

Ah, I now know why. There is too much voltage dropped in the rectifier diodes for normal (linear) use, however, for my application (where the output should be 5V if I am consuming 10A) it ought to work. I am basically looking for a binary output based on the on/off state of the input.

Anyway, I found that from this, which may be of interest to this thread:
http://www.crmagnetics.com/Products/Assets/ProductPDFs/Precision%20Recti...

I also found this, which is quite novel as it does not require the wires inside a mains cable to be separated:
http://moderndevice.com/product/current-sensor/

### Re: Current sensor TA17-03 from elecfreaks.com

You don't need a bridge rectifier for what you want, a simple half-wave rectifier (that will have only one diode drop instead of two) should be good enough, and remember also that a CT, provided it does not have an internal burden resistor (which yours does), is a current source anyway, so it will generate whatever voltage is necessary (within its rating) to drive the current it needs to.

### Re: Current sensor TA17-03 from elecfreaks.com

Thank you. That's a good point. A half-wave rectifier should be adequate.

I will need a burden resistor as I wish to generate around 3V, which I can feed into a DS2406 one-wire GPIO and detect that current is being drawn. Again, as it's a heater a simple on/off is all that's required, and I know the power consumption of the heater element.

Incidentally, has anyone experimented with using a ferrite choke as a CT?

such as this one, (randomly chosen as an illustration):
http://www.jaycar.com.au/productView.asp?ID=LF1272

The live wire could go through the centre, and a burden resistor could be soldered across the two ends of the coil.

### Re: Current sensor TA17-03 from elecfreaks.com

An interesting thought, but I'd like to know more about its properties before I say any more.
(Note: The CT you chose does have an internal burden.)