Initial backup of LTP-305G matrix clock setup on matrixpi

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>
This commit is contained in:
dissimulo
2026-05-06 01:32:39 -07:00
commit 030172f523
99 changed files with 4445 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
# Nightlight example
A simple little example of how to make a nightlight with the LTR-559 and 5x5
RGB matrix breakouts. It can be toggled on or off by tapping the sensor, or
triggered automatically when it gets dark.
## Pre-requisites
This example requires:
- A Pimoroni [Breakout Garden](https://shop.pimoroni.com/products/breakout-garden-hat-i2c-spi)
- A Pimoroni [LTR-559 Light & Proximity Sensor Breakout](https://shop.pimoroni.com/products/ltr-559-light-proximity-sensor-breakout)
- A Pimoroni [5x5 RGB Matrix Breakout](https://shop.pimoroni.com/products/5x5-rgb-matrix-breakout)
## Installation
Pop the breakouts into your Breakout Garden, and then run the `install.sh`
script in the root of this repository with `sudo ./install.sh` to automagically
install all of the required libraries.
## Running this example
To run this example, type `./nightlight.py` in the terminal.
You can change the RGB values of the `colour` variable to change the colour
of the light to whatever you wish. If you want the light and proximity
thresholds to be more or less sensitive, then you can change the values of
the `light_threshold` and `prox_threshold` variables.
## Notes
It's probably best to have the sensor and matrix breakouts on either side
of your Breakout Garden HAT, so that they're spaced apart and the LTR-559
won't be affected by the light from the matrix.

View File

@@ -0,0 +1,103 @@
#!/usr/bin/env python3
import time
from ltr559 import LTR559
from rgbmatrix5x5 import RGBMatrix5x5
print("""This Pimoroni Breakout Garden example requires an
LTR-559 Light and Proximity Breakout and a 5x5 RGB Matrix Breakout.
This example creates a little nightlight that can be toggled on or
off by tapping the proximity sensor with your finger, or triggered
automatically when it's dark.
Press Ctrl+C to exit.
""")
# Set up the LTR-559 sensor
ltr559 = LTR559()
# Set up the 5x5 RGB matrix
rgbmatrix5x5 = RGBMatrix5x5()
rgbmatrix5x5.set_clear_on_exit()
rgbmatrix5x5.set_brightness(0.8)
# Initial variables to keep track of state of light
state = False
last_state = False
toggled = False
light_threshold = 100 # Low-light trigger level
prox_threshold = 1000 # Proximity trigger level
colour = (255, 165, 0) # Orange-ish
# Function to toggle the RGB matrix on or off depending on state
def toggle_matrix():
global state, last_state
if state is True and last_state is False:
rgbmatrix5x5.set_all(*colour)
rgbmatrix5x5.show()
elif state is False and last_state is True:
rgbmatrix5x5.clear()
rgbmatrix5x5.show()
last_state = state
# Read the sensor once, as the first values are always squiffy
ltr559.update_sensor()
lux = ltr559.get_lux()
prox =ltr559. get_proximity()
time.sleep(1)
try:
while True:
# Read the light and proximity sensor
ltr559.update_sensor()
lux = ltr559.get_lux()
prox = ltr559.get_proximity()
# If it's dark and the light isn't toggled on, turn on
if lux < light_threshold and not toggled:
state = True
if state != last_state:
print("It's dark! Turning light ON")
toggle_matrix()
# If it's light and the light isn't on, turn off
elif lux >= light_threshold and not toggled:
state = False
if state != last_state:
print("It's light! Turning light OFF")
toggle_matrix()
# If there's a tap on the sensor
if prox > prox_threshold:
# Toggle it off if it's currently on
if toggled:
state = False
toggled = False
if state != last_state:
print("Toggling light OFF")
toggle_matrix()
# Toggle it on if it's currently off
else:
state = True
toggled = True
if state != last_state:
print("Toggling light ON")
toggle_matrix()
# Wait a short while to prevent the on/off switch
# from immediately re-triggering
time.sleep(0.5)
elif prox < prox_threshold and lux >= light_threshold:
state = False
time.sleep(0.05)
except KeyboardInterrupt:
pass