#160
Ralph S Bacon Ralph S Bacon
53.9K subscribers
16,701 views
735

 Published On Aug 30, 2019

Know when your batteries are going flat in your Arduino ATMega328P projects

$8 off your first order at LCSC Electronics with https://lcsc.com?href=ralphsbacon&source=referral

Get a timely warning before your batteries go flat!

All this plus more in my GitHub:
https://github.com/RalphBacon/Arduino...

List of all my videos
(Special thanks to Michael Kurt Vogel for compiling this)
http://bit.ly/VideoList-RalphBacon

Battery-powered, Deep Sleep Arduino (ATMega328P) projects are great but how do you know when the batteries are nearly depleted?

In the last video #159 we explored a simple, battery-powered project using an ATMega328P, as found in every Arduino UNO and Nano. Many times I was asked how I could detect the battery voltage and warn the user that it was time to replace the batteries.

In this video I show how we can do that with no extra components, all by the magic of the bandgap voltage set on the AREF pin, either internally or externally.

ATMEL decided not to precalibrate the AREF voltage (cheapskates!) so each chip has to calibrated first using a one line sketch. Easy stuff. And whilst reading the voltage might look a bit esoteric, you don't have to understand all the code - just use it as a function in your sketch or include a small library.

LINKS LINKS LINKS

500pcs 10 Values 0.1uF~10uF 50V Ceramic Capacitor Assortment Kit *Includes 10 Values $8.35
http://s.click.aliexpress.com/e/3N1yt07m

100Pcs 10Value 16V Tantalum Capacitor Assorted
https://www.banggood.com/100Pcs-10Val...

ATMega328P Data Sheet
https://www.sparkfun.com/datasheets/C...

What's a Bandgap Voltage Reference?
https://en.wikipedia.org/wiki/Bandgap...

Nick Gammon's page on ADC
http://www.gammon.com.au/adc

Arduino Forum on the same subject
https://forum.arduino.cc/index.php?to...

Arduino's page on Reference Voltage (AREF)
https://www.arduino.cc/reference/en/l...

All this plus more in my GitHub:
https://github.com/RalphBacon/Arduino...

If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so and joining me on my Arduinite journey

List of all my videos
(Special thanks to Michael Kurt Vogel for compiling this)
http://bit.ly/VideoList-RalphBacon

My channel and blog are here:
------------------------------------------------------------------
   / ralphbacon  
https://ralphbacon.blog
------------------------------------------------------------------

show more

Share/Embed