So I'm using ZMPT101B to measure voltage and interfaced it with Arduino Uno (my AC source doesn't have neutral, multi tester shows 116v in one line and 113v on the other line).
When trying to calibrate using the calibrate.ino file, it was not able to identify the sensitivity.
So what I did, I went directly to the example usage, adjusted the sensitivity until it matched with my expected voltage and that seem to have worked for me, until I switched to a battery.
It appears that when in batteries (7.4v Li-ion) the voltage I get is around 10V lesser than what I get when Arduino is powered by laptop's USB.
Is this an expected behavior? And yes, I did the potentiometer calibration and ensured that I get to an acceptable sine wave (not a perfect one but acceptable).
Your Uno uses the 5V supply as its reference voltage when using the ADC to measure voltages.
When the Uno is powered by batteries, the 5V regulator on the PCB provides the supply used by the AREF reference voltage pin. This 5V is likely to be fairly close to 5.0V.
When the Uno is connected to a PC, it is the USB ports 5V supply that is used.
The USB specifications for this voltage say that it should be anywhere between 4.75V and 5.25V, so it is likely to be less accurate than the 5V from the regulator.
Try measuring what the voltage of the 5V supply actually is.
You will find that when connected to a PC that it will even be different depending on which USB port you connect your Uno to.
You are probably better off doing the calibration when powered by battery, as the 5V regulator is likely to be closer to 5.0V than the USB 5V supply.
You can get round this variation by using a different analogReference( ).
One solution would be to use analogReference(EXTERNAL), and connect the 3.3V supply to the AREF pin.
This 3.3 V comes from a regulator that should give out the same voltage whether the Uno is supplied by batteries or USB.
Thank you! That makes sense now.
If I don't resort to the 3.3v reference, I will have to keep plugging in the Arduino -> Upload Code -> then Calibrate with batteries over and over again, correct?
You might just be better off calibrating using whichever supply you are most likely to use, and realise that there will be a difference if you change the supply used.
I wouldn't bother doing the calibration 'over and over again'.
If you use the 3.3V reference you will need to change the offset and amplitude of the signal from the ZMPT101 module otherwise you will lose resolution.
How did you do the calibration on battery and did you use 3.3V on AREF pin, if yes did you change the offset to 1.65V and also change the Op amp gains?