txoof / PaperPi

E-Paper display loop with plugins
97 stars 10 forks source link

Does it work with waveshare 13.3 inch 1600x1200 ? #151

Closed chopsuey5000 closed 6 months ago

chopsuey5000 commented 6 months ago

I tried setting display_type as epd13in3k but it seems is for the 960×680 version. Is there any way of making it work with this model https://www.waveshare.com/13.3inch-e-Paper-HAT.htm ?

txoof commented 6 months ago

GOOD NEWS!

It looks like this is an IT8951 based board. This means you can take advantage of the partial refresh, fast update and high-resolution images.

Use "HD" as the display type.

I haven't directly tested a 13.3, I only have a 9" HD currently so I'd love to hear if you run into any problems. In theory, it should "just work."

It also means that if you have a HiFiBerry attached, you can use it without any hassle.

chopsuey5000 commented 6 months ago

Thanks a lot for your answer.

I've tried setting display type HD and the vcom value but getting an error related with gpio setup.

I'm on:

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian

This is my paper.ini config:

#CONFIG_VERSION=1.2
[main]
#waveshare display type use HD for IT8951 displays
display_type = HD
#required vcom value for IT8951 screens
vcom = -2.20
#maximum refresh between total screen clear for HD displays
max_refresh = 4
#logging output level
log_level = DEBUG
#display splash screen (True or False)
splash = True
#rotation of EPD display 
#(cable bottom: 0; cable left: -90; cable right: 90; cable top: 180)
rotation = 0
#mirror screen outuput - useful if output to screen appears backwards
mirror = False
#do not wipe screen when shutting down. True: leave image; False: wipe screen>
no_wipe = False
#plugin timeout - amount of time in seconds to wait for a hung plugin to comp>
plugin_timeout = 30

##### PLUGINS #####
#Each plugin must be configured. A plugin can be
#included multiple times with different configurations
#e.g. to show the status of multiple Logitech Players, or
#weather in multiple locations or with different layouts

#find a list of available plugins:
#$ paperpi --list_plugins

#active plugins configurations must include:
#[Plugin: Your Name For This Plugin] # must start with "Plugin: "
#layout = name_of_layout # found in plugins/plugin_name/layout.py
#plugin = plugin_name # found as plugins/plugin_name
#refresh_rate = seconds # number of seconds between updates to *data*
#min_display_time = seconds # minimum time plugin should show when active
#max_priority = int # values closer to 0 are high priority, negative values a>

#use `paperpi --plugin_info [plugin_name]` for a sample configuration and
#available layouts

#Fallback, default plugin to display if all else fails
[Plugin: default fallback plugin]
layout = layout
plugin = default
refresh_rate = 30
min_display_time = 60
max_priority = 2**15

And this is the output when i run sudo /usr/local/bin/paperpi -d

