The third problem is happening because we set the reference voltage for the ADC as Vcc/1.6. The problem is that the other options for this register are worse. I’m still trying to find a software solution for this issue, but I believe the only way to fix it is by hardware.
Useful information In unsigned mode, the negative input is connected to half of the voltage reference (VREF) voltage minus a fixed offset. The nominal value for the offset is:
Since the ADC is differential, the input range is VREF to zero for the positive single-ended input. The offset enables the ADC to measure zero crossing in unsigned mode, and allows for calibration of any positive offset when the internal ground in the device is higher than the external ground.
This offset is not compensated for automatically, and the software needs to subtract the measured offset from the conversion results.
OFFSET: 10.3mV – measured using a voltage generator and a multimeter. This voltage makes the AnalogRead returns -4 when is grounded. It was measured after the modifications.
Vmax = 2.05V