Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

calibration of ACS712elctr-30a-t

Status
Not open for further replies.

virk

Newbie level 3
Joined
Nov 24, 2016
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
45
I want to measure AC current using ACS712 current sensor.Its output is proportional to current flowing through input terminal.ACS712's output is sinusoid 50 HZ.This output is fed to A0 pin of arduino.
problem with current measuring is that it always read peak value which is not actual value.
arduino code is
void loop() {
// put your main code here, to run repeatedly:
anaread=analogRead(A0);
volt=(anaread/1024.0)*5.0;
amp=(volt-offset)/mvperamp;
Serial.print("reading=");
Serial.println(anaread);
Serial.print("volt=");
Serial.println(volt,5);
Serial.print("current=");
Serial.println(amp,5);
}
 

The ACS712 shouldn't have any problem following the 50 Hz, so I suspect the configuration of your ADC might be the issue. What is the sampling frequency you are using? What is the resolution of the ADC?
 

Hi,

What do you mean with "it always read peak value"

What do you want to measure with this method?
You will get any random value from the sine. No meaningful value.

--> if you want RMS, then read how to measure and calculate RMS.
--> if you want "average of rectified sine" ... do the same

Klaus
 

It's a completely wrong approach to measure AC current.

Presently you are taking individual samples of instantaneous current and are printing it, quite slowly according to UART output speed. The samples are arbitrary points of the sine waveform, nothing that deserves the name "AC current".

Possible steps:
- clarify what kind of measurement you want to perform (rms current, averaged rectified value, or?)
- write a code that acquires a sufficient number of samples in a loop and stores it to a variable array, then processes it
- or write a code that processes the samples continuously
 

Try this code.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
int analogPin = A0;
int rawValue = 0;
double current = 0.0;
 
void setup()
 { // put your setup code here, to run once:
   Serial.begin(9600);
   Serial.println("ACS712 30A DC Current Measurement");
   Serial.println("---------------------------------");
 }
 
void loop()
 { // put your main code here, to run repeatedly:
   rawValue = analogRead(analogPin);
   delay(3);
   current = ((((double)rawValue * 5.0 / 1023.0) - 2.5) / 0.066);
   Serial.print(current);
   Serial.print(" A    ");
   Serial.print(current * 1000.0);
   Serial.println(" mA");
   delay(1000);
 }

 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top