AC current sensor connection

Hi,

I am trying to connect an AC current sensor to arduino but the sensor is not working, it does not read any values of current, I tried to mesure the current going to a coffee machine, a toaster, a kettle and an air compressor, nothing worked, can someone help me?
I have attached a picture of the circuit and I a link to the AC sensor pruchsed. I think maybe I don't understand the specifiction of the sensor and that might be the problem.

Picture:


Sensor link: https://amzn.eu/d/82Qq0HD

Thank you for your time,

Which of the AC wires are you putting into the current measuring clamp ?

Please post the sketch that you are running

for the Air compressor, the wire that powers the air compressor from the wall electric socket

there are at least two wires in the AC cable.

the AC current changes at 50/60 Hz so you have to sample the values for some miliseconds

are you saying the problem might be in the code? below is the code I used

//uses A0 & A1
#include <Wire.h>
#include <Adafruit_ADS1015.h>

Adafruit_ADS1115 ads;

const float FACTOR = 25; //20A/1V from teh CT

const float multiplier = 0.00005;

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

  ads.setGain(GAIN_FOUR);      // +/- 1.024V 1bit = 0.5mV
  ads.begin();

}

void printMeasure(String prefix, float value, String postfix)
{
  Serial.print(prefix);
  Serial.print(value, 3);
  Serial.println(postfix);
}

void loop() {
  float currentRMS = getcurrent();

  printMeasure("Irms: ", currentRMS, "A");
  delay(1000);

}

float getcurrent()
{
  float voltage;
  float current;
  float sum = 0;
  long time_check = millis();
  int counter = 0;

  while (millis() - time_check < 1000)
  {
    voltage = ads.readADC_Differential_0_1() * multiplier;
    current = voltage * FACTOR;
    //current /= 1000.0;

    sum += sq(current);
    counter = counter + 1;
  }

  current = sqrt(sum / counter);
  return (current);
}

You can't use that sensor on a power cord, it will always read zero.
You need to cut the power cord and connect the sensor around just one of the wires

1 Like

I assume that you mean the cable containing the 2 wires that power the compressor. I was afraid that you would say that. As you will have seen from other replies that will not work because the current measured in one wire of the cable will cancel out the current measured in the other wire of the cable

As you have tried to use the sensor with multiple mains powered devices, it might pay you to make up a special test lead.

You need a lead with a mains plug on one end a mains socket at the other end, with the three conductors broken out so that you can clamp the sensor around one wire only.

You might be able to make one from a bought in mains extension lead, and carefully remove a section of the outer insulation of the cable, taking care not to damage the inner colour coded wire insulation.

Thank you for the clarification

thank you for the clarification

Thank you

is there a way to measure current without cutting the power cord, maybe using another sensor?

no.

Make yourself a short extension lead with a mains plug on one end and a mains socket on the other with 3 separate wires between them to allow the current clamp to be placed over one of them

You can use this to measure the current consumption of any device plugged into the lead

You still have more to do. The way you have it connected to the ADS1115 will not work.

See the description on this webpage.
The current sensor you have has the burden resistor built in so you don’t need it.

https://docs.openenergymonitor.org/electricity-monitoring/ct-sensors/interface-with-arduino.html

For ‘one off’ estimates of large household AC currents, I have occasionally resorted to opening the outside ‘meter’ box containing the incoming 240V mains supply. Then carefully timing revolutions of the spinning dial, before and after switching on the device.

Pencil and paper also required.

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