I want to make a doorsign that shows my status if I am present or absent etc.
I use a Pimoroni Pico LiPo and a Waveshare 5.65 Pico E-Ink Display.
The display is the same as the Inky Impression 5.7 but the WS one is actually ready for a pico.
Has anyone experience in using this combination?
I am new to Micropython and I haven’t figured out how I could display an image on it.
Any suggestions would mean alot to me =)
I haven’t used this board, but looking at things, this looks to be the driver you’ll need, with some example code at the bottom: Pico_ePaper_Code/Pico-ePaper-5.65f.py at main · waveshare/Pico_ePaper_Code · GitHub
class EPD_5in65(framebuf.FrameBuffer):
shows that the driver inherits form the micropython framebuffer, documentation for that is here: framebuf — frame buffer manipulation — MicroPython 1.18 documentation
Hopefully that’ll gie you a good starting point.
Thanks, i will study framebuffer more deeply.
I already figured that out but framebuffer does not seem to give a handy solution for drawing images. I tried to use the picodisplay on this one, but it draws not correctly because the height and width is fixed for the pimoroni pico displays.
Are you trying to load an image, or just draw shapes? For points, lines and rectangles framebuffer has:
FrameBuffer.pixel(x, y[, c])
FrameBuffer.line(x1, y1, x2, y2, c)
FrameBuffer.rect(x, y, w, h, c)
FrameBuffer.fill_rect(x, y, w, h, c)
There’s some code here for loading imaged into a byte array, loading that into a frame buffer, and then using blit(buf, x,y)
: Displaying images on OLED screens
Thank you for your post. I got some time again to try it.
I am able to display one of those sample pbm files.
But when i want to display a ppm and try to use the lines:
with open('alanbunt.ppm', 'rb') as f:
f.readline() # Magic number
f.readline() # Creator comment
f.readline() # Dimensions
f.readline() # Max value, 255
data = bytearray(f.read())
It says for the data line:
MemoryError: memory allocation failed, allocating 24576 bytes
But how can this bee too much the pico, especially the 16MB version?
It’s the 264kB of SRAM that’s run out of space, not the onboard flash memory.
Sorry if this might be stupid, but I don’t get how the 264kb can be full with only 25kb he is trying to allocate?
It depends on what else is using that 264kB. The framebuffer can use up a lot of space.
I’ve seen that error and it’s my understanding that it refers to the 264kB of SRAM.
Posting the full code being used will likely help.
Well, this is the only relevant code:
display = EPD_5in65()
display.fill(0x01)
with open('alanbunt.ppm', 'rb') as f:
f.readline() # Magic number
f.readline() # Creator comment
f.readline() # Dimensions
f.readline() # Max value, 255
data = bytearray(f.read())
for x in range(128):
for y in range(78):
c = data[x + y * 120]
display.pixel(x, y, 1 if c == 255 else 0)
display.EPD_5IN65F_Display(display.buffer)
display.delay_ms(500)
display.Sleep()
And the code for EPD_5in65 ist used from one of the former posts
Thanks for posting the code. Unfortunately I’m not familiar with it, and don’t understand it.
I’ve been using the Pico Display Packs and the Breakout Garden Color LCD’s. So far just text, and some minimal graphics.