Power Sensor -> Watts/Hour problem

Hello all,

I am trying to measure power consumption of devices by using an TA12-200 power sensor.

This sensor is using a 800 ohms resistor and a 1:2000 ratio.

I understand the code to calculate the power intensity passing through the wire, but I don’t understand how to convert it to watts/hour measure.

For my sample I am using a LCD screen consumption (which consume 30W/h). And when trying to measure it’s consumption I get 600mA through wire (which I was assuming were by second). So on my 230v network, it would give me 138 W/h which is wrong…

I guest I don’t really understand what I am really measuring… Help would be greatly appreciate :slight_smile:

Here is my arduino code to measure the sensor on A0 :

float KNPwrSwitch::GetPowerConsumption()
{
        int sensorMax = 0;
 uint32_t start_time = millis();

 // Sample the max value for 1000 ms
 while ((millis() - start_time) < 1000)
 {
             float sensorValue = analogRead(_aPin);

             if (sensorValue > sensorMax)
                  sensorMax = sensorValue;
 }

 // Compute input voltage
        float vIn = (sensorMax * 5.0) / 1024.0;
       // Use Ohms law to compute intensity (A) (800ohms for TA12-200)
        float intensity = (vIn / 800) * 1000.0;
        // Use formula for SINE wave to convert to RMS
       float rms = intensity * 0.707;

  /* 
   Current Transformer Ratio is 2000:1...
   
   Therefore current through 800 ohm resistor
   is multiplied by 2000 to get input current
  */
        float curThroughWire = rms * 2000;
  
  if (DEBUG_MODE) { Serial.println("Power Consumption"); }
  if (DEBUG_MODE) { Serial.println("-----------------"); }
  if (DEBUG_MODE) { Serial.print("Volts Peak : "); }
  if (DEBUG_MODE) { Serial.println(vIn, 3); }
  if (DEBUG_MODE) { Serial.print("Current Through Resistor (Peak in A) : "); }
  if (DEBUG_MODE) { Serial.println(intensity, 3); }
  if (DEBUG_MODE) { Serial.print("Current Through Resistor (RMS in A) : "); }
  if (DEBUG_MODE) { Serial.println(rms, 3); }
  if (DEBUG_MODE) { Serial.print("Current Through Wire (mA) : "); }
  if (DEBUG_MODE) { Serial.println(curThroughWire, 3); }
  
 return (curThroughWire / 1000) * 230; // This is giving me 130W/h which is wrong.
}

EDIT :

I just have tried with simples old light bulb (28W, 40W, 50W, …) and there I get a correct result for Watt/hour. Does it mean that the problem is more related to the LCD screen I trying to measure ?

Since you are measuring AC coming from the current transformer, how are you converting it to a DC value that can be measured by the Arduino A/D pin?

Paul

Hi,


Is an AC current transformer, you cannot measure DC.
What LCD screen, how is it powered and where are you measuring?
Can you post a picture of your setup, measuring the LCD current?

Thanks.. Tom... :slight_smile:

but I don't understand how to convert it to watts/hour measure.

There is something more fundamental that you don't understand. Watts/hour or Watts-per-hour is a nonsensical measure. Power is measured in Watts. Energy can be measured in Watt-hours. Which are you trying to measure?

EDIT: OK, I suppose Watts/hour could be a measure of the rate of change of power. But I don't think that's what the OP wants to measure.

Yep .. it’s watthours , Watts x hours.

Watts = volts x current .

So if you lcd , say uses 2watts , in an hour it will have used 2watthours.

If it was on for only 30 minutes it will have used 1watthour.