I am trying to figure out if I can measure the Vcc of attiny13a, but the code I use for arduino's and attiny85 does not work. This is where I got the code from. I know that it works by using the 1.1v reference and the ADC, and in the attiny13a datasheet it says that it has these, but I can't get it to work.

1 Answer 1


The code you linked to measures the 1.1 V internal reference using Vcc as a reference. The ATtiny13A cannot do that. It does have a 1.1 V internal reference, but it can only use it as a reference for the ADC, not as a measured channel.

What you can do, if you don't mind adding extra hardware, is divide Vcc with some resistors in order to get a voltage proportional to Vcc but lower than 1.1 V. Then use the 1.1 V reference to measure that voltage. In other words, measure a scaled-down Vcc against the 1.1 V reference instead of measuring the 1.1 V reference against Vcc. The datasheet should help you with the details.

  • I tried this and it worked! I don't understand to much about the bit settings on the datasheet but with the help of a tutorial I got it to work Thankyou Oct 16, 2020 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.