Waveshare 2.13in display v2 driver

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
User avatar
T-Wilko
Posts: 30
Joined: Thu Sep 19, 2019 8:08 am

Re: Waveshare 2.13in display v2 driver

Post by T-Wilko » Sat May 23, 2020 3:51 pm

JeroenH wrote:
Sat May 23, 2020 8:40 am

I'm not entirely sure I've set the correct SPI pins, I've cobbled the pin numbers together from several sources, none of which official. The official Lilygo website (which btw is blocked by my employer's proxy!) isn't much help in that regard either.
Have a read of their GitHub repo. That link is for your specific epaper range's repo and it appears most of your SPI pins are set up correctly. I've written and tested a few epaper drivers from the datasheet up, and your picture looks like the ePaper isn't initialised correctly within the driver as that sort of static image has hit me a few times as well. If you're really wanting it to work I'd recommend writing your own driver from the datasheet (which isn't as hard as it sounds, as I found out)
Assuming this can be made to work, mcauser's example scripts only draw images. How would one draw a pixel? If I know how to do that, I should be able to figure out how to draw lines, rectangles, circles, etc.
If you write your own driver, you can make it a framebuffer-derived one like this one that I wrote for another epaper driver IC. This has many advantages, including the fact that you can utilise the FrameBuffer methods directly, and enables you to draw pixels, lines, rectangles, text etc. on to the framebuf buffer that gets sent to your ePaper IC for display, which makes everything a lot easier.

JeroenH
Posts: 9
Joined: Sat May 23, 2020 8:19 am

Re: Waveshare 2.13in display v2 driver

Post by JeroenH » Sat May 23, 2020 7:25 pm

T-Wilko wrote:
Sat May 23, 2020 3:51 pm
Have a read of their GitHub repo. That link is for your specific epaper range's repo and it appears most of your SPI pins are set up correctly.
Many thanks! This at least allows me to confirm that I use the correct pins. That removes one uncertainty from the equation.
I've written and tested a few epaper drivers from the datasheet up, and your picture looks like the ePaper isn't initialised correctly within the driver as that sort of static image has hit me a few times as well. If you're really wanting it to work I'd recommend writing your own driver from the datasheet (which isn't as hard as it sounds, as I found out)
You overestimate my programming abilities greatly ;) I am new to micropython, I've just been learning it for the last two weeks. I used to use Arduino (and this unit works well under Arduino), but I want to switch to micropython. However, that means that writing a driver is beyond me for now.
If you write your own driver, you can make it a framebuffer-derived one like this one that I wrote for another epaper driver IC. This has many advantages, including the fact that you can utilise the FrameBuffer methods directly, and enables you to draw pixels, lines, rectangles, text etc. on to the framebuf buffer that gets sent to your ePaper IC for display, which makes everything a lot easier.
Again, that is beyond my abilities at this point. I will have to keep an eye on this topic to see if a working driver surfaces, or come back to this when my micropython abilities have improved to a point where I feel confident enough to pick something like this up.

In any case, thank you very much for your comment.

Jerome Kieffer
Posts: 2
Joined: Sun Jan 24, 2021 4:44 pm

Re: Waveshare 2.13in display v2 driver

Post by Jerome Kieffer » Mon Jan 25, 2021 6:56 am

JeroenH wrote:
Sat May 23, 2020 8:40 am

I'm not entirely sure I've set the correct SPI pins, I've cobbled the pin numbers together from several sources, none of which official. The official Lilygo website (which btw is blocked by my employer's proxy!) isn't much help in that regard either.

I've played around with other libraries both could not get this ESP32/epaper display to work.

Has anyone made any progress on this? This should be a very nice, compact, low power, unit and it would be great if I could make it work with micropython.
Hi Jeroen,
I am playing with the same kind of devices: Lilygo T5_v2.3_2.13 and managed to "control" somehow the display. The device looks really similar to your, but the info written on the ribbon is slightly different. On mine is written "hink 0213...."

For the pin assignment, I found an errors in the doc of lilygo where MISO was assigned to 17 while (and you are right) it is DC, MISO being apparently not connected.

I tried the driver from `mcauser` and got similar noisy pattern. i.e. it almost works. I discovered via the "ESPhome" project that those devices are now shipped with a different e-ink display: GDE0213B72 -> GDE0213B73. I took the LUT waveform From the ESPHome which is 100 bytes, much larger than previouly.
My code is here:
https://github.com/kif/micro-munin/blob ... n13.py#L85
Then you are able to control the device.
Pixel 0 is the lower-left one. Pixels are grouped by columns, one bit per pixel. Signal 1 is white, 0 is black.

I am now working on a way to built framebuffers from text, looking at Peter Hinch's code among other.

Cheers,

Jerome

User avatar
pythoncoder
Posts: 4935
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Waveshare 2.13in display v2 driver

Post by pythoncoder » Mon Jan 25, 2021 9:00 am

The key is to modify the display driver so that the display class is subclassed from the built in framebuf.FrameBuffer class. Follow these instructions to add some simple bound variables and methods and you automatically gain these features:
  • Graphics primitives courtesy of the FrameBuffer class.
  • The ability to write text in arbitrary fonts using Writer and CWriter classes.
  • Compatibility with nano-gui
Peter Hinch

Jerome Kieffer
Posts: 2
Joined: Sun Jan 24, 2021 4:44 pm

Re: Waveshare 2.13in display v2 driver

Post by Jerome Kieffer » Wed Jan 27, 2021 9:38 am

Thanks Peter for the advice (and for the pointer to the doc!).
It makes sense to have the display inheriting from a frambuffer ...

For now, I am not even using framebuffer, plain bytearray + specific font (24pts LiberationMono which is 3 bytes high and 14 pixel wide).

For Jeroen, I had to modify the initialization sequence of the display as well to get display working in a reliable manner.

jeansch
Posts: 1
Joined: Tue Feb 23, 2021 3:17 pm

Re: Waveshare 2.13in display v2 driver

Post by jeansch » Tue Feb 23, 2021 4:06 pm

Hi Jeroen,

You might be interested by https://github.com/jeansch/epaper-lopy4 ... are2in13v2
It's just a proof of concept, but it display an image, using micropython on a lopy4 and the waveshare 2.13in V2.

Image

Regards,
Jean

User avatar
pythoncoder
Posts: 4935
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Waveshare 2.13in display v2 driver

Post by pythoncoder » Tue Feb 23, 2021 5:36 pm

Nice.

I have had hardware problems with two alleged "Waveshare" EPD's and suspect them to be clones. Mine have a hologram showing "QC/07" which I guess are widely available in China for peanuts. Does yours have any hard-to-forge Waveshare identification?
Peter Hinch

Post Reply