TA12-100

Hello everybody,

I have non invasive current sensor TA12-100

I found only one sketch for this sensor

/****************************************************************************/
// Function: Measure the amplitude current of the alternating current and
// the effective current of the sinusoidal alternating current.
// Hardware: Grove - Electricity Sensor
// Date: Jan 19,2013
// by www.seeedstudio.com
#define ELECTRICITY_SENSOR A1 // Analog input pin that sensor is attached to
float amplitude_current; //amplitude current
float effective_value; //effective current
void setup() {
  Serial.begin(9600);
  pins_init();
}
void loop() {
  int sensor_max;
  sensor_max = getMaxValue();
  Serial.print("sensor_max = ");
  Serial.println(sensor_max);
  //the VCC on the Grove interface of the sensor is 5v
  amplitude_current=(float)sensor_max/1024*5/200*1000000;
  effective_value=amplitude_current/1.414;
  //minimum_current=1/1024*5/800*1000000/1.414=8.6(mA)
  //Only for sinusoidal alternating current
  Serial.println("The amplitude of the current is(in mA)");
  Serial.println(amplitude_current,1);
  //Only one number after the decimal point
  Serial.println("The effective value of the current is(in mA)");
  Serial.println(effective_value,1);
}
void pins_init(){
  pinMode(ELECTRICITY_SENSOR, INPUT);
}
/*Function: Sample for 1000ms and get the maximum value from the SIG pin*/
int getMaxValue(){
  int sensorValue; //value read from the sensor
  int sensorMax = 0;
  uint32_t start_time = millis();
  while((millis()-start_time) < 1480)//sample for 1000ms
  {
    sensorValue = analogRead(ELECTRICITY_SENSOR);
    if (sensorValue > sensorMax)
    {
      /*record the maximum sensor value*/
      sensorMax = sensorValue;
    }
  }
  return sensorMax;
}

But the results of measurements is incorrect. For crosscheck i'm using energy meter.

When on energy meter current is 0.57A on com port shows

sensor_max = 80
The amplitude of the current is(in mA) 1953.1
The effective value of the current is(in mA) 1381.3

When on energy meter 11.27A on com port shows

sensor_max = 1023
The amplitude of the current is(in mA) 24975.6
The effective value of the current is(in mA) 17663.1

 

What should I do to get right figures?

Or it is better to use EmonLib?

 

Thank you in advance for your help

 

 

 

 

Robert Wall's picture

Re: TA12-100

That sketch appears to be reading the peak value of current and then assuming the current is a perfect sine wave in order to calculate the rms value. That's OK if (a) your mains voltage is a pure sine wave (in many places, it is not) and (b) you have a linear load (many, like computer power supplies, are not). It's not even measuring the peak-peak amplitude, and as I've no idea what is inside the moulding or on the circuit board, the sketch you're using seems unfit for purpose.

The most troubling part is you are using it at 11.27 A, which is over twice its rated capacity. It is reporting sensor_max = 1023, which is the maximum value you can get from the analogue input and that is not surprising as the specified current is 5 A maximum. If you want to measure more than 5 A, you have the wrong device and need a different CT.

For currents less than 5 A. you will probably get more accurate values from emonLib. But you will need to do a basic check first: I assume the 3 connections are GND, VCC and Analog In. Using a multimeter, check that the analog in sits at roughly Vcc/2 (i.e. 2.5 V dc for a 5 V Arduino supply). If that is OK, you should be able to use it with emonLib, but you will need to deduce the calibration coefficient required. Your unit would appear to have an internal 200 Ω burden and produces 1 V per 5 A input, so I make your calibration coefficient 5.

mel's picture

Re: TA12-100

Robert,  thank you for the detailed answer.

Now it becomes more clear

I will try to use CST-013-000

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.