Current sensing from a CT on one leg of a three phase system

HI,

So, i work in an industrial setting, and have a powder mixer connected to a magnetic Amp meter which is connected to one leg of a three phase supply via an 80A/5A CT. This is just to get general idea of current draw. When more precise information is needed, i just hook up a DMM in series to measure the amps.

Recently i got the idea of connecting a Grove ±5A DC/AC Current Sensor permanently in series with the analogue meter, so that I could data log I've used these in a few single phase AC and DC applications, and has always agreed with the DMM. However, when connecting it up to the CT it reads almost ( but not quite) 3X as much as the DMM.

this is the AC current sensing code from the supplier:

[ code ]
#ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE
#define RefVal 3.3
#define SERIAL SerialUSB
#else
#define RefVal 5.0
#define SERIAL Serial
#endif
//An OLED Display is required here
//use pin A0
#define Pin A5

// Take the average of 500 times

const int averageValue = 500;

long int sensorValue = 0;

float sensitivity = 1000.0 / 200.0; //1000mA per 200mV

//float Vref = 244;
float Vref = 1494;

void setup()
{
SERIAL.begin(9600);
}
static float tempval;
void loop()
{

// Read the value 500 times:
for(int i=0;i<20;i++)
{

for (int i = 0; i < averageValue; i++)
{
int temp;
temp= analogRead(Pin);
if(temp>sensorValue)
{
sensorValue=temp;
}
delayMicroseconds(40);
}
tempval+=sensorValue;
}

sensorValue=tempval/20.0;
tempval=0;
// The on-board ADC is 10-bits
// Different power supply will lead to different reference sources
// example: 2^10 = 1024 -> 5V / 1024 ~= 4.88mV
// unitValue= 5.0 / 1024.01000 ;
float unitValue= RefVal / 1024.0
1000 ;
float voltage = unitValue * sensorValue;

//When no load,Vref=initialValue
SERIAL.print("initialValue: ");
SERIAL.print(voltage);
SERIAL.println("mV");

// Calculate the corresponding current
float current = ((voltage - Vref) * sensitivity)*0.707;

// Print display voltage (mV)
// This voltage is the pin voltage corresponding to the current

voltage = unitValue * sensorValue-Vref;
SERIAL.print(voltage);
SERIAL.println("mV");

// Print display current (mA)
SERIAL.print("current: ")
SERIAL.print(current);
SERIAL.println("mA");

SERIAL.print("\n");

// Reset the sensorValue for the next reading
sensorValue = 0;

// Read it once per second
delay(1000);
}
[ /code ]

I'm aware I could simply divide the result by 3, to get a rough approximation; but this is a gap in my knowledge id like to fill. Does anyone know what changes I'd need to make to the code, or at least some ideas for me to tinker with.

Additionally, I can see the *0.707 and am aware this is to do with RMS of single phase, but as I say I'm not sure if that needs to be (1.73? if I remember) or if that is irrelevant for what I'm looking at.

Thanks for at least reading my post.

// Read the value 500 times:
for(int i=0;i<20;i++)

The comment doesn't match the code! Why do you think that 20 readings are enough? On an UNO you read about 3ms of the curve so it's just luck if you really get the peak value.

Where does the Vref value come from?

The Vref is the "zero calibration" it comes from running it with no load. You then enter the reading back into the code. As described here.

I think i see what you mean about the frequency.

Have you tried to change the "20" back to "500"?

I did, but only in the lab. Didn't have chance to get on the plant and test it live. I'll let you know if the readings are accurate when I get out there. (I did change both the "i" and the divide part for the average.)

I did notice however that the "zero"readings took ages to get printed. Didn't time it exactly but was around 30 seconds.

I even tried removing the delays, but still took a while.

But will comment when I've learned more.

Please repost your code correctly (as code). Without the indentation I overlooked the second loop, it's variable is called strangely but with that loop my findings are wrong as the value is read 10000 times.

It seems that other parts are mangled by the forum system, so I don't recommend anything anymore before seeing the correct code.

My apologies, please find below.

#ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE
  #define RefVal 3.3
  #define SERIAL SerialUSB
#else
  #define RefVal 5.0
  #define SERIAL Serial
#endif
//An OLED Display is required here
//use pin A0
#define Pin A5
 
// Take the average of 500 times
 
const int averageValue = 500;
 
