Skip to main content

Inkplate 6 MicroPython - Battery and temperature

Inkplate 6 includes built-in functions for measuring battery voltage and board temperature. This example shows how to read these values and display them on screen.

⚠️
You need a Li-ion battery for this example to work, to learn more, check out battery docs page.

Battery should be connected like this:

Inkplate 6 running the example code
Battery connected to Inkplate 6.

Reading battery voltage and temperature

from inkplate6 import Inkplate
import time

inkplate = Inkplate(Inkplate.INKPLATE_1BIT)
inkplate.begin()
inkplate.clearDisplay()
inkplate.display()

# Get battery voltage as a string
battery = str(inkplate.readBattery())
inkplate.setTextSize(2)
inkplate.printText(100,100, "Battery voltage: " + battery + "V")
inkplate.partialUpdate()

# Get temperature reading as a string
temperature = str(inkplate.readTemperature())
inkplate.printText(100,150, "Temperature: " + temperature + "C")
inkplate.partialUpdate()

inkplate.readBattery()

Measure the current battery voltage of the Inkplate board.

Returns type: float

Returns value: Battery voltage in volts.

inkplate.readTemperature()

Measure the temperature of the Inkplate board’s internal sensor.

Returns type: float

Returns value: Temperature in degrees Celsius.

Inkplate 6 running the example code
Displaying battery and temperature data on Inkplate display.