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).
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
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
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.
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!
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
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.
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
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.
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.
Actually when I search my example code this is already specified
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
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!
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
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)
Next I plan to add a battery power supply and read the power levels remaining and display that as well.
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?
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.
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.
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?
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!
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
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
You may be better off with solder wick.
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
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.
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
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.
I’m guessing DMM stands for digital multi meter.
That should give you an idea of my chances of diagnosing the LIPO shim problem.
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!