Developer Trent “ripred” Wyatt has launched an Arduino library which supplies Microchip ATmega-family microcontrollers the power to measure the voltage coming in on their Vcc pin — with out requiring any further {hardware} in anyway.
“The CPUVolt library is used to measure the present voltage stage on the preferred ATmega sequence microcontrollers used on Arduino’s with out utilizing any exterior parts in anyway,” Wyatt writes of the library. “You learn that proper: you may learn the present voltage stage current on the Vcc pin of the processor without having any further components or connections.”
The library implements Microchip’s Software Be aware AN2447, which makes use of the microcontroller’s inside reference voltage (Vbg) because the enter to an analog to digital converter (ADC) with the Vcc pin because the reference. “This answer helps the customers organising functions with low energy consumption, low MCU [Microcontroller Unit] pin rely, and/or few BOM [Bill of Materials] components,” Microchip says. “Usually voltage/battery monitoring, this answer is kind of engaging.”
The CPUVolt library makes it simple to determine how a lot voltage your ATmega is getting — no further {hardware} required. (📷: Trent “ripred” Wyatt)
In its newest launch, Wyatt’s CPUVolt library gives the power to report an absolute voltage or, for battery-based initiatives, a proportion primarily based on user-configurable most and minimal voltage ranges. “That is actually helpful for battery-based initiatives,” Wyatt says. “Now you can specify the decrease voltage stage you want to use to point when the system wants charging and when it’s absolutely charged.”
This is not Wyatt’s first library designed to enhance the lives of Arduino programmers: again in June he launched the Easy library, which provided a technique to tame “noisy” inputs with out utilizing memory-hungry arrays. “You create the article and inform it what the working pattern window dimension is,” Wyatt defined on the time. “This object takes up eight bytes regardless of the window dimension. And there is not any looping over previous values. And no arrays.”
The CPUVolt library is now accessible on GitHub, underneath the permissive MIT license, and within the Arduino IDE Library Supervisor; extra data on its new proportion function is on the market in Wyatt’s Reddit publish.