I've been used the ACS712-20A to measure the current flow. Actually I used LIFA program (LabVIEW interface for Arduino).
I used this equation:
current = ((analog read)-2.5 )/ 0.1
But I am still not sure with the result.
According to the datasheet you have 100mV per ampere, and a zero offset voltage of Vcc × 0.5.
So assuming you are correctly converting the ADC reading into a floating point voltage the instantaneous current can be calculated with the formula
i = (Vadc - 2.5) × 10
Or for milliamps,
i = (Vadc - 2.5) × 10000
If you are measuring a DC current that is then all well and good. However, if you are measuring an AC current things get considerably more complex.
To work out an AC current you need to have the peak-to-peak voltage, not the instantaneous voltage. To get that you need to sample the ADC over a number of cycles and find both the maximum and minimum values. You can then subtract the minimum from the maximum to give you the peak-to-peak voltage. That can then give you the peak-to-peak current.
From that you can then calculate the RMS current.