I have AO of the UNO board tied to the analog output pin of the ACS712 current sensor.
A .1 uF cap is tied between the 5v UNO pin feeding the VCC current sensor input and GND as called for.
With no current input to the sensor the reading is rock solid at just a few hundreds above the 2500 mV baseline.
With a steady 2 amp current flowing through the sensor I get these consecutive values
on the serial monitor:
Amps..........mV ..............Raw
.422
-0.950
1.927...... 2856 ............ 585
-1.188
.581
-.055 ...... 2510 ............ 514
-0.44
1.18
-1.82 ...... 2163 ........... 438
1.53
With an open input: 6.6 amps/ 3730 mV/ 765 Raw
I have changed capacitance values to .2 uF and .5 uF with no effect.
The baseline is perfect but the values are wildly fluctuating above and below
the 2500 mV baseline with current flowing. The 2 amp current flow is roughly mid-scale
for the 0-5 volt version of the ACS712. Not sure if it matters but the current load test device
is a 110 volt hand grinder with a universal/commutator series-wound motor.
I verified the amp draw with an AMPROBE current meter.
So with nearly 700 millivolts of span the current sensor seems to be operational.
Except for the fact it is going below the baseline while sensing the current and not staying
in the upper range without fluctuating.
// Measuring Current Using ACS712
const int analog_In = A0;
int mV_per_Amp = 185; // use 100 for 20A Module and 66 for 30A Module
int Raw_Value = 0;
int ACS_offset = 2500; // : it has an output of 2.5V w/ no input because it can measure the current in both directions.
double Voltage = 0;
double Amps = 0;
boolean blr_on_state = false;
void setup(){
Serial.begin(115200);
}
void loop()
{
Raw_Value = analogRead(analog_In);
Voltage = (Raw_Value / 1024.0) * 5000; // Gets you mV
Amps = ((Voltage - ACS_offset) / mV_per_Amp);
Serial.print("Raw Value = " ); // shows pre-scaled value
Serial.print(Raw_Value);
Serial.print("\t mV = "); // shows the voltage measured
Serial.print(Voltage,3); // the '3' after voltage allows you to display 3 digits after decimal point
Serial.print("\t Amps = "); // shows the voltage measured
Serial.println(Amps,3); // the '3' after voltage allows you to display 3 digits after decimal point
delay(2500);
}