piframe/docs/lcd_control.md

1.3 KiB

LCD Control

The below will setup an Adafruit mini LCD with 2 buttons as a controller for selecting which photo albums are displayed on a PiFrame. This setup also includes the Adafruit stemma/qwiic LUX sensor setup which will be integrated further in the future.

Please note:

  • Single button presses need about 1/4 of a second to register
  • Holding 'Up' for at least 3 seconds will trigger a prompt to reboot
  • Holding 'Down' for at least 3 seconds will trigger a prompt to power off
  • If you hold 'Down' on the reboot or power off prompts a debug menu will be displayed

apt install -y python3-pip ttf-dejavu python3-pil python3-numpy

pip3 install adafruit-circuitpython-rgb-display adafruit-circuitpython-bh1750 RPI.GPIO
pip3 install --upgrade --force-reinstall spidev

git clone https://git.kemonine.info/kemonine/piframe.git /opt/piframe
cp /opt/piframe/lcd_control.py /usr/local/bin/
chmod a+x /usr/local/bin/lcd_control.py
cat > /etc/systemd/system/lcd_control.service <<EOF
[Unit]
Description=Control which album is shown as a slideshow
After=fim.service

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/lcd_control.py
TimeoutSec=15
Restart=always

[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now lcd_control