Hi friends,
This is my first time using Arduino and I would like to have it display the current reading from a commercial Current clamp, (I'm using the Fluke 80i/110s). I first tested using the ACS712 and it worked perfectly with the code from
Then i changed the 'mV per amp' to 100 as the Fluke 81i/110s outputs 100mV/A but instead i got a zero reading for all my variables.
Can advise what I did wrong? When i used the oscilloscope, the Fluke 80i/110s works perfectly reflecting the correct current reading.
/*
Measuring AC Current Using Fluke 80i/110s
*/
const int sensorIn = A0;
int mVperAmp = 100; // use 100 for Fluke 80i/110s
double Voltage = 0;
double VRMS = 0;
double AmpsRMS = 0;
void setup(){
Serial.begin(9600);
}
void loop(){
Voltage = getVPP();
VRMS = (Voltage/2.0) *0.707;
AmpsRMS = (VRMS * 1000)/mVperAmp;
Serial.print(AmpsRMS);
Serial.println(" Amps RMS");
Serial.print("\t Voltage = "); // shows the voltage measured
Serial.print(Voltage,3); // the '3' after voltage allows you to display 3 digits after decimal point
Serial.print("\t Vrms = "); // shows the voltage measured
Serial.println(VRMS,3); // the '3' after voltage allows you to display 3 digits after decimal point
}
float getVPP()
{
float result;
int readValue; //value read from the sensor
int maxValue = 0; // store max value here
int minValue = 1024; // store min value here
uint32_t start_time = millis();
while((millis()-start_time) < 1000) //sample for 1 Sec
{
readValue = analogRead(sensorIn);
// see if you have a new maxValue
if (readValue > maxValue)
{
/*record the maximum sensor value*/
maxValue = readValue;
Serial.print("\t Max value = " );
Serial.print(maxValue);
}
if (readValue < minValue)
{
/*record the maximum sensor value*/
minValue = readValue;
Serial.print("\t Min value = " );
Serial.print(minValue);
}
}
// Subtract min from max
result = ((maxValue - minValue) * 5.0)/1024.0;
Serial.print("\t Result = " );
Serial.println(result);
return result;
}
Hi,
Have you tried connecting the output of the clamp to the arduino and fluke meter at the same time?
That is the fluke and arduino in parallel, as they both have high input impedance and neither presents any potential you should be able to do this.
That way you will be able to check that the input to the arduino is valid.
Also write a SIMPLE program that just reads the A0 and serial prints it, nothing flash, just as in this bit of pseudo-code
Have same amp clamp with different brand name (AEMC), modified your sketch (lines 5 and 22) and works OK on a Nano, only load I had handy was a 50 watt heating pad but seems fairly accurate.
Hope Fluke made a better version than this one (POS).
Good luck. NOTE Hooked up to GND & A0.
/*
Measuring AC Current Using Fluke 80i/110s
*/
const int sensorIn = A0;
int mVperAmp = 10; //100; // use 100 for Fluke 80i/110s
double Voltage = 0;
double VRMS = 0;
double AmpsRMS = 0;
void setup(){
Serial.begin(9600);
}
void loop(){
Voltage = getVPP();
VRMS = Voltage * 0.707; //(Voltage/2.0) *0.707;
AmpsRMS = (VRMS * 1000)/mVperAmp;
Serial.print(AmpsRMS);
Serial.println(" Amps RMS");
Serial.print("\t Voltage = "); // shows the voltage measured
Serial.println(Voltage,3); // the '3' after voltage allows you to display 3 digits after decimal point
Serial.print("\t Vrms = "); // shows the voltage measured
Serial.println(VRMS,3); // the '3' after voltage allows you to display 3 digits after decimal point
}
float getVPP()
{
float result;
int readValue; //value read from the sensor
int maxValue = 0; // store max value here
int minValue = 1024; // store min value here
uint32_t start_time = millis();
while((millis()-start_time) < 1000) //sample for 1 Sec
{
readValue = analogRead(sensorIn);
// see if you have a new maxValue
if (readValue > maxValue)
{
/*record the maximum sensor value*/
maxValue = readValue;
//Serial.print("\t Max value = " );
//Serial.print(maxValue);
}
if (readValue < minValue)
{
/*record the maximum sensor value*/
minValue = readValue;
//Serial.print("\t Min value = " );
//Serial.print(minValue);
}
}
// Subtract min from max
result = ((maxValue - minValue) * 5.0)/1024.0;
//Serial.print("\t Result = " );
0.35 Amps RMS
Voltage = 0.005
Vrms = 0.003
0.35 Amps RMS
Voltage = 0.005
Vrms = 0.003
0.35 Amps RMS
Voltage = 0.005
Vrms = 0.003
0.35 Amps RMS
Voltage = 0.005
Vrms = 0.003
0.35 Amps RMS
Voltage = 0.005
Vrms = 0.003
0.35 Amps RMS
Voltage = 0.005
Vrms = 0.003
0.35 Amps RMS
Voltage = 0.005
Vrms = 0.003
0.35 Amps RMS
Voltage = 0.005
Vrms = 0.003
0.35 Amps RMS
Voltage = 0.005
Thanks guys, let me digest your recommendations and see what i can come out with.
With the same code(less int mVperAmp = 100;// orginal value of 66 for acs712) it works and shows 0.29Amp when i connected to a 60Watt bulb, the voltage I have here is 240V at 50 Hz
(P=VI, 50Watts = 240Voltx 0.25Amp)
Yes, around 121 -125, one thing that baffled me was the Vrms / 2 should have been right but made mine read 50% low???
BTW the clamp I have (20 years old) reads 15% different if flipped (reversing current direction) on both AC &DC, thats why I said POS.
I was just thinking, the ACS712 puts out an AC signal that swings + & - around a 2.5 volt offset and never goes negative but not so with the amp clamp, its signal can go negative and may damage the Arduino! The signal should be rectified and voltage limited before connecting to analog input.
Now that you mentioned it, the ACS712 gives a constant output value between 509 - 512 to A0 when no current is flowing thru. But I'm not sure what to expect from the amp clamp.
I'll try passing the amp signal through a simple 4 diode full-bridge rectifier to see if it gives a DC output.
Been playing with op-amps and came up with a working circuit that takes care of the offset and negative polarity problem, let me know if you're still interested, it will take me a while to draw it up and write a basic sketch, I'm a worse draftsman than typist.