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
TinySnore Turns Your ATtiny Into a Low-Power Prodigy - Embedded Com...
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...
Jump to solution
5 Replies
Camila_99$$
Camila_99$$2mo ago
attachment 0
Afuevu
Afuevu2mo ago
Hello, using a multimeter, measure the voltage of the battery. Lets start from there
Solution
JeremyCook
JeremyCook2mo ago
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
TinySnore Turns Your ATtiny Into a Low-Power Prodigy - Embedded Com...
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...
Camila_99$$
Camila_99$$2mo ago
Hi @Afuevu I'll grab a multimeter and check the battery voltage now. I'll update you shortly.
Camila_99$$
Camila_99$$2mo ago
Thanks @JeremyCook for the recommendation! I'll give it a try. Appreciate the link! 🙏🏻
Want results from more Discord servers?
Add your server