Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support waveshare 9.7in display #25

Closed
phaer opened this issue Nov 3, 2018 · 30 comments
Closed

Support waveshare 9.7in display #25

phaer opened this issue Nov 3, 2018 · 30 comments
Labels
hardware support Support for additional hardware

Comments

@phaer
Copy link

phaer commented Nov 3, 2018

Hi,

I acquired an 9.7 inch e-ink display which, according to the waveshare, supports partial refresh. I've used their example code for full refreshes, but did not yet find out how to do a partial refresh - the displays refreshes partially, but doesn't display new text in the refreshed area - yet ;)

I'd be very interesting in working on PaperTTY support for this display, but I am new to e-ink displays in general and the 9.7in model seems to work quite differently compared to the smaller models. It uses a IT8951 controller. As far as I understand, I'd need the LUT values for PaperTTY? They seem to be stored in the hat, at least I haven't found them in the demo code yet. And information on the public internet seems sparse.

Anyone else interested in this?

More Infos on the official Wiki page: https://www.waveshare.com/wiki/9.7inch_e-Paper_HAT, the chinese version has a bit more info and code: http://www.waveshare.net/wiki/9.7inch_e-Paper_HAT

@joukos
Copy link
Owner

joukos commented Nov 3, 2018

I too noticed they had a 9.7" model just a couple of days ago and it does seem pretty different - mostly more awesome. Not only is it grayscale but the refresh rate appears to be pretty good. Can't say much about it yet, but I'd be interested hearing your experiences with it - especially the refresh rate.

PaperTTY pretty much uses the vendor's sample code to drive the displays with mostly cosmetic modifications, so I think the 9.7" could be integrated similarly - it doesn't really matter if it differs from the other modules, as long as we can implement a method that updates the image on it. The demo code ought to give a partial refresh example too if it's supported, but I can't find any reference to that either.

Perhaps you can ask Waveshare themselves about it, I've gotten quick replies from their support earlier, and even some sample code that I haven't seen elsewhere - the Wiki might not have it all yet.

@joukos
Copy link
Owner

joukos commented Nov 3, 2018

About the LUTs - I guess they're in the controller with no way to change them, as the datasheet mentions 8 programmable LUTs, but the command list seems very sparse and no mention if these can be reprogrammed (or read) easily from user code.

There's a small baby tugging at my trouser leg so I don't have time to look at this further right now, but seems like an interesting display for sure if it works as advertised.

@joukos joukos added the hardware support Support for additional hardware label Nov 3, 2018
@phaer
Copy link
Author

phaer commented Nov 3, 2018

Perhaps you can ask Waveshare themselves about it, I've gotten quick replies from their support earlier, and even some sample code that I haven't seen elsewhere - the Wiki might not have it all yet.

I did, they confirmed that it supports partial refresh, but didn't provide example code so far - but I sent the last mail just yesterday, so we'll see.

About the LUTs - I guess they're in the controller with no way to change them, as the datasheet mentions 8 programmable LUTs, but the command list seems very sparse and no mention if these can be reprogrammed (or read) easily from user code.

Okay, thanks for the confirmation, I wasn't sure if there's really nothing about reading them in the documentation or if I am missing something - I don't have much experience with low level hardware programming. And I found it strange, that the examples all used mode 2 and the docs did not seem to mention what they other modes were. But right after posting this issue, I found a document which describes the mode, a bit hidden in the chinese wiki (thanks google translate!) http://www.waveshare.net/w/upload/c/c4/E-paper-mode-declaration.pdf

@phaer
Copy link
Author

phaer commented Nov 5, 2018

I've got partial refresh working :) Going to look into PaperTTY support for this mode, but it might take a while as I have limited time available for this project.

@joukos
Copy link
Owner

joukos commented Nov 8, 2018

Neat! :)

@JS01230
Copy link

JS01230 commented Feb 20, 2019

I have the Waveshare 6in model. It is quite similar to the 9.7in as it also runs on the IT8951 driver. Right now, trying to figure out how to get PaperTTY working on this device. I also want to figure out partial-refresh.

@joukos
Copy link
Owner

joukos commented Feb 25, 2019

I have the Waveshare 6in model. It is quite similar to the 9.7in as it also runs on the IT8951 driver. Right now, trying to figure out how to get PaperTTY working on this device. I also want to figure out partial-refresh.

Nice, do mention if you get it working. At some point it would be nice to add support for these since they seem to be superior to the older ones.

@phaer
Copy link
Author

phaer commented Feb 25, 2019

I stopped using PaperTTY as a base and tried to get a local https://www.freedesktop.org/wiki/Software/kmscon/wlterm/ fork to output on my display because it's a lot faster and a fully-featured terminal emulator. Then I paused the project for personal reasons. Going to try to publish some example code during the week, sorry for the delay

@joukos
Copy link
Owner

joukos commented Feb 27, 2019