long int sensorValue = 0;
 
float sensitivity = 1000.0 / 200.0; //1000mA per 200mV 
 
 
//float Vref = 244;
float Vref = 1494;
 
void setup() 
{
  SERIAL.begin(9600);
}
static float tempval;
void loop() 
{
 
  // Read the value 500 times:
  for(int i=0;i<20;i++)
  {
 
  for (int i = 0; i < averageValue; i++)
  {
    int temp;
    temp= analogRead(Pin);
    if(temp>sensorValue)
    {
        sensorValue=temp;
    }
    delayMicroseconds(40);
  }
  tempval+=sensorValue;
  }
 
  sensorValue=tempval/20.0;
  tempval=0;
  // The on-board ADC is 10-bits 
  // Different power supply will lead to different reference sources
  // example: 2^10 = 1024 -> 5V / 1024 ~= 4.88mV
  //          unitValue= 5.0 / 1024.0*1000 ;
  float unitValue= RefVal / 1024.0*1000 ;
  float voltage = unitValue * sensorValue; 
 
  //When no load,Vref=initialValue
  SERIAL.print("initialValue: ");
  SERIAL.print(voltage);
  SERIAL.println("mV"); 
 
  // Calculate the corresponding current
  float current = ((voltage - Vref) * sensitivity)*0.707;
 
  // Print display voltage (mV)
  // This voltage is the pin voltage corresponding to the current
 
  voltage = unitValue * sensorValue-Vref;
  SERIAL.print(voltage);
  SERIAL.println("mV");
 
 
  // Print display current (mA)
  SERIAL.print("current: ")
  SERIAL.print(current);
  SERIAL.println("mA");
 
  SERIAL.print("\n");
 
 
  // Reset the sensorValue for the next reading
  sensorValue = 0;
 
  // Read it once per second
  delay(1000);
}

I would expect that sketch to return a value about every 3 seconds.
I don't know what a "zero" reading is.

What type of Arduino are you using?

Can you post a picture of the setup?

Hello,
Have you considered using the DMM to measure what exactly goes from the grove to the Arduino analog input? This way you can determine if your assumtions regarding the Grove or those regarding the Arduino are at the base of the problem. If you have an expensive FLUKE DMM it can deterimine the max and min values and the effective value. If you see the effective value of a sine wave, then the actual value in time is v(t)=vEff * sqrt(2) * sin (wt) and the difference between max and min value of V(t) is 2 * sqrt(2) = 2.82, this is almost 3. Could be a conincidence, could be at the base of your problem: you measure the difference between min and max and not the effective value? You could also use a capacitor and a resistor to filter the signal before it goes into the Arduino. Hardware filtering can be much more reliable than the software way.

Hi,

The "Zero" reading is, when the grove is connected to +5v and GND of the arduino, and the signal connected to the analouge input pin (in this case A5) of the arduino, but no current is passed through the input terminal of the Grove. it will give a reading in mV, which is then used to update the Vref, hence "Zero."

the arduino is deffinatly an UNO design.. I have both genuine Arduino and some knock-offs (probably Elegoo) on site, i'll try both on Monday for speed.

i'll take a picture of the setup at the same time... unless there is something specifc you are looking for?

Thanks for the reply. I've got a decent FLUKE DMM at work, will check if it can what you ask on Monday.

That 2.82 would make those values fall in line almost perfectly....

with regards to “effective value” I've never heard that before. Is that different to RMS?

In most three phase systems the current draw is the same on each phase, if not something is wrong.

So much depends on the equipment. Only motors, that is likely true. On the big convection ovens, that will be true if ALL the heating elements are on and no motors are turning. Heating elements are distributed across the phases. All motors are single phase or DC from single phase power supplies.
Paul

i figuered out why it was updating so slowly. just to re-iterate this is copied code, so i took some time to get my head around it.

the above determines sample number.

this sets the repeats of the sampling, i.e. it is doing the 500 * 20, which makes more sense (in terms why it seemed so slow)

both the Genuine and knock off UNOs were at the same speed, so one "issue" down!

I hooked the DMM up and was happy with the Grove output, but not sure what i'm looking for regarding the "effective Value".

have spent some time looking at the code and have adjusted it slightly, it seemed to be alot closer when compared to the DMM, but that was with an empty mixer. I will get chance to put it under load tomorrow and see if the values remain close over the range required.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.