Energy meter ACS712 and UNO

HI there,

i am searching for best code for arduino uno for measuring energy with acs712.. i have three phases
what code do you suggest for this?

I don't have a clue what you mean by "energy", but the ACS712 only measures current.

Paul

did you hear for Watt?
i want to get Watts using ACS712 current sensor

You can’t get watts from a current sensor - you need to measure two currents and 3 voltages , unless you have a balanced load .

There are difficulties of dealing with the high voltages , calculating phase angles and all that stuff .
Probably best not to mess with this stuff unless you are suitably qualified and understand 3ph and to measure 3ph power ( sorry, but your post suggests you don’t have this knowledge).

You might be better off buying meter ( cheaper?) and using a pulse output from it .

neznamnista:
did you hear for Watt?
i want to get Watts using ACS712 current sensor

If you know the "volts", then you can compute the watts using the output of the ACS712. Measure the output of the ACS712 using the Arduino A/D, convert that value to amps and multiply your known volts by the amps and get your watts. The graphs in the ACS712 data sheet show you the relationship between it's output volts and the current being read by the ACS712.

Paul

U = 220V

I - i got from circuit sensor ACS712

and P = U*I [W]

so, i need code for this

i am sure that i am not first one who is using this sensors for measuring

neznamnista:
U = 220V

I - i got from circuit sensor ACS712

and P = U*I [W]

so, i need code for this

i am sure that i am not first one who is using this sensors for measuring

Bet you are!

Do you have the electronic side of the project done and connected to your Arduino? Have you used a sample program to read the analog input and display the value?

Paul

yes i am using this code but now i am searching how to publish this data to adafruit.io
and also maybe there is another code for this sensor

#include "ACS712.h"
char watt[5];
ACS712 sensor(ACS712_30A, A0);
unsigned long last_time =0;
unsigned long current_time =0;
float Wh =0 ;  
void setup() {
  Serial.begin(115200);
  sensor.calibrate();
}

void loop() {
  float V = 220;
  float I = sensor.getCurrentAC();
// Serial.println(I);
  float P = V * I;
  last_time = current_time;
  current_time = millis();    
  Wh = Wh+  P *(( current_time -last_time) /3600000.0) ; 
   dtostrf(Wh, 4, 2, watt); 
   Serial.print( "\t Watt: " );     
Serial.print(watt);
  delay(10000);
  Serial.println();
}

neznamnista:
yes i am using this code but now i am searching how to publish this data to adafruit.io
and also maybe there is another code for this sensor

#include "ACS712.h"

char watt[5];
ACS712 sensor(ACS712_30A, A0);
unsigned long last_time =0;
unsigned long current_time =0;
float Wh =0 ; 
void setup() {
  Serial.begin(115200);
  sensor.calibrate();
}

void loop() {
  float V = 220;
  float I = sensor.getCurrentAC();
// Serial.println(I);
  float P = V * I;
  last_time = current_time;
  current_time = millis();   
  Wh = Wh+  P *(( current_time -last_time) /3600000.0) ;
  dtostrf(Wh, 4, 2, watt);
  Serial.print( "\t Watt: " );   
Serial.print(watt);
  delay(10000);
  Serial.println();
}

and is the result right? the library looks amateur

The equation you have is only correct if the load is resistive ( unity power factor ) and doesn’t account for the 3phase aspect .

hammy:
The equation you have is only correct if the load is resistive ( unity power factor ) and doesn’t account for the 3phase aspect .

But that is all the information he can get from that sensor. Needs more stuff to get actual power being used by three phase AC.

Paul

The ACS712 is not rated for mains voltage, as its basic and reinforced insulation ratings(*) are both inadequate for 240Vac. The basic rating is good for 110Vac, however, so an earthed circuit using it for 110Vac is possible, from
my understanding, but it cannot count as doubly insulated.

In short the SOIC8 package is simply too small to have enough clearange/creepage for 240V mains, so I suspect its a no-go for three-phase as a consequence.

(*) See the datasheet.

Juraj please give me some professional solution

https://learn.openenergymonitor.org/electricity-monitoring/ctac/how-to-build-an-arduino-energy-monitor

This is a hobby forum , you cannot expect people to give “ Professional” advice and take the liability for what you do .
You need to pay a certified electrical Engineer to provide you with safe low voltage signals you can work from .

just answering on his comment that this code was amatuer

i dont want to use CT's

i have ASC712 sensors

neznamnista:
i dont want to use CT's

i have ASC712 sensors

the code and calculations are the same

can you put here code for my sensors for uploading to UNO and NodeMCU

neznamnista:
can you put here code for my sensors for uploading to UNO and NodeMCU

see "Step Three" on Learn | OpenEnergyMonitor page
or if you don't have a voltage sensor, then at
Learn | OpenEnergyMonitor

look around on the openenergymonitor site. there is everything you need for your project