How To Write Text to WaveShare E-Paper Display

Hi There,
I recently purchased a WaveShare 2.13" e-paper display with the goal of reproducing the clock screen or something similar to what is displayed here on the Core Electronics sales portal.

I can only find one example python script for creating any output to this device and no software documentation at all.
I can run the example code no problem on my pico and the output


is in the attached image. I have added some debug output statements to the code and can see what happens during the execution (see log file).
Debug.zip (4.1 KB)
I’m having a hard time working out how I can simplify this code and write a string to a specific place on the screen without having to update the entire screen as it seems to flash the entire screen several times every update.
The demo is also in portrait mode. I want to use landscape mode. Any ideas on how I can figure out how I can print text to this display similar to the picture in sales portal and update the clock as time goes by without having to refresh the entire display.
A number is updated at the end of the demo from 1 to 9 but I’m having trouble understanding the code.
Thanks in advance
David

5 Likes

Hi David,

You could spin up your own module to keep the main.py file a bit neater, it looks like the function epd.displayPartial(epd.buffer) is able to start a partial refresh (looks for the differences in the framebuff) and changes them.

To clear a section of the screen you could use the fillrectangle function to reset it to white: framebuf — frame buffer manipulation — MicroPython 1.18 documentation

Unfortunately, I don’t think the sideways text is possible using the framebuffer implementation that’s implemented in Python for the display, I’m not 100% certain but you might be able to manipulate the init portion of the code to think the screen is facing the other way (might be worth tinkering with).

From the looks of it though the example on the portal page is using C - and a combination of these commands - Pico e-Paper 2.13 - Waveshare Wiki

