Why Does My ATTiny85 Analog Input Return a Constant Value After 24 Hours?

Hi,

I’m trying to get the value of my battery using an analog input of my ATTiny85 to create a gauge. To do this, I made a voltage divider to avoid draining too much battery. The problem is that I don’t understand why, after letting my project (which includes sensors and a screen) run for more than 24 hours, I’m still getting an input value of 512 with an analogRead().

I haven’t applied any calculations yet, just retrieving the value from my voltage divider. But this value doesn’t budge at all... I’m using a 3.7V 400mAh LiPo battery.

Here’s my schematic.
Solution
Related to that, I would highly recommend using the TinySnore library if you're concerned about optimizing power usage. I used it in another project that uses a CR2016 battery and it's able to run for ~a few weeks using intermittent monitoring of inputs: https://embeddedcomputing.com/technology/processing/chips-and-socs/tinysnore-turns-your-attiny-into-a-low-power-prodigy (granted, my device is just sitting there most of the time)
Embedded Computing Design
The ATtiny 25/45/85 series is a fantastic little chip, with a low price, flexible voltage input options, and a limited number of IO pins that can be a fun optimization challenge*. It uses a minimal amount of power when compared to something like an Arduino Uno, or certainly a Raspberry Pi, but running an ATtiny constantly will still drain a CR20...
Was this page helpful?