Well I am currently working on building a battery gauge via LED. My target is a red LED to blink if batteries are going to die and a green LED to blink if the batteries are fine.
Researching on that topic different questions already have been considered and mostly referred to a link such as http://batteryuniversity.com/learn/article/how_to_measure_state_of_charge. Knowing the limitations I was planning to make use of the Voltage Method. The batteries I was planning to use were NiMh enveloop pro batteries (AA). Considering the tests on the battery (I couldn’t find the datasheet) the http://www.stefanv.com/electronics/sanyo_eneloop.html I found out that the battery mostly crosses below 1,1V before dying. Therefore I was planning to use 1.1V per Battery as a threshold or indication that the battery will die. To apply the voltage method beneficially, using the internal 1.1V reference voltage of the Adafruit Trinket Pro (according to the datasheet of atmega 328p, which can be found in the Trinket) has to be measured against the input voltage(as described :http://wp.josh.com/2014/11/06/battery-fuel-guage-with-zero-parts-and-zero-pins-on-avr/).
However my issue is that I make use of an Adafruit Trinket Pro 3V and a Servo having one source of battery (4XAA NiMh). 4.8V are provided to the Servo. A buck converter is attached between the battery and the Trinket in order to provide it with its required 3.3V.
Generally using the Voltage method for a battery gauge the ADC Pin is compared to Vcc Pin as described above. However in my case the microcontroller will always receive 3.3V. Any voltage drop of the battery will only affect the servo since the buck converter will make sure to provide the microcontroller with sufficient voltage. Therefore using the voltage method I do not know how I may identify any voltage drop on the 4.8V battery source because the voltage drop will have no effect on the Adafruit Trinket.
Given these circumstances is there a way to make a battery gauge making use of the voltage method or any other beneficial way? I am aware that the difference in VBAT and VCC might complicate the issue..
Information Adafruit trinket: https://learn.adafruit.com/introducing-pro-trinket/overview Datasheet atmega 328p: http://www.adafruit.com/datasheets/ATMEGA328P.pdf