This MicroPython and CircuitPython library provides a hardware driver for a variety of displays based on the Holtek KT16K33 controller chip, including four-digit, seven-segment LEDs; four-digit, 14-segment LEDs; 8x8 and 16x8 monochrome matrix LEDs; and bi-colour 8x8 matrix LEDs. It also supports four-digit, 14-segment LEDs based on the VK16K33 controller from Freenove.
It now includes a ‘generic’ driver for HT16K33s connected directly to 1-8 digits, in any combination of single- and multiple-digit units. The limit is set by the available HT16K33 pins (the eight
Import the Drivers
The driver package comprises a parent generic HT16K33 class and child classes for the various displays themselves. All your code needs to do is import the latter. For example:
from ht16k33segment import HT16K33Segment
You can then instantiate the driver object. This requires a configured I²C bus object as generated by your chosen version of Python.
Some methods are provided by the parent module, others by the display module. All available methods are documented under a given display module’s documentation.
You will need to add both the child display driver module and the parent
ht16k33.py file to your device.
Install the Drivers
MicroPython MIP Install
From version 3.5.2, you can install the drivers using MicroPython’s MIP module. This requires a board running MicroPython 1.2.0 or above and connected to the Internet. Add the following to your code:
If your board is not Internet-capable, you can install locally using the mpremote tool:
mpremote mip install github:smittytone/HT16K33-Python
Drag and drop
ht16k33.py and your required device-specific driver
.py file(s) to the mounted board’s
You can find the source code on GitHub.