I have just completed the first rev of my project using ATMEGA32U4 along with a battery charger.
The circuit work fairly well but I am having the following issue.
I have a SPST throw switch that feeds the output of the battery (3.7V) to a charge pump that pumps the voltage to 5V. The SPST is either ON or OFF. I have a power rail called Vbat(3.7V) that I am hooking up to ADC0 through a 2K resistor. I am measuring 10mv from ADC0 to ground, so I know the ATMEGA32U4 is drawing power from the ADC0 input. When I increase the resistance I can get the draw down to .5mv but … the accuracy of the voltage measurement fluctuates by 30%. When I lower the resistance feeding ADC0 the measurement is with 1mv of an external meter.
I need to be able to measure Vbat for a low battery indicator but I also do not want any current draw when the switch is in the off position.
Attached is a schematic diagram, the only connection the ATMEGA32U4 has in the “OFF” position is the Vbat rail to ADC0(pin 41)