Skip to main content

circuitpython-sevenseg

A lightweight CircuitPython library for controlling single digit 7 segment displays (common cathode or common anode).

Supports digits, uppercase & lowercase letters, and symbols works on Raspberry Pi Pico, Adafruit Feather, Seeed XIAO ESP32-S3, and any CircuitPython-supported board.

CircuitPython port of micropython-sevenseg


Installation

Copy the circuitpython_sevenseg/ folder to the lib/ directory on your CIRCUITPY drive:

CIRCUITPY/
└── lib/
    └── circuitpython_sevenseg/
        ├── __init__.py
        └── sevenseg.py

Pin Diagram

 ---a---
|       |
f       b
|       |
 ---g---
|       |
e       c
|       |
 ---d---   ● dp

Pin order: [a, b, c, d, e, f, g, dp]

Quick Start

import board
import time
from circuitpython_sevenseg import SevenSeg

seg = SevenSeg(
    pins=[board.GP2, board.GP3, board.GP4, board.GP5,
          board.GP6, board.GP7, board.GP8, board.GP9],
    common_anode=False
)

# Show a digit
seg.show(5)

# Show a letter
seg.show('A')

# Show with decimal point
seg.show(3, dp=True)

# Turn on decimal point only
seg.dot(True)

# Clear display
seg.clear()

# Release pins
seg.deinit()

API Reference

SevenSeg(pins, common_anode=False)

Initializes the display.

Parameter Type Description
pins list 8 pin objects in order [a, b, c, d, e, f, g, dp]
common_anode bool True for common anode, False for common cathode (default)

show(char, dp=False)

Displays a character on the 7-segment display.

Parameter Type Description
char int or str Digit 0–9 or supported character (see table below)
dp bool Also turn on decimal point (default False)

Raises ValueError if character is not supported.


clear()

Turns off all segments including the decimal point.


dot(on=True)

Toggles the decimal point without affecting other segments.

Parameter Type Description
on bool True = on, False = off (default True)

deinit()

Releases all GPIO pins. Call when done to free resources.


Supported Characters

Digits

0 1 2 3 4 5 6 7 8 9

Uppercase Letters

A B C D E F G H I J L N O P Q R S T U Y Z

K, M, V, W, X not supported — physically impossible on 7-segment display.

Lowercase Letters

a b c d e f g h i j l n o p q r s t u y

Symbols

- _ . ! ? ' " [ ] = + ^ (space)


Wiring Example — Raspberry Pi Pico / Pico 2W

Segment Pico Pin
a GP2
b GP3
c GP4
d GP5
e GP6
f GP7
g GP8
dp GP9

Examples

File Description
sevenseg_simpletest.py Basic 0–9 counter
sevenseg_all_chars.py All supported characters

License

MIT License © 2026 Kritish Mohapatra


Author

Kritish Mohapatra

Metadata

Release files for circuitpython-sevenseg 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for circuitpython-sevenseg 1.0.1
File Size Uploaded Provenance Actions
circuitpython_sevenseg-1.0.1.tar.gz 3.9 kB Without provenance Details for circuitpython_sevenseg-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for circuitpython-sevenseg 1.0.1
File Interpreter ABI Platform Actions
circuitpython_sevenseg-1.0.1-py3-none-any.whl Python 3 none any Details for circuitpython_sevenseg-1.0.1-py3-none-any.whl

Total release size: 8.3 kB

Release files / circuitpython_sevenseg-1.0.1.tar.gz

Download URL circuitpython_sevenseg-1.0.1.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
45c88c2645379ab63e03826d74b152dda905fbce4ecaceb4b35ad9b0b77d4430
BLAKE2b-256 checksum
How to use checksums
b50a0936f798a7a0d786bbaa0afddce6ef9a3a60c1522937f3a539b1e9321a24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / circuitpython_sevenseg-1.0.1-py3-none-any.whl

Download URL circuitpython_sevenseg-1.0.1-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36011dfa679f1ec77fab52c86e8bf7d91738a0b51a37966f33924ca88a640ec2
BLAKE2b-256 checksum
How to use checksums
60f7e5cff4bd2c3f9550e32e501691a3696fff08a7bd4cf85f5ff4302b0b3072
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Security for circuitpython-sevenseg 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page