I am trying to use this way to measure my battery voltage at least approximately, but I am getting weird results.

I am running breadboard atmega328p with internal 8 MHz and powering it from a LiPo battery that is above 4V when fully charged. The battery is connected straight to GND and VCC pins.

Yet the readVcc function returns values around 3100 mV. The wADC returns values around 367.

Dou you have an idea what might be the problem please?

closed as unclear what you're asking by MatsK, sempaiscuba, VE7JRO, Juraj, MichaelT Mar 8 at 17:36

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    A schematic and a clarification of what you have already done to investigate the problem is highly recommended. – Roberto Lo Giacco Feb 26 at 10:33
  • 2
    It is very well possible to measure the battery, but you have to give us more information. As @RobertoLoGiacco wrote, please show us a schematic (some connect aref to vcc, that is not good). Show us a photo (so we can see if you have decoupling capacitors). The code can be improved, I throw away the first sample and I use the average of a few samples. You have to set the actual value of aref in the sketch. It is not 1.1v but somewhere between 1.0 and 1.2v. Do you have an arduino uno for testing? Can you show us a working sketch that we can try to improve? – Jot Feb 26 at 17:29