Nice, I hope you get it to work, it would be really cool for these new displays to be put to good use.

I'm still a bit inclined to try implementing a "PaperVNC" viewer or similar, so that "everything" would work with it - if I ever get the time to continue with these experiments.

@skipper113
Copy link

Cool, got myself a waveshare 9.7' and am interested in it as well. Looking forward for some example codes!

@dvn0
Copy link

dvn0 commented Apr 30, 2019

@phaer did you get anywhere with wlterm?

@ekerebel
Copy link

@phaer, @joukos: I have been playing with the 6inch EPD and the IT8951 Hat for my project, successfully managing partial refreshes. My next step is to create my own PCB, using the IT8951. The question I have: do I need to program firmware/ load the LUT or do these come with the controller?

@mchack23
Copy link

mchack23 commented Jun 4, 2019

@ekerebel @phaer: Hi I've also gotten the 6inch EPD and the IT8951 Hat after reading this thread and I "simply" want a terminal running on it ;) but in fact I have no Idea how to run papertty on it. Which driver did you use? What did you do to have partial refreshes on it? All I can do for now is compile the IT8951.c example from waveshare and show a .bmp on the display but don't know a way of getting papertty running on it. Any pointers?

@phaer
Copy link
Author

phaer commented Jun 4, 2019

Sorry for letting you all hanging for so long. Life came in between and I shelved the project for the last month, got my code base in a backup and going to try to look into it to answer your questions in the next weeks, but it could still take a while

@Mozartenhimer
Copy link

I've got partial refresh working :) Going to look into PaperTTY support for this mode, but it might take a while as I have limited time available for this project.
I bought the six inch model, and it looks like the 9.7" and 6" both have the new IT8951 controller.

I'm looking forward to seeing that 9.7" example code!
In the mean time, I'm going to try to get it working with the 6".
I have this dream of not having to stare at a glowing display to code, and I want to make that a reality.

Off topic, but has has anyone found the IT8951 firmware source code?

@GregDMeyer
Copy link

Hi all,

I implemented a Python driver for the IT8951 controller: https://github.com/GregDMeyer/IT8951

I also have been working on a fork of PaperTTY using that driver, but I haven't uploaded it yet---have to do a bit of cleanup first. Hopefully in the next few days!

Hopefully people find it useful :)

@tg-x
Copy link

tg-x commented Aug 26, 2019

Just checked, they also have now higher resolution (1872×1404) & faster (full refresh 450ms) 7.8" & 10.3" displays -- anyone tried these yet?

Something like a PineTab with an e-ink display like these would be great..

@mchack23
Copy link

mchack23 commented Sep 4, 2019

I implemented a Python driver for the IT8951 controller: https://github.com/GregDMeyer/IT8951

I also have been working on a fork of PaperTTY using that driver, but I haven't uploaded it yet---

yay, thank you very much! I've been able to run your test.py successfully printing on my 6" waveshare display. But since the thing I really want is having a terminal on that display I'm eagerly awaiting your fork (or a hint on how to use your driver with the master branch of papertty.
just to let you know your work (and of course joukos' work) is highly appreciated and eagerly awaited :)

@GregDMeyer
Copy link

Thanks for the bump @mchack23 !

Here is my fork of PaperTTY for the IT8951: https://github.com/GregDMeyer/PaperTTY
It is quite heavily modified in order to take advantage of a lot of the features of the IT8951 controlled displays. Hopefully people enjoy it; would love any feedback! I think it probably doesn't make sense to try to merge that repo with this one (they are sufficiently different). But I did implement a couple things that perhaps could get pulled into this repo---for example parsing character attributes from vcsa (i.e. bold, background/foreground colors).

That being said, if folks want to use the original PaperTTY instead---it would be pretty trivial to add the IT8951 driver to the set of drivers included here, as well. I can do that and submit a pull request if people are interested. :)

@joukos
Copy link
Owner

joukos commented Sep 5, 2019

@GregDMeyer nice! If you get around to making the PRs, I'll gladly merge them.

@phaer
Copy link
Author

phaer commented Sep 5, 2019

@GregDMeyer Wow, thanks a lot for sharing this! Running it right now and its pretty usable :)

@mchack23
Copy link

mchack23 commented Sep 5, 2019

@GregDMeyer this is working beautifully. Thanks a lot!

I had two minor issues that were solved more or less quickly (just listing them here if someone else encounters those):

  1. I hadn't set the correct resolution in raspi-config and it took me a while to realize that there wasn't any option in papertty to set the right rows and colums (had not enough rows (quarter bottom display was blank) but text spilled over in the colums) but that in fact it was all because the resolution wasn't set to 800x600 in raspi-config. after that it worked flawlessly.
  2. can't scroll up using shift-pgup as I'm used to ... don't know the reason yet but as a workaround I just use tmux and then ctrl-b pgup to scroll up :)

