How to use Non-invasive AC Current Sensors with Arduino

Posted on by
Non-invasive AC Current Sensor SCT-013-000.

Non-invasive AC Current Sensor SCT-013-000.

Non-invasive AC Current Sensors are a good way to measure real consumption without altering the electrical composition of the elements to be analyzed. They work by magnetic induction, so that the field generated in the cable, used to power the device, induces a current in the transformer integrated in the sensor. In this way we can know what the current is in the power cable and therefore the actual consumption of the device to be measured.

SCT-013 specifications.

SCT-013 specifications.

Among the variety of sensors that are in the SCT-013 series we will use the STC-013-000 model because it is the only one that does not have an integrated resistance, allowing us to adjust the measuring range in which we work, as well as you can see in the table can measure currents up to 100A.

To connect to Arduino we have to use a very simple circuit, in which the values of its components will determine the measurement range. The Arduino itself also will impose limitations such as the maximum value of the input voltage in the digital analog converter and the number of bits (10 bits) which will have a resolution limited.

Circuit to connect SCT-013-000 to Arduino.

Circuit to connect SCT-013-000 to Arduino.

Being an AC measurement to do it with Arduino we have to create a virtual ground by a voltage divider because we can measure only positive values, so that the intermediate value is 2.5V. This causes the maximum amplitude of the voltage is 2.5V.

To assign the circuit values we take the European power system (220V and 50Hz). The SCT-013-000 will give us the current in the power cable in which this measuring divided by 2000 (as the integrated transformer consists of 2000 laps). Bearing all this in mind we must decide either what we want to measure maximum current or minimum current we want to detect. By having 10 bits LSB, conversion will be  5V / 1024 so the minimum jump between digital values, our resolution will be 4,882mV. In this case I will define the accuracy is approximately 0,5Watts, the commercial value of resistance that comes closest to achieving this precision is 3300 ohms. With this value Rburden the maximum power that can be measured 235.7 Watts and an accuracy of 0.46 Watts.

Resistors R1 of the voltage divider must have a value much higher than the value of the Rburden so that the divisor is not affected. In this case 100Kohms will be enough. The capacitor, with a value of 10μF will serve us.

To be more precise as far as possible we will also measure the virtual ground to adjust to the maximum the measures by software. Here below you have some sample code for Arduino.

 

const unsigned int numReadings = 200; //samples to calculate Vrms.

int readingsVClamp[numReadings];    // samples of the sensor SCT-013-000
int readingsGND[numReadings];      // samples of the virtual ground
float SumSqGND = 0;            
float SumSqVClamp = 0;
float total = 0; 


int PinVClamp = A0;    // Sensor SCT-013-000
int PinVirtGND = A1;   // Virtual ground

void setup() {
  Serial.begin(9600);
  // initialize all the readings to 0:
  for (int thisReading = 0; thisReading < numReadings; thisReading++) {
    readingsVClamp[thisReading] = 0;
    readingsGND[thisReading] = 0;
  }
}

void loop() {
  unsigned int i=0;
  SumSqGND = 0;
  SumSqVClamp = 0;
  total = 0; 
  
  for (unsigned int i=0; i<numReadings; i++)
  {
    readingsVClamp[i] = analogRead(PinVClamp) - analogRead(PinVirtGND);
    delay(1); // 
  }

  //Calculate Vrms
  for (unsigned int i=0; i<numReadings; i++)
  {
    SumSqVClamp = SumSqVClamp + sq((float)readingsVClamp[i]);

  }
  
  total = sqrt(SumSqVClamp/numReadings);
  total= (total*(float)2/3); // Rburden=3300 ohms, LBS= 0,004882 V (5/1024)
                             // Transformer of 2000 laps (SCT-013-000).
                             // 5*220*2000/(3300*1024)= 2/3 (aprox)
  
  Serial.println(total);
  delay(1500);  
}
Comments are disabled