Arduino voltmeter – not always visible feature

Arduino and so most of AVR microcontrollers have internal ADC peripheral that allows sampling analog voltages in to digital. In most cases when taking simple measurements it is always relied to supplied VCC voltage. But VCC doesn’t mean to be always 5V or 3.3V. Say if you power supply voltage drops to 4.5V and your calculations still relies on 5V reference your results become garbage. Think of analog temperature sensor – what errors this situations may produce. So obviously smart move there is to keep an eye on reference voltage during program flow. In order to measure one reference voltage we need another reference that is more reliable. Scott Daniels wrote a small tutorial on measuring VCC voltage using AVR microcontroller’s internal reference voltage which in modern AVR is 1.1V.

In order to evaluate exact VCC value first step is to measure internal reference voltage (known 1.1V) with VCC reference. Using this measured value it is easy to calculate real VCC value which can be used to calculate sensor values or what ever you are doing. Last thing Scott warns us is that internal reference voltage isn’t accurate as well. It may wary as much as 10% so if your project needs maximum precision go for external reference voltage or calibrate each AVR individually.

No Comments

Leave a reply