Else everything works as I wished and I really am quite happy with my little eink terminal. It is a bit slow still, so I wonder if there is an option possible that would forget about greyscale etc and just try and be as fast as possible. (like the --flip argument, a --fast for fast mode ;) ... but well that's nitpicking already. It is pretty usable just as phaer commented and I'm already dreaming of getting the huge screen from waveshare and putting it in an old laptop case with a raspi :) thank you guys so much! I've been dreaming of having this since I had my first kindle (it was a 3g and had a keyboard and I had a terminal on it, but I wanted a real keyboard and a real linux terminal with ssh and tmux and everything and now I have just that :D

@GregDMeyer
Copy link

so awesome to hear! I am wary to discuss too much on this thread here, but if you want to open an issue on my repo I will comment there!! :) real quick response regarding the speed---there are still some optimizations to be had in communicating with the device, that I hope to implement soon. Hopefully then it will be a bit snappier!

@fimad
Copy link
Contributor

fimad commented Oct 21, 2019

Is anyone actively working on porting @GregDMeyer's changes to this version of the library? If not, I have some local changes that add IT8951 support to this version of PaperTTY that I can upload.

@GregDMeyer
Copy link

@fimad sorry to not push those changes yet. I'm happy to write a quick function that calls my driver, though if you have a standalone implementation for this library that might be better so that people don't have to install a second package to get it working.

@fimad
Copy link
Contributor

fimad commented Nov 1, 2019

Sounds good, I have a standalone version that doesn't add any new dependencies. I'll clean it up and send out a PR this weekend.

fimad added a commit to fimad/PaperTTY that referenced this issue Nov 3, 2019
I've tested this with a 6 inch display that uses the IT8951 controller
board with both VNC and terminal and it seems to work well. I haven't
tested with a 9 inch display but there isn't anything display specific
in the driver (that I'm aware of) so it should just work.

This implantation is based off the WaveShare sample code in
https://github.com/waveshare/IT8951. There are some idiosyncrasies in
that code that I don't understand and aren't documented but appear
necessary. For example, manually controlling the CS pin instead of
letting the SPI driver code handle it...

Issue joukos#25
fimad added a commit to fimad/PaperTTY that referenced this issue Nov 3, 2019
Previously the driver was using 8 bits-per-pixel for SPI transfers.
This is wasteful sine the actual display only supports 16 different gray
levels.

This updates the code to use a packed format that uses 4 bits-per-pixel.

There is the potential for further optimization when rendering text (or
other pure black and white images) to use 2 bits-per-pixel. However,
when I tried this the fast display mode did not properly clear pixels
between blits.

Issue joukos#25
@joukos
Copy link
Owner

joukos commented Nov 3, 2019

Thanks to @fimad the support for IT8951 is now merged (7e405bf) - please test it with the 9.7" :)

P.S. I welcome any photos with these displays that could be added to the main README. Also, I haven't found a single video online demonstrating a Linux CLI/GUI (or pretty much anything useful) with any of these displays, so I've hesitated getting one before seeing how the update speed is etc. It would be cool if someone could make a short demonstration clip :)

@joukos
Copy link
Owner

joukos commented Nov 3, 2019

It appears the 9.7" works with the latest code, great work and thanks to you all. I'll close this issue now as it's pretty long already, so if there's any problems new issues should be created.

@sergarcia
Copy link

It appears the 9.7" works with the latest code, great work and thanks to you all. I'll close this issue now as it's pretty long already, so if there's any problems new issues should be created.

I read through the post and it is unclear to me if the partial refresh that some of the commenters got working was actually implemented. In the current version of paperTTY, does the 9.7 inch display refresh quick enough to be usable as an interactive terminal? (According to the manufacturer the partial refresh rate is about .3s, which appears that would be sufficient for terminal use)

@joukos
Copy link
Owner

joukos commented Sep 12, 2020

I think (all?) IT8951 driven displays support partial refreshes, but the current method of handling the SPI writes with Python is not optimal and as the larger displays typically have bigger resolutions too, in addition to the marketed 0.3s it may take several seconds to transfer the data for the update. The only IT8951 display I have is the 6" HD and sometimes it seems to update pretty fast and sometimes not, so YMMV. Whether it's usable depends on your definition of interactive, but I'd say that with the current implementation the bigger displays are better suited for things that don't update too often. That said, if you've used the internet with dial-up and didn't complain, it might be bearable, but I wouldn't expect a very responsive result with the 9.7". I haven't tried one though. It also depends which RPi you're using, the beefier the better, but in the end frame data transfer is the bottleneck.

Regarding SPI, there was some work done here #36 (comment) which would be nice to incorporate into PaperTTY, but time hasn't allowed to look at that yet in detail. It sounds like that would help a lot with the refresh speeds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hardware support Support for additional hardware
Projects
None yet
Development

No branches or pull requests