Skip to main content

epaper-colorcal

Measure the real colours of an e-paper panel with a CHNSpec CR30 colorimeter and turn them into a palette file for epaper-dithering, or into plain colour values for any other project.

License Ruff mypy

Seat the CR30 on the panel once; the tool shows each ink, reads its spectral reflectance, and prints an epaper-palette file. It works with any panel: an OpenDisplay board is driven over Bluetooth automatically, anything else through a command you give or by hand.

uvx --python 3.13 --from 'epaper-colorcal[ble,opendisplay]' epaper-colorcal \
  --id spectra6_7in3 --address OD216205 --cr30-ble > spectra6_7in3.json

With an OpenDisplay board and the CR30 both on Bluetooth, that's the whole measurement: no cable, no buttons; the board reports its inks and temperature.

Why

Dithering needs to know what the panel's inks really look like. OpenDisplay's earlier palettes came from phone photos of the panel, and they vary a lot with the camera, the lighting and the RAW processing. The CR30 (about €55) is a pocket spectrocolorimeter: it lights the sample itself at 45° and reads the reflected spectrum in 31 bands from 400 to 700 nm. Room light doesn't matter, and the result is the panel's physical reflectance, from which any colour space can be computed.

How good is it? On our unit the colour we compute from its spectrum matches the CR30's own display to ΔE 0.05, and repeated reads of a panel agree to about ΔE 0.1.

What you need

  • A CHNSpec CR30, connected over USB or Bluetooth.
  • A way to fill the panel with one colour: an OpenDisplay board (automatic), any command that does it (--show-command), or you, by hand.
  • Python 3.11+ (3.13+ to drive OpenDisplay boards, which needs py-opendisplay).

Supported hardware

Instruments

Instrument Connection Status
CHNSpec CR30 USB (--port), Bluetooth (--cr30-ble) verified (software V11.3.0.0.20231219); its colour matches the device's own display to ΔE 0.05

Showing the inks

Display Option Status
OpenDisplay boards --address verified on a Spectra 6 7.3" (BWGBRY, firmware 2.27); other schemes use the same path but are untested
OpenEPaperLink tags --oepl-ap, --oepl-tag through the access point, with py-oepl; verified on an M2 2.6" (BWR)
Anything you can script --show-command works with any panel; the command is yours
By hand (default) works with any panel

Platforms: tested on macOS. Linux and Windows should work (USB serial and Bluetooth go through pyserial and bleak) but are untested.

Missing your instrument or panel? Adding one is a single class: see docs/adapters.md. Reports from other hardware and platforms are welcome too.

Install

Nothing to install with uv: uvx runs the tool from PyPI in a throwaway environment. Name the extras you need (below):

# Automatic mode, everything over Bluetooth (py-opendisplay needs Python 3.13+)
uvx --python 3.13 --from 'epaper-colorcal[ble,opendisplay]' epaper-colorcal --help

# Manual mode, CR30 on USB
uvx --from 'epaper-colorcal[serial]' epaper-colorcal --help

To install it instead: uv tool install --python 3.13 'epaper-colorcal[ble,opendisplay]' (or pip install), then run epaper-colorcal. For development, clone the repo and uv sync --all-extras.

The extras:

Extra Adds Needed for
serial pyserial-asyncio the CR30 over USB (--port)
ble bleak the CR30 over Bluetooth (--cr30-ble)
opendisplay py-opendisplay driving an OpenDisplay board (--address)
oepl py-oepl driving an OpenEPaperLink tag (--oepl-ap)

--dry-run and the tests need none of them.

The commands below use uv run epaper-colorcal (from a clone); with uvx or an installed tool, put uvx --from '…' epaper-colorcal or epaper-colorcal in its place.

Connecting the CR30

Bluetooth: switch the CR30 on and pass --cr30-ble. It finds the CR30 by scanning, or give its name (shown on its screen and advertised, e.g. --cr30-ble CM454M1246).

USB: plug it in and pass its serial port with --port. The CR30 uses a CH34x USB-serial chip:

OS Port
macOS /dev/tty.wchusbserial* (or /dev/tty.usbserial-*)
Linux /dev/ttyUSB0
Windows COM3 (check Device Manager)

Calibration is automatic: the CR30 calibrates against the white reference inside its cap. --calibrate runs an explicit black and white calibration first (USB only); keep the cap closed for both steps.

Measuring a panel

Record the panel's temperature. E-paper colours shift with temperature, so a palette is only valid near the temperature it was measured at. Pass it with --temp. With an OpenDisplay board, the tool otherwise uses the temperature the board advertises (its chip sensor, read before connecting, which is close to room temperature on an idle board).