/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/gpiozero/devices.py:300: PinFactoryFallback: Falling back from lgpio: module 'lgpio' has no attribute 'SET_BIAS_DISABLE'
  warnings.warn(
09:54:49 paperpi :get_config_files:235 :INFO       - using configuration files to configure PaperPi: [PosixPath('/usr/local/paperpi/config/paperpi.ini'), PosixPath('/etc/default/paperpi.ini')]
09:54:49 paperpi :main      :633 :INFO       - ********** PaperPi 0.5.5.0 RGB Starting **********
09:54:49 paperpi :main      :635 :INFO       - PaperPi is running in daemon mode
09:54:49 paperpi :main      :641 :DEBUG      - configuration:
{'main': {'display_type': 'HD', 'vcom': -2.2, 'max_refresh': 4, 'log_level': 'DEBUG', 'splash': True, 'rotation': 0, 'mirror': False, 'no_wipe': False, 'plugin_timeout': 30, 'daemon': True}, 'Plugin: default fallback plugin': {'layout': 'layout', 'plugin': 'default', 'refresh_rate': 30, 'min_display_time': 60, 'max_priority': 32768}, 'xPlugin: System Info': {'layout': 'layout', 'plugin': 'system_info', 'min_display_time': 45, 'max_priority': 2, 'storage_unit': 'GB', 'text_color': 'BLUE', 'bkground_color': 'WHITE'}, 'xPlugin: A Demo Plugin': {'layout': 'layout', 'plugin': 'demo_plugin', 'min_display_time': 30, 'max_priority': 1, 'your_name': 'Slartybartfast', 'your_color': 'chartreuse'}, 'xPlugin: New Yorker Comic': {'layout': 'layout', 'plugin': 'newyorker', 'day_range': 5, 'refresh_rate': 120, 'min_display_time': 60, 'max_priority': 2}, 'xPlugin: Reddit Quotes': {'layout': 'layout', 'plugin': 'reddit_quote', 'refresh_rate': 100, 'min_display_time': 50, 'max_priority': 2, 'max_length': 144}, 'xPlugin: Word Clock': {'layout': 'layout', 'plugin': 'word_clock', 'refresh_rate': 125, 'min_display_time': 255, 'max_priority': 2}, 'xPlugin: Weather Adis Ababa': {'layout': 'layout', 'plugin': 'met_no', 'refresh_rate': 300, 'min_display_time': 50, 'max_priority': 2, 'location_name': 'Adis Ababa', 'lat': 9.0, 'lon': 38.75, 'email': 'you@host.diamond'}, 'xPlugin: default fallback plugin': {'layout': 'layout', 'plugin': 'default', 'refresh_rate': 30, 'min_display_time': 60, 'max_priority': 32768}, 'xPlugin: XKCD Comic Plugin': {'layout': 'layout', 'plugin': 'xkcd_comic', 'refresh_rate': 1200, 'min_display_time': 120, 'max_x': 800, 'max_y': 600, 'resize': 0, 'max_retries': 10, 'max_priority': 2}, 'xPlugin: Librespot': {'layout': 'layout', 'plugin': 'librespot_client', 'refresh_rate': 10, 'max_priority': 0, 'min_display_time': 15, 'player_name': 'SpoCon-Spotify', 'idle_timeout': 10}, 'xPlugin: Slideshow': {'layout': 'layout', 'plugin': 'slideshow', 'refresh_rate': 90, 'min_display_time': 50, 'max_priority': 2, 'image_path': '/pi/documents/images', 'order': 'random', 'frame': 'black & silver: matted'}, 'xPlugin: LMS - Your Player Name': {'layout': 'layout', 'plugin': 'lms_client', 'player_name': 'Your Player Name', 'refresh_rate': 5, 'min_display_time': 30, 'max_priority': 0, 'idle_timeout': 15}, 'xPlugin: decimal binary clock': {'layout': 'layout', 'plugin': 'dec_bin_clock', 'refresh_rate': 30, 'min_display_time': 50, 'max_priority': 2}, 'xPlugin: Moon Phase': {'layout': 'layout', 'plugin': 'moon_phase', 'min_display_time': 30, 'max_priority': 2, 'refresh_rate': 1200, 'email': 'you@host.diamond', 'location_name': 'Europe/Amsterdam', 'lat': 52.3, 'lon': 4.9}, 'xPlugin: Crypto Bitcoin v USD': {'plugin': 'crypto', 'layout': 'layout', 'fiat': 'usd', 'coin': 'bitcoin', 'days': 14, 'interval': 'hourly', 'rss_feed': 'https://bitcoinmagazine.com/.rss/full/', 'min_display_time': 60, 'refresh_rate': 300, 'max_priority': 2}, 'xPlugin: Basic Clock': {'layout': 'layout', 'plugin': 'basic_clock', 'refresh_rate': 30, 'min_display_time': 50, 'max_priority': 2}, '__cmd_line': {'compatible': False, 'list_plugins': False}}

09:54:49 Screen  :_load_hd  :423 :DEBUG      - configuring IT8951 epd
Traceback (most recent call last):
  File "/usr/local/paperpi/paperpi.py", line 718, in <module>
    exit_code = main()
                ^^^^^^
  File "/usr/local/paperpi/paperpi.py", line 646, in main
    screen_return = setup_display(config)
                    ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/paperpi/paperpi.py", line 398, in setup_display
    screen = Screen(epd=epd, vcom=vcom)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/epdlib/Screen.py", line 234, in __init__
    self.epd = epd
    ^^^^^^^^
  File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/epdlib/Screen.py", line 57, in new_f
    return f(self, *args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/epdlib/Screen.py", line 324, in epd
    myepd = self._load_hd(epd)
            ^^^^^^^^^^^^^^^^^^
  File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/epdlib/Screen.py", line 430, in _load_hd
    myepd = AutoEPDDisplay(vcom=self.vcom)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/IT8951/display.py", line 215, in __init__
    epd = EPD(vcom=vcom, bus=bus, device=device, data_hz=spi_hz)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/IT8951/interface.py", line 35, in __init__
    self.update_system_info()
  File "/usr/local/paperpi/venv_paperpi/lib/python3.11/site-packages/IT8951/interface.py", line 105, in update_system_info
    raise RuntimeError("communication with device failed")
RuntimeError: communication with device failed
RuntimeError: Please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)
Exception ignored in: 'IT8951.spi.SPI.__del__'
RuntimeError: Please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)

Any clue on this topic will be more than appreciated

txoof commented 6 months ago

Thanks for the complete debugging info. That helps a lot.

Based on what I'm seeing in your output, it looks like the IT8951 library is failing to communicate with your board. I don't have a 13.3" to test with, but I think we can resolve this if you're willing to do some debugging.

Step 1 (the big easy solution)

Check that SPI is Enabled (the installer should have made you do this, but it's worth checking):

  1. Run sudo raspi-config and check that Interface Options > SPI is set to "YES"
  2. Reboot sudo shutdown -r now -- this isn't strictly necessary, but can't hurt
  3. Try to start paperpi again and see where you get

Step 2 A bit more hassle, but more data rich

We can also do some checking that your board is working properly:

  1. change to the paperpi install location: cd /usr/local/paperpi
  2. download IT8951 so we can use the test suite: git clone --depth=1 https://github.com/GregDMeyer/IT8951.git
  3. start the virtual environment in the directory: source ./venv_paperpi/bin/activate
  4. change to the test suite directory: cd IT8951/test/integration/
  5. run the test python3 ./test.py - you should see a bunch of stuff show up on your screen and eventually a sleeping penguin
  6. clear the screen and verity that everything is working: python3 ./time_full.py

Share the output from the testing.

If you're on Discord, you can visit the support channel for PaperPi and we can do some live debugging together too. I'm located in CET (UTC +1 Amsterdam/Berlin).

chopsuey5000 commented 6 months ago

Hi Aaron,

At the end i made a new fresh installation of Rpi OS + ParpePi and it worked at first like a charm. Previously, I was trying different ways of using the e-paper display with javascript or python and i think it created kind of mess up.

Thanks a lot for your answers.

Next step, develop a plugin ....

txoof commented 6 months ago

So glad to hear its working!

If you want to collaborate on a plugin, let me know.

txoof commented 6 months ago

I'll close this issue. If you want help with a plugin, open a new issue.

PRs for plugins are always welcome.