If you could use a full-size Pi(The Zero would work) the Pillow or PIL library lets you create an image yourself - with some ease might I add and then you can make a call to update (or partially update the screen

5 Likes

Hi Liam,
Thanks for your reply. I wasn’t expecting to need to learn so much new stuff to get this to work. I’ll persevere and post again once I have made some progress.
I also have a Real Time Clock as part of this project so I thought I’d see if I could set the time then read it back again. I found this post from someone else who has completed a similar project to mine with a different model screen. Perhaps I can learn from his description of how his project works and then apply it to my project.
Thanks for your assistance.
David

5 Likes

Welcome David!!

Sounds like @Liam120347 has got you off to a good start. That project that you link looks like it also backs onto the ‘framebuf’ library.
Since your e ink display supports images you could make up some photos in paint or another photo editing tool and print the images onto the screen - It will fill up the flash in the Pico but there is TONS there (a whopping 16MB!!).

If you need a hand or would like some thoughts put past anyone the forum is the place for it!
I’m keen to see this one done!
Liam.

PS: A great alternative is the pHAT screens: I think this is where Liam read about using PIL: https://core-electronics.com.au/search/?q=inky+phat

3 Likes

I managed to figure out the screen update stuff and I’m able to use the standard font in portrait mode to write and erase a string anywhere on the screen. The problem the fonts are tiny. I can’t see any way to scale them at all.

I’m also curious what the two button like things are on the screen near the connector end of the board?

I’m thinking I should have bought one of these screens instead.

I found a very interesting post about defining custom fonts. I’m not sure if it would even be possible to dig into the library for the display and convert it to this wave share screen.

4 Likes

Hi David,

Yeah unfortunately (and back to the framebuf) there isn’t much you can do Re: scaling easily. Making up some images and porting those should work though.

I believe those are electrodes, one for the top plate of the screen and one for the bottom.

The only downside to the Pimoroni screen is that its an LCD so uses a bit more power - You could also go with the Core OLED module.

It’s definitely doable, all of the underlying principles are the same between the displays - Both myself and other members would surely jump in and help :smiley:

3 Likes

Perhaps I could come up with a way to create fonts as a set of images. However I haven’t yet seen an example of how to display an image on one of these screens using python. Any ideas how I can do this?

I just found this specification for Framebuff

It describes horizontal bit mapping instead of vertical.
I don’t really understand if it is of any use to my problem.

Extract

framebuf.MONO_HLSB

Monochrome (1-bit) color format This defines a mapping where the bits in a byte are horizontally mapped. Each byte occupies 8 horizontal pixels with bit 7 being the leftmost. Subsequent bytes appear at successive horizontal locations until the rightmost edge is reached. Further bytes are rendered on the next row, one pixel lower.

UPDATE
Actually when I search my example code this is already specified
framebuf.MONO_HLSB

Thanks
David

2 Likes

Hi David,

Good find! Taking a look through the example code it looks like there’s a function called displayPartBaseImage(self, image), its more or less another function that completes a partial refresh(it contains the same code as displayPartial(self, image).

You’d have to spin up your own reading and displaying functions but fortunately the PiicoDev OLED module has this implemented already

To update the OLED you then have to call the .show() function - being able to translate the image a certain amount after importing it shouldn’t be much for a leap from the initial import function that Core made

I beleive the HLSB and VLSB refer to what the driving IC for the screen is expecting - basically just controlling what signals are sent from your Pico. Changing it might yield some odd results (not 100% sure if it would brick the display).

Might be worth jumping into the Arduino examples for some lower-level customisation.

Very keen to see where you go!
Liam

2 Likes

Hi Liam,
Here is an update of my progress.
I haven’t given up on the screen I have and decided to make it a learning tool which is why I bought this stuff in the first place.
I have figured out how to display the Date, Time and the Temperature from the Real Time Clock and display it with the standard text font with the screen in portrait mode.
I came across some strange behavior when trying to optimise my code to refresh the screen a little quicker. My code got quicker but the screen refresh fell apart. I ended up adding a delay to the while loop and reduce it to around 250ms and the attached code now works OK. The clock now updates every 3 seconds.
Pico_ePaper_Code.zip (1.4 MB)
The above pic is how it looks now
Working
The strange part is when I disconnect the power the white part of the screen goes all dotty yet the original demo code doesn’t do that. (pic below)
Dotty

Next I plan to add a battery power supply and read the power levels remaining and display that as well.
power board
Link to the power board
Beyond that I plan to define my own characters rotated 90 deg and draw them using epd.pixel command.
Is 3 seconds the limit of what this screen can do?
Thanks
David

3 Likes

Hi David,

That’s looking awesome!!

Theoretically, the full-screen refresh is quoted at 3 s but a partial refresh is 300ms (I think its only flipping the dots once or twice)

In the demo code it would be completing a partial refresh and hence only powering a single part of the screen.

2 Likes

I’ll see if I can isolate what piece of code is chewing up the 3 seconds.
The static text is only drawn once so I know I’m not accidentally doing a full refresh.
I have added a 250ms delay. Without that the screen can not draw at all.
Only a few characters at the end of each line are drawn.
I’ll also increase the 250ms delay to see if that solves the dotty problem.

2 Likes

I soldered the power shim in place today and now the pico is non responsive. My USB cable has a light on the end of it and now the light goes out when I connect it to the pico. Previously the light stayed on. There is no difference if I connect a lipo battery or not.

I’m pretty sure I didn’t do something stupid like solder the shim on the wrong way around. My solder job is nothing to write home about but I can’t see any bad connections or shorts. Here are a couple of photos.
I hope I haven’t bricked it. Any ideas why this killed it?
Power Shim1
Power Shim2

2 Likes

Hi David,

Awesome progression!

Unfortunately it does look like the LiPo shim is around the wrong way - no such thing as a stupid mistake though, only a learning opportunity!

Im not certain that the Pico would be bricked in this instant, might be worth a desolder and try again?
Here’s a great guide that I’ve used many times:

Keen as ever to see how you go!
Liam.

1 Like

That’s a great demo, I haven’t seen that technique before.
The only problem is those little plastic spacer things are sandwiched between the two boards so I can’t cut and remove them.
I have a solder sucker somewhere perhaps I can remove the solder that way and see if the pico comes back to life.
If not I can get another for $8 :slight_smile:
I also should have read the instructions twice!
I did notice when I assemble it on the multi pack board or if I stack the screen and the RTC together the reset button on the power shim is completely hidden.
When I turn it around the right way the battery connector will be buried.
Will probably need the reset button more often than a battery change but it will make the battery change more difficult.
All good, thanks for letting me off easy :slight_smile:

2 Likes

Hi David

You may be better off with solder wick.
Cheers Bob

2 Likes

Hey David,

I believe the LiPo Shim handles battery charging so you should be good to leave it plugged in, if you need to unplug If you wanna experiment with batteries I’d check out this part: https://core-electronics.com.au/jst-2-pin-extension-cable-with-on-off-switch-jst-ph2.html

2 Likes

Hi Liam,
I couldn’t de-solder the boards in place so i ended up cutting down the middle of them with a hacksaw. now there is a skill i actually have. :slight_smile:


i managed to cut between them without touching either board. I could then remove the remaining pins and solder.
However the Pico is no longer responsive. Either having the power shim on backwards fried it or I simply applied too much heat trying to get them apart. I’m guessing it was the heat.
I’ll order another one of each and continue once they arrive.
You are correct to say its a learning experience.
De-soldering isn’t much fun :slight_smile:

4 Likes

Hi David,

I’ve gotten a few Pico’s quite hot, I’d say the chip itself was electrically fried from some voltage being injected that wasn’t meant to be there, if you have a DMM I’d check out the LiPo Shim, still might work.

That’s some absolutely incredible hacksaw skills, very tight tolerances and materials with varying hardness.

2 Likes

I’m guessing DMM stands for digital multi meter.
That should give you an idea of my chances of diagnosing the LIPO shim problem. :slight_smile:
I have ordered replacement parts and they should arrive in good time.
Perhaps I’ll use the time on font design.
I do have a DMM and I mostly use it to diagnose car battery problems.
Thanks for the sawing skills compliment!

3 Likes

By the way I looked closely at this pico board with a magnifying glass and could see several bits of solder short circuiting between adjacent pins. I cleaned the board up and it survived no problem. Works fine now.
However I didn’t progress any further with this project. My bad, I’m just distracted with other stuff. The little display is still in my draw and I’m sure it will come back out when I think up a project that needs it :cowboy_hat_face:

2 Likes