Seat the CR30 flat on the panel, away from the edges. The tool shows each ink, takes --count reads (default 3) and averages them. Unless the display reports when its refresh has finished (OpenDisplay boards do), the tool first reads until the colour holds steady (four reads a second apart within ΔE 1), so a panel that is still refreshing is never measured. How each ink gets onto the panel is up to you:

With an OpenDisplay board (automatic)

uv run epaper-colorcal --id spectra6_7in3 --note "Spectra 6 7.3in" \
  --address OD216205 --cr30-ble \
  --out spectra/spectra6_7in3.json > spectra6_7in3.json

The board reports its inks, so --scheme isn't needed (pass it and the tool checks it matches). For each ink the tool fills the screen, waits for the refresh to finish, and reads. A six-colour Spectra panel takes about 9 minutes, mostly panel refreshes; the CR30 stays put, so every ink is measured at the same spot.

  • --address is the board's name (e.g. OD216205), MAC or macOS UUID; --key <hex> if it's encrypted.
  • Each ink is sent as its nominal colour (#ff0000 for red, …), which epaper-dithering always maps to that ink, so the measurement never depends on the palette the board already uses. The tool checks the screen really is one ink before uploading.
uv run epaper-colorcal --id m3_3in0_bwry --oepl-ap 192.168.1.100 --oepl-tag 00007EA674219491 \
  --cr30-ble --format oepl > perceptual.json

The tag reports its colours (in its own order) and temperature. Each ink is uploaded as a solid, undithered image, which the tag picks up at its next check-in (--oepl-timeout, default 300 s per colour); the tool then reads until the colour is stable, since the tag refreshes after it has received the image. A three-colour tag took about 3 minutes.

The refresh waveform changes the colours, red most of all, so the tag is measured with the full refresh (--oepl-lut full, the default). Its own refresh setting and content mode are restored afterwards; the panel keeps showing the last ink until it gets its next image.

--format oepl prints a perceptual block for the tag's type, see Output.

With a command (any panel you can script)

--show-command runs a command for each ink, which should fill the panel with it and return once it's shown. Its fields are {name}, {hex} (e.g. ff0000), {r} {g} {b} and {index}:

uv run epaper-colorcal --scheme SEVEN_COLOR --id photoframe --temp 21 --port /dev/ttyUSB0 \
  --show-command 'curl -fsS "http://photoframe.local/fill?color={hex}"' --settle 30 > photoframe.json

Use --settle for the panel's refresh time if the command returns before the panel has finished.

By hand

Without any of that, show each ink yourself: fill the screen with the ink's nominal colour, undithered. The tool asks for each ink in turn; show it, seat the CR30, press Enter.

uv run epaper-colorcal --scheme BWRY --id my_panel --temp 21 --port /dev/ttyUSB0 > my_panel.json

Which inks

--scheme a preset: MONO, BWR, BWY, BWRY, BWGBRY, SEVEN_COLOR (7-colour ACeP), GRAY4, GRAY16
--inks any list, in the panel's index order: --inks black,white,red,orange=#ff8000 (black, white, red, yellow, blue, green and orange need no colour)
neither the display's own (OpenDisplay boards report theirs)

The ink called white is the paper white the palette is normalised to; without one, the lightest measured ink is.

Try it without hardware

uvx epaper-colorcal --scheme BWGBRY --id TEST --temp 23 --dry-run
uvx epaper-colorcal --inks black,white,orange=#ff8000 --id TEST --temp 23 --dry-run

Output

--format chooses what's printed on stdout (prompts and notes go to stderr):

Format For
epaper-palette (default) epaper-dithering 7 and py-opendisplay
oepl an OpenEPaperLink tag type: a perceptual block (below)
spectra the raw spectra of every read and each ink's colour

epaper-palette

{
  "format": "epaper-palette",
  "version": 1,
  "measured": true,
  "source": "Spectra 6 7.3in; CHNSpec CR30 s/n CM454M1246, measured 2026-11-19, D65/2°, panel at 18.5°C",
  "entries": [
    { "appearance": [25.1, 15.2, -13.4], "name": "black", "nominal": "#000000" },
    { "appearance": [100.0, 0.0, 0.0], "name": "white", "nominal": "#ffffff" },
    ...
  ]
}

Each appearance is CIE Lab under D65/2°, normalised so the panel's white is L* 100 (that's what epaper-dithering expects; the tool uses its own Palette.from_absolute_lab to do it). Inks outside sRGB keep their measured colour.

Use it with:

  • py-opendisplay: copy the file into src/opendisplay/palettes/ and add the panel to MEASURED_PALETTE_FILES in display_palettes.py.
  • epaper-dithering directly: Palette.load("spectra6_7in3.json").
  • To share a measurement, add it to epaper-dithering's examples/palettes/.

oepl

{
  "perceptual": {
    "white": [255, 255, 255],
    "black": [59, 57, 61],
    "red": [186, 90, 53],
    "yellow": [255, 230, 74]
  }
}

OpenEPaperLink tag types (resources/tagtypes/*.json in the OpenEPaperLink repository) can say how the panel really shows each colour, in perceptual: sRGB relative to the panel's white. The access point's web UI draws tag images with it. Paste the block into the tag type. Every colour is written, in the tag's order.

spectra

The raw spectra of every read, plus sRGB and D50 Lab per ink (for datasheet comparison), so a measurement can be re-processed later without re-measuring. --out FILE writes this as well, whatever --format prints.

Options

Option
--scheme / --inks the inks to measure, in index order (see Which inks)
--id a name for the measurement (stored in the sidecar)
--temp panel temperature in °C (default: what the display reports, e.g. an OpenDisplay board)
--note free text put at the start of the palette's source, e.g. the panel model
--count reads averaged per ink (default 3)
--port / --cr30-ble [NAME] the CR30 over USB / Bluetooth
--calibrate explicit black/white calibration first (USB)
--address, --key show the inks on an OpenDisplay board
--oepl-ap, --oepl-tag, --oepl-lut, --oepl-timeout show the inks on an OpenEPaperLink tag
--show-command show the inks by running a command
--settle seconds to wait after an ink is shown, before reading (default 3)
--format epaper-palette (default), oepl or spectra
--out also write the raw spectra to this file
--dry-run synthetic spectra and a simulated panel, no hardware

How it works

instrument ─► reflectance spectrum (%, its own wavelengths) ─► colour-science: XYZ & Lab, D65/2°
                                                                       │
                       epaper_dithering.Palette.from_absolute_lab ◄────┘ ─► epaper-palette JSON

The measurement loop (measure.py) connects instrument and display adapters, and an output adapter turns the result into a file:

  • instruments (epaper_colorcal.instruments): anything that returns a reflectance Spectrum. Today that's the CR30 over USB or Bluetooth (epaper_colorcal.cr30; protocol in docs/cr30-protocol.md) and a synthetic one for dry runs. A spectrum carries its own wavelengths, so an instrument with a different range (e.g. 380–730 nm) works unchanged;
  • displays (epaper_colorcal.displays): OpenDisplay, OpenEPaperLink, command, manual and simulated. A display shows one ink at a time and may also report the panel's inks and temperature;
  • outputs (epaper_colorcal.outputs): what the measurement becomes (--format).

Colour maths is done here with colour-science, not by the instrument, so every instrument is treated the same. Supporting another instrument or panel means adding an adapter: see docs/adapters.md (for panels, a --show-command script works until then).

Temperature

The tool records the temperature (from --temp or the board); it doesn't compensate for it. Measuring a panel at a few temperatures and interpolating is the planned next step, and the sidecars are structured for it. See docs/temperature-compensation.md.

Development

uv sync --all-extras
uv run pytest -q
uv run prek run --all-files    # ruff, ruff-format, mypy (strict), pylint

The protocol tests replay frames captured from a real CR30 over both transports (tests/fixtures/cr30_frames.json), so they need no hardware.

Credits

The CR30's USB serial protocol was reverse-engineered by itohio (write-up, color-science); this project's client is its own implementation, built on that work and verified against a device.

Metadata

Release files for epaper-colorcal 0.3.0

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

Source distribution (sdist)

Source distribution for epaper-colorcal 0.3.0
File Size Uploaded Provenance Actions
epaper_colorcal-0.3.0.tar.gz 219.4 kB With provenance Details for epaper_colorcal-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for epaper-colorcal 0.3.0
File Interpreter ABI Platform Actions
epaper_colorcal-0.3.0-py3-none-any.whl Python 3 none any Details for epaper_colorcal-0.3.0-py3-none-any.whl

Total release size: 260.8 kB

Release files / epaper_colorcal-0.3.0.tar.gz

Download URL epaper_colorcal-0.3.0.tar.gz
Size 219.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7c047e49f57efd57cabfdb05d70720a3671d933101d03d3b18dc042cb0f1910a
BLAKE2b-256 checksum
How to use checksums
ea66da20c79527f3aeb7c861266d57916f402042637643475f3b00a9d93f9c9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / epaper_colorcal-0.3.0-py3-none-any.whl

Download URL epaper_colorcal-0.3.0-py3-none-any.whl
Size 41.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07461de16f6b6ab507ff262849e87f479f377424dca26e3af91be88ec0558b52
BLAKE2b-256 checksum
How to use checksums
dda88bff69d1e3e5de94098fdcb039fb64972305f133f1f483f8e7fb4577f48f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for epaper-colorcal 0.3.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for epaper_colorcal-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

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.

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