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
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 ?