Warn: Code generted wtih use of copilot (yeah, i'm lazy to do basic stuff...)
Project consist of multiple parts that plyat together.
docker run --rm -it -v ${PWD}:/mnt/app -w "/mnt/app/" python:latest bash
To install&setup all parts run install.sh script first. This will create virtaual python eviroment. Make sure that submodules were downloaded in external folder. Ther should be these ones:
bash install.sh
This should work on other devices too.
- enable SPI in
sudo raspi-configno other addition to/boot/config.txt - Download as local module
https://github.com/GregDMeyer/IT8951and run setup - check if all libraries in python has needed version and install other needed libraries
- set vcom value. for 7.8" HD is value -1.56 (-1.80 works better)
- try running following test script until it runs (tested and it runs on bulleye lite)
- script with SPI may need authorization to ise SPI, so run it with sudo or add SPI group
from IT8951.interface import EPD
from IT8951.display import AutoEPDDisplay
from IT8951 import constants
import numpy as np
from PIL import Image, ImageDraw
# Nastavenie rozlíšenia pre 7.8": 1872 × 1404
# WIDTH = 1872
# HEIGHT = 1404
display = AutoEPDDisplay(vcom=-1.56, spi_hz=24000000)
img_path = '<PUT HERE ANY IMAGE to show on display>'
print('Displaying "{}"...'.format(img_path))
# clearing image to white
display.frame_buf.paste(0xFF, box=(0, 0, display.width, display.height))
img = Image.open(img_path)
# TODO: this should be built-in
dims = (display.width, display.height)
img.thumbnail(dims)
paste_coords = [dims[i] - img.size[i] for i in (0,1)] # align image with bottom of display
display.frame_buf.paste(img, paste_coords)
display.draw_full(constants.DisplayModes.GC16)Just run fetch-weather.py (get weather data before first creen render) and render-screen.py with env in cron every minute or so like this:
*/30 * * * * cd /home/THE-USER/zero-weather-station && .venv/bin/python fetch-weather.py
* * * * * cd /home/THE-USER/zero-weather-station && .venv/bin/python
0 0 * * * cd /home/THE-USER/zero-weather-station && .venv/bin/python reset_epaper.py