I'm using an ATTINY85 for a portable application that uses a Lithium-ion battery; therefor I need to monitor the battery voltage so I don't kill the battery. Is there a way to go about this without using another pin? or using the reset pin? **NOTE: assume that there will be no regulated voltage such as 3.3V or the like. (this is because the circuit only uses one battery and should never go above spec; and saves on cost)
Setting REFS[2:0] to
0bX00 will use VCC as the voltage reference, and setting MUX[3:0] to
0b1100 will use the internal bandgap voltage as the voltage to measure (see §17.13 from the datasheet). From there, the full range of 1023 will tell you what VCC is in relation to the bandgap voltage. So take (1.1*10*1023=) 11253 (or an appropriately scaled equivalent) and divide it by the measured value in order to get the approximate value of VCC in tenths of volts.
Yes you can. I made a library https://github.com/cano64/ArduinoSystemStatus it also works with ATTiny85. In addition to measuring a voltage on VCC pin, with this library you can measure voltage on any analog pin (without need for regulated VCC), get free RAM, go to sleep and wake up after button press and more...