-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add support for Lilygo T5-4.7 inch e-paper module #1109
Comments
Would someone be able to give me some hints in to what this actually involves? I assume mainly just adding support for the actual e-paper display? |
It seems that it dont use the same driver as the Waveshare e-paper series does... from my (limited) comprehension, it's much closer to the Inkplate which is already supported in esphome. here is what i found analyzing the schematics: LilyGo-EPD47.pdf 8 pin for data: connection to shift register (74HC4094) it's all i have :-) |
I attempted to port the Inkplate driver; Things to note: The inkplate code has i2c enabled/forced, this is mapped to GPIO 21/22, so you'll get boot loops if you try to use it with the EPD (As GPIO 21 & 22 are used in the parallel connection for the display). You'll need to modify the component and disable the i2c call. Inkplate has several control IO signals that aren't used on the EPD47, I've deleted these, or used them in similar functions (power enable) That said, the sample code by vroland (https://github.com/vroland/epdiy) is a work of art, and far exceeds that of the inkplate base code by using the built in timer and I2S Parallel driver function of the ESP32. What should happen is the EPD driver should be ported, and made universal to consume the inkplate and all other EPDiy type boards. This should let anyone use any of the EPDiy based board/display combos (Link above in vroland's github) |
Any update on this? I could have a go if you've got some work anywhere? |
Just adding a +1 here for the port, would be great to have this natively supported in ESPHome |
I put something together using the edp_display drivers from Lilygo. I tried using a more generic approach for all displays supported by epdiy, but got frustrated and resorted to basic support. The display component only supports full draw, and not partials... Partial updates in general are bad news, but I might look into support at some later stage. This was NOT thoroughly tested and it might stop working at any time... your mileage may vary. https://github.com/tiaanv/esphome-components Enjoy. PS. I also tried doing this in the more correct "external_components" model, but for some reason it no longer worked when I did that.... So custom_component it is..... |
Great! I tried to test this, not sure where I'm going wrong. I've cloned the repo to the base of my esphome config and renamed the folder to custom_components otherwise I was getting errors even recognizing the platform
I've added a very basic definition of the display into my yaml:
but I'm hitting this error when trying to compile it:
Any pointers? Thanks again for the effort, I've been using this display for a while with the code borrowed from here - https://github.com/rbaron/eink-ha but I would still prefer native ESPHome integration. Any chance you can also post the sample yaml? Thanks! Edit:
now I'm missing the driver.. I cloned the repo but being the noob I am I'm not sure where to place it for esphome to find it..
|
remove the includes statement... I got the same issue... What you are trying here is the "external_components" model... That does not work... What you need is to locate the esphome folder in your config dir in HomeAssistant... Then create the "custom_components" folder in there if you don't already have one.. then make sure to copy the T547 folder into that folder. On my system I'm accessing it via a samba share from my windows machine.. effective folder structure: with all the files in there... This method works for me... Other that that, I'm afraid I haven't spent enough time with development of custom components to know why I can't get it to work as an "external component" |
I probably should have mentioned that I have ESPHome running on a completely different machine (a laptop) than Home Assistant, that's running in a docker container on my RPi, not on Hass but.. I also have a VM with hass.io running on the laptop, I used the terminal add-on to clone the git repo to config/esphome/, renamed esphome-components to custom_components, then I got no errors in the yaml editor.. but it still won't compile:
|
I don't have enough experience in this regard. I'm sorry I can't help more... Perhaps one of the smarter people can figure it out... that sees this post.... I'm not near my dev PC, but perhaps tomorrow I will give the external components route a go again... then it should work... until then, I hope you figure something out.. |
I was getting the same Here is a working example:
The redraw is full screen, which is fairly slow. Using the sample code from Lilygo I was able to do partial updates, so it should be possible to enable. |
The Init.py issue was because the file in my local source failed to upload to github. It skips empty files... I added a single blank space to correct that issue. I guess in theory I can now try the proper external components approach again... Will make it easier for most to implement, and it will be pulled from git automatically... |
Share the code with which you were able to do a partial update? Sorry for my English. |
@NeroWard the sample code is here https://github.com/Xinyuan-LilyGO/LilyGo-EPD47/blob/master/examples/demo/demo.ino although it is built and installed with Arduino, and the partial update functions aren't compatible (yet) with the esphome It might be possible to remove the call to |
I took me a bit of time to fine-tune it to my liking but I'm pretty happy with the outcome: yaml is here - https://gist.github.com/Plawasan/4ae826b05aaa7812f3a191714ca47a50 - keep in mind I'm no programmer so it may not be as clean as it could be but it works reliably. I have yet to see how long will the battery last, right now I have it configured to refresh every 20 minutes during the day and then sleep for 6h after midnight. There is a period of time after the ESP wakes up from deep sleep (and resets the display) until new data comes from HA when the display is blank - I didn't find a way to easily disable it so I at least raised a feature request for it - #1555 It's obviously configured for my specific use case and entities but the yaml should be simple enough to adjust. |
I'm sharing one more implementation that I developed a while ago. I'm using it for a least one month and so far haven't experienced any issues. I'm utilizing vroland/epdiy library which supports partial screen update and display orientation. Pretty much all ESPHome display features are supported. Minimal usage example
A bit more complex usage example
|
Tested, works!
This is how I get the values:
and this is what I get with lilygo_t5_47_display:
Simply changing platform back to tiaanv's t547 gives me the correct readings again:
So very selfishly the ideal solution for me would be implementing the 'clear: false' option in tiaanv's version of t547 :) |
I find that even with my component when I power off the display, the ink begins to "bleed" I think this has to do with the the way the display works... I have tested @vbaksa s version, and I think it works much better. The only funny thing I notice is that the update cycle takes 4 seconds, even though it/s partial, which should be very quick... Haven't looked at the code... As far as the clear setting is concerned, I don't think it would really work well with my version, as I do a full display redraw in any event... I think it would be good to invest further development effort into his version. I will play around a bit with deep sleep and see what can be done. As far as the Voltage is concerned. I'm pretty sure somewhere in the code, the EPDY library messes with the VREF because for some displays it uses temp sensor. Perhaps that's the cause for the voltage ref. Irrespective.. should be simple to work around that also... simply use the scaling factor, until we can figure it out... Provided it's actually reading the correct pin etc... |
One more update. I added separate battery voltage measurement component "lilygo_t5_47_battery". It is based on EPDY library code. As @tiaanv mentioned before - it is messing up VREF, so keeping it as separate component. Usage sample below:
|
Updated my config to:
I was getting errors about missing init.py in my local repo, had to temporarily add a refresh: 5s line to the component definition to force it to get the repo again.. I've updated my battery voltage sensor to use the platform, got this error:
When I got rid of the lines that work with the sensor I can see it returns the correct value but it seems to be missing the members that allow it to be used same as other sensors.. i think?
Bleeding issue is still there... |
@Plawasan - try something like below for templating battery voltage measurements
|
@vbaksa - OK, that worked (after I remembered to refresh the repo again...).. thanks! So really the only issue I see now is the display bleeding, I created 2 additional pages, one blank, one all black and I have the display cycle through them before displaying the main page - the bleeding still occurs. I don't think this is the issue, even without this the display always starts perfectly clear after the update and then it fades. I can't figure out whether it happens when the ESP goes to deep sleep but it seems to me it has something to do with power, it's never an issue when I have the display connected via USB, it only happens when it's running on battery power (even 100% charged) btw I wanted to return my display back to the previous config (- platform: t547) but keep using your component for the battery, now I'm getting a ton of errors of duplicate definitions - is that solvable? |
Few more updates:
@Plawasan - regarding display "bleeding" issue you are getting. Is it the same as vroland/epdiy#92 |
Yep, sounds like exactly the same issue... I never had that problem using @tiaanv 's driver.. |
I also have the same issue of display "bleeding", not a lot when running with USB-C but more pronounced when using a battery. Everything else seems to run fine. I tried using the new ESP-IDF mode in my configuration but got a problem related to a header from epdiy not being found. I couldn't understand why. |
I have the touch panel for this display. What would be required to implement touch into this build? |
Screen bleeding is caused by switching screen off to early. This board is designed in a way that if there is USB power then screen has power all the time ( indicated by blue led) but on battery, power to screen is controlled by driver. Simply delay must be added before epd_poweroff, or maybe there is way to ask if refresh is completed |
@kaweksl - thanks for the info. A delay can be added quite easily. However, the question is - how long it should be delayed before calling epd_poweroff ? |
Yes I have the same problem with @ashald component. |
2023.12.x apparently changed how display components need to be implemented. Until @ashald does an update, you'll need to manually edit your local tree, eg. for me it was under Edit: Turns out I'm actually using @kasdk3's component but the changes above would still apply for @ashald's component. |
@llamaonaskateboard Thank you, that's extremely useful. I've fixed in my local fork and raised a pull request for @ashald so hopefully he can merge this for others to be able to use. If anyone else is impatient and doesn't want to wait for this merge, they can use my repo in the meantime:
Please note - I am not maintaining this going forward, it's simply here as a convenience for building my own devices! |
With your fork i have old issue with discplaybuffer :( INFO ESPHome 2023.12.5 |
Has anyone a working fork? I can't get mine working again. |
Here's my current working config that compiled this morning:
|
Mine clean building ok with ESPHome 2023.12.9, the above forked library and my own setup. Have you done a clean compile? |
with your fork I have the same error as with my own. I have clean the build files. |
Mika-Btz, I am also getting the same error as you. Did you find a solution? |
For me my fork works, but you have to clean the build files. |
I have a fix on that, it compiles without error:
Since I have no plans to maintain my fork, I have created ashald/esphome#5 . Until the PR gets merged this fork remains for sure. |
I tried madimadi’s fork and it complied with no issues, however it only supports 2 color display. Anyone know of a working fork that supports 16 grayscale? I have the original display and many of the forks don’t seem to go into low power mode when deep sleep is called; madimadi’s does. |
It works perfectly fine with nickolay fork and standard images / online_image: esp32:
variant: esp32s3
board: lilygo-t5-47-plus
external_components:
- source: github://nickolay/esphome-lilygo-t547plus
components: ["t547"]
- source: github://kaeltis/esphome-lilygo-t547plus
components: ["lilygo_t5_47_battery"]
- source: github://guillempages/esphome@online_image_buffer
components: [online_image] I'm using lilygo T5 V2.3 with .png images quantized to 16 colors. ESPHome v2024.3.2. |
I came back to my code after a while and wanted to make some minor updates but I can't really get any combination of the external components and the display definition to compile.. .can somebody please post the relevant parts of their code that compiles with the latest ESPHome and includes both the display and the battery? Thanks! |
Hi, Is posible to buy only new screen - without S3 board? |
@dabalroman I have severe burn-in in the display as well, however only when the display/board is sleeping. If you use the display on external power and don't put it in deep sleep, the display will hold the white values properly and the burn-in goes away. However as soon as it enters deep sleep, you'll see the burn-in again. I've tested running the display on external power for 2 months now to see if it fixes the burn-in more, but it doesn't. |
I have the lilygo t5-4.7 (not plus). I have tried: https://gist.github.com/Plawasan/f4fdc1480534ca4a50bcfbdf495b9448 but I keep getting a compiling error: File "/data/external_components/6d3a8382/esphome/components/lilygo_t5_47_display/display.py", line 40, in to_code |
@styphonthal this works for me: external_components:
- source: github://nickolay/esphome-lilygo-t547plus
components: ["t547"]
- source: github://kaeltis/esphome-lilygo-t547plus
components: ["lilygo_t5_47_battery"]
(...)
display:
- platform: t547
id: my_display
rotation: 180
update_interval: 24h
lambda: |- I didn't bother to try to make it work with one repo, maybe there is a way to do that. |
So this worked for my display, but the battery reports really off numbers. |
EDIT: Tagged the OP @xxLeoxx93
V2.4 is lilygo-t547plus (esp32-s3). Solution, published by @alexwide in parallel thread #1960 works well. It uses touchscreen log
|
Anyone using the latest Homeassistant + ESPHome Addon configuration? It seems like they changed the file handling. Not it doesn't find the board anymore and the folder structure is completely different. |
Just upgraded to ESPHome 2024.10.0, running HA 2024.10.2 and rebuilt one of my LilyGo screens - built cleanly first time with no issues. |
@daernsinstantfortress May I ask where you placed the board file? The original folder structure does not exist for me. |
Below the HA config folder in
|
Thanks! I 'll try that.
|
Checkout this mod on S3 model for fast partial and full refresh using latest version of the EPDiy library. |
@dabalroman Love your case! Could your please share 3D files for it? |
Describe the problem you have/What new integration you would like
The Lyligo T5-4.7inch is a great e-paper module based on an ESP32. It has a resolution of 960*540, 16 gray level and support partial refresh. I would be great to have it integrated in ESPHome the same / similar way Waveshare e-paper screens and modules are.
Please describe your use case for this integration and alternatives you've tried:
To date there is no support for this module in ESPHome. The only support given by the maker is through Arduino IDE
Additional context
This is the maker's GitHub for this product: https://github.com/Xinyuan-LilyGO/LilyGo-EPD47
The text was updated successfully, but these errors were encountered: