Skip to main content

MicroPython and CircuitPython library for HT16K33 LED matrices and segment displays.

Project description

HT16K33 Drivers 3.5.3

This repo provides Python drivers for the Holtek HT16K33 controller chip and various display devices based upon it, such as the Adafruit 0.8-inch 8x16 LED Matrix FeatherWing and the Raspberry Pi Pico.

The library also supports generic seven-segment displays wired up to an HT16K33, which can drive up to eight these LEDs. The HT16K33 may be on a board of your own design, or on a third-part one, such as the Adafruit 16x8 LED Matrix Driver Backpack . LED units you can connect range from single digits up to combinations of multi-digit units.

Connect your HT16K33 column pins to each LED's digit selection pin, and its row pins to the LED's segment selection pins.

The drivers support both CircuitPython and MicroPython applications. They communicate using I²C.

Display Drivers

Driver
(Click for docs)
Example Product
Small 4-digit, 7-segment LED  Adafruit 0.56-inch 4-digit, 7-segment LED display
Large 4-digit, 7-segment LED  Adafruit 1.2-inch 4-digit, 7-segment LED display
Small 4-digit, 14-segment LED SparkFun Qwiic Alphanumeric Display,
Adafruit 0.54in Alphanumeric Display
8x8 monochrome matrix LED  Adafruit Mini 0.8-inch 8x8 LED Matrix
8x8 bi-colour matrix LED Adafruit 1.2-inch 8x8 bi-color LED matrix backpack
16x8 FeatherWing matrix LED Adafruit 0.8-inch 8x16 LED Matrix FeatherWing
Standalone HT16K33 Adafruit 16x8 LED Matrix Driver Backpack

Further drivers may be added in due course.

Import the Drivers

The driver package comprises a parent generic HT16K33 class and child classes for 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 I2C bus object.

You will need both the display driver file and ht16k33.py in your project folder.

Install the Drivers

MicroPython Manual

Use the pyboard or mpremote command line tools to copy the ht16k33.py and your required device-specific driver to your board.

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.20 or above and connected to the Internet. Add the following to your code:

import mip
mip.install('github:smittytone/HT16K33-Python')

If your board is not Internet-capable, you can install locally using the mpremote tool:

mpremote mip install github:smittytone/HT16K33-Python

CircuitPython Install

Copy ht16k33.py and your required driver .py file(s) to the mounted board's lib folder.

Reducing Memory Usage

Adding the driver code may prove too much for certain CircuitPython devices which have limited amounts of memory. To overcome this, use MicroPython’s mpy-cross compiler. This will compile the raw Python into a highly compact form as a .mpy file. Copy ht16k33.mpy and the device-specific .mpy file to your device in place of the .py versions.

Example

./mpy-cross ht16k33.py ht16k33matrixcolour.py

Documentation

You can find documentation for all of the drivers at smittytone.net.

Python Package Index

This code is now available via the Python Package Index for folks using Thonny and other code-pulling IDEs.

Release Notes

  • 3.5.3 15 January 2024
    • Remove the .mpy versions and provide instructions instead.
    • Fix incorrect selection of blink rate 0.5Hz — thanks, @Karrp.
  • 3.5.2 11 December 2023
    • Add mip support — thanks, @ubidefeo (no code changes).
  • 3.5.1 30 October 2023
    • Add provisional PyPI support (no code changes).
  • 3.5.0 2 September 2023
    • Add HT16K33SegmentGen a generic, 1-8 digit 7-segment driver — thanks, @vader7071.
  • 3.4.2 14 February 2023
    • Fix an error when a space is shown as a zero — thanks, @asasine.
  • 3.4.1 14 November 2022
    • Correct VK16K33 naming.
    • Fix VK16K33 colon setting and unsetting — thanks, Dietmar Schüller.
  • 3.4.0 6 October 2022
  • 3.3.1 13 September 2022
    • 14-segment character-set numerals now match 7-segment equivalents.
    • Assorted code tweaks.
    • Wrangle and extend examples.
    • Remove old docs.
    • Big thanks to @akbiocca for assistance with this release.
  • 3.3.0 5 August 2022
    • Add rotate() method to HT16K33Segment.
  • 3.2.0 26 July 2022
  • 3.1.0 16 February 2022
  • 3.0.2 23 November 2020
    • Refactor out some ht16k33matrix.py code.
  • 3.0.1 7 November 2020
    • Correct variable name in ht16k33matrix.py.
  • 3.0.0 6 November 2020
    • Initial public release.

Licence and Copyright

This repository’s source code and documentation is copyright © 2024, Tony Smith (@smittytone).

The HTK16K33 driver and subsidiary display drivers are licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ht16k33-python-3.5.3.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

ht16k33_python-3.5.3-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file ht16k33-python-3.5.3.tar.gz.

File metadata

  • Download URL: ht16k33-python-3.5.3.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for ht16k33-python-3.5.3.tar.gz
Algorithm Hash digest
SHA256 49e7debd73a2f21545f4e38cfcf80ceef1c6d7bf7c13bb81d28c14f7b9338bb3
MD5 4a36306d2a7c7b70b9f2a2a9c9d9b902
BLAKE2b-256 c802e82bb92684c51e481fe44ba67d2487b17f4738e0eac45aebe23341732578

See more details on using hashes here.

File details

Details for the file ht16k33_python-3.5.3-py3-none-any.whl.

File metadata

File hashes

Hashes for ht16k33_python-3.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c71114a6bff8f2e6cd3cad91394885dca446bed0e8207169809862a9ed049498
MD5 831b0236b385d7de5aa08f2b9d3801aa
BLAKE2b-256 43ac88a3287d337c329dd9862cfdbeab0a4e96f89fcb83e368978e4f5657eee5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page