Skip to main content

Read Battery Voltage

When running your Inkplate 6 board on a Li-ion battery, it's helpful to know the battery's condition. Inkplate 6 lets you measure the battery voltage directly, giving you an estimate of remaining capacity and help you decide if it's time to recharge.

⚠️
Connecting and using the battery correctly is important! Please refer to the battery usage page for guidance before use.

Reading voltage example

#include "Inkplate.h"   //Include Inkplate library to the sketch
#include "battSymbol.h" //Include .h file that contains byte array for battery symbol.
Inkplate display(INKPLATE_1BIT); // Create an object on Inkplate library and also set library into 1-bit mode (BW)

void setup()
{
display.begin(); // Init Inkplate library (you should call this function ONLY ONCE)
display.clearDisplay(); // Clear frame buffer of display
display.display(); // Put clear image on display
display.setTextSize(2); // Scale text to be two times bigger then original (5x7 px)
display.setTextColor(BLACK, WHITE); // Set text color to black and background color to white
}

void loop()
{
float voltage = display.readBattery(); // Read battery voltage
display.clearDisplay(); // Clear everything in frame buffer of e-paper display
display.image.draw(battSymbol, 100, 100, 106, 45); // Draw battery symbol at position X=100 Y=100
display.setCursor(210, 120);
display.print(voltage, 2); // Print battery voltage
display.print('V');
display.display(); // Send everything to display (refresh the screen)
delay(10000); // Wait 10 seconds before new measurement
}

inkplate.readBattery()

Reads the current battery voltage when running on battery power

Returns type: float

Returns value: Returns the measured battery voltage

Inkplate6_Read_Battery_Voltage

GitHub link with all files