I recently bought a 2.13" tri-color ePaper and Pico and after some struggles got the ‘demo’ program running in Thonny (works in win 10, not win 7 ), but the program only has the display working in ‘portrait’ mode. The product picture on CE has the display in ‘landscape’ mode which is what I want. Any thoughts/sources on how to achieve that?
Unfortunately the Micropython driver doesnt easily allow for landscape mode graphics to be made up (this is an artifact of the
If you’re after the demo code on the product page the Arduino examples will let you customise the display much more!
There was also a similar topic here that has some interesting tid-bits of info: How To Write Text to WaveShare E-Paper Display
Thanks. I checked out the link and I’ll check for Arduino examples that I may be able to translate to Micro Python.
Hi Paul, is it this one? E-Paper E-Ink Display Module (B) for Raspberry Pi Pico, 2.13inch, Red / Black / White, SPI (212×104) | Waveshare | Core Electronics Australia
Is this the demo code? Pico_ePaper_Code/Pico_ePaper-2.13-B.py at cf170d64be86ffe1a64267b2366482846593f800 · waveshare/Pico_ePaper_Code · GitHub
If not then this might be a starting point…
If so, then you should be able to modify the code a bit to get it to work. I don’t have the display, but you could try the following
Lines 34 & 35
EPD_WIDTH = 212 # was 104 EPD_HEIGHT = 104 # was 212
That will get the frame buffers the right shape, but for the encoding into the bytes you’ll need to change that too so replace
framebuf.MONO_VLSB on lines 59 & 60 that should get the buffer bits going down the screen in landscape, the equivalent to across in portrait.
The next part would be to change the
display() method, here’s where I wish I could debug things, but I’m really just swapping
height (also renaming
def display(self): self.send_command(0x10) for w in range(0, self.width): for h in range(0, int(self.height / 8)): self.send_data(self.buffer_black[h +w * int(self.height/ 8)]) self.send_command(0x13) for w in range(0, self.width): for h in range(0, int(self.height / 8)): self.send_data(self.buffer_red[h + w * int(self.height/ 8)]) self.TurnOnDisplay()
At the very least that should display something. My worry is that it’ll be be mirrored, if so you could try changing the loop to go backwards (from width -1 to 0)
for w in reversed(range(0, self.width)):
Hopefully it should be pretty quick to try
I also found this: Waveshare e-paper display how to rotate? - MicroPython Forum that might help.
It has an example that uses 2 additional buffers and then translates them to the ones used in
That has the advantage of pictures to show it worked