ATTINY85 measuring internal voltage

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...