Battery Voltage Reading Using the TinyScreen+

by TinyCircuits Staff June 15, 2018

Battery Voltage Reading Using the TinyScreen+

This tutorial will show you how to read out the voltage of your battery. With this knowledge, you can (very approximately) keep track of how much life a battery has.


Materials 

Hardware: 

Software:

  • Arduino IDE
  • TinyScreen library (You can download this from the Arduino Library Manager)

Extras: 


Background:

While it is probably not possible to get an exact reading of the percentage of a battery, you can get a pretty good approximation using the voltage reading of the battery and the time the program has been running. 

So why can't we get an exact reading and how do we estimate the imminent death of a battery?

Let's look at this plot: 

A graph of a battery's rate of discharge at different capacities(C)

This diagram doesn't exactly match up with our batteries, but it serves as a good discussion piece for lipo batteries. You can see that the voltage of a battery over time will pretty much stay the same for most of its life with a gradual decrease, but once enough current has been drawn over enough time, the voltage will drop as the battery is dying. 

So while this tutorial reads out the voltage of a battery, the voltage will pretty much stay the same for the life of the battery. If you want to estimate how long a program you're running will last on the battery you have, pay attention to the mAh value on the battery. This can serve as a rough estimate for how much time a program can be sufficiently powered if you know the amount of current your program is drawing. 

It is also important to note that batteries will have a longer lifetime if only 90-95% of their charge is used at a time rather than continuously draining a battery down until it completely dies. 

To get an estimate of the right voltage to be referenced as the "battery is about to die" voltage, you will have to do some testing and use your own discretion based on the current draw of your project.


Step 1: Assembly 

All you have to do is insert the battery into the TinyScreen+ and use a MicroUSB cable to connect the TinyScreen+ to your computer, it's that easy.

 Now that's an amazing assembly process


Step 2: Software (Setup)

All you need is the Arduino IDE and the TinyScreen library!


Step 3: The Code!

The Arduino Web Editor doesn't support the TinyScreen+ (yet!) so you'll have to upload the program in your Arduino IDE 

This code does not directly print out the state of charge (%) of the battery because that is a little difficult to establish. You can use this program to do some testing and find out what works for you and your projects that need careful power monitoring. 

This is what your program results should look like on the TinyScreen+:

Your screen is probably prettier than mine

**Note: The voltage will be accurate to within about 0.1V, but you can calibrate this difference by measuring the voltage at full charge and accounting for that discrepancy**


    Contact Us

    As always, if you have any questions or feedback, feel free to email us at info@tinycircuits.com.

    Show us what you make by tagging @TinyCircuits on instagram, twitter, or facebook so we can feature it!

    Thanks for making with us!



    TinyCircuits Staff
    TinyCircuits Staff

    Author



    Also in Learn

    TinyZero Accelerometer BMA250 Internet of Things Project with Cayenne
    TinyZero Accelerometer BMA250 Internet of Things Project with Cayenne

    by Laverena Wienclaw November 21, 2018

    In this tutorial, we will use Cayenne to capture some accelerometer readings on their nice Internet of Things dashboard

    View full article →

    TinyZero Setup Tutorial
    TinyZero Setup Tutorial

    by Laverena Wienclaw November 21, 2018

    Ready to get started with your new TinyCircuits product? This tutorial will cover basic setup of the TinyZero.

    View full article →

    Using the TinyZero Accelerometer
    Using the TinyZero Accelerometer

    by Laverena Wienclaw November 21, 2018

    This tutorial will guide you through reading values from the Accelerometer that can be populated on the TinyZero

    View full article →