Captures everything needed to redeploy the two-display clock (hour on I2C 0x61, minute on I2C 0x63) on a fresh Pi: - Both systemd units (matrix0x61.service, matrix0x63.service) - Deployed Pimoroni script tree, including the local %I (12-hour) clock customization - Vendored upstream sources (ltp305-python, breakout-garden) so restore is fully offline-capable - Boot config snippet enabling I2C - install.sh that wires it all back up idempotently - Inventory doc cross-referencing every live-system path Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2.8 KiB
Pimoroni LTP305 LED Matrices Breakout
The LTP305 breakout includes two LTP305 displays and an i2c dual matrix driver to drive them.
Getting Started
You'll need to install the LTP305 software library and enable i2c on your Raspberry Pi.
Pre-requisites
Python 3 & pip
You should use Python 3, which may need installing on your Pi:
sudo apt update
sudo apt install python3 python3-pip
Enabling i2c
You can use sudo raspi-config on the command line, the GUI Raspberry Pi Configuration app from the Pi desktop menu, or use the following command to enable i2c:
sudo raspi-config nonint do_i2c 0
Installing the library
python3 -m pip install ltp305
Reference
In all cases you'll want to create an instance of the LTP305 class with the appropriate i2c address for your device.
The following addresses are available:
0x61- Default address0x62- Solder bridge applied to Addr+10x63- Cut Addr+2
from ltp305 import LTP305
display = LTP305(address=0x61)
set_pixel
Set a single pixel. Treats both matrices as a single display that's 10 pixels wide and 7 pixels high.
display.set_pixel(0, 0, 1)
display.show()
set_decimal
Set the decimal dot on one or both matrix displays:
display.set_decimal(left=True, right=False) # Just the left
display.set_decimal(left=False, right=True) # Just the right
display.set_decimal(left=True, right=True) # Both
display.show()
set_character
The library includes a font with a range of ASCII and Unicode characters, each matrix can display a single character.
display.set_character(0, "a")
display.set_character(5, "b")
display.show()
set_image
Set a 1-bit PIL image to the display.
from PIL import Image, ImageDraw
image = Image.new("1", display.get_shape())
draw = ImageDraw.draw(image)
draw.rectangle((0, 0, 4, 6), 1)
display.set_image(image)
display.show()
get_shape
Return the width and height of the display:
width, height = display.get_shape()
clear
Clear the display. Sets all pixels in the buffer to 0 (off). You must call show() to update the display.
display.clear()
show
Once you've finished setting pixels or drawing characters into the buffer, you must call show to update the matrices with the buffer:
display.show()