Waveshare 2.8inch Touch Display Module for Raspberry Pi Pico 262K Colors 320×240 - ST7789

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
misiek303
Posts: 4
Joined: Tue Nov 16, 2021 4:26 am

Waveshare 2.8inch Touch Display Module for Raspberry Pi Pico 262K Colors 320×240 - ST7789

Post by misiek303 » Tue Nov 16, 2021 4:42 am

So I got this Display and Pico
https://www.amazon.com/gp/product/B094J ... =UTF8&th=1

Then I found this and downloaded the code example for micro python from Wiki page
https://www.waveshare.com/pico-restouch-lcd-2.8.htm
https://www.waveshare.com/wiki/Pico-ResTouch-LCD-2.8

I run in from Thonny and I got this results
https://photos.app.goo.gl/eAabnju1szZXc3HN8

Is this really what this screen can do ?

1. Do you see the dotted vertical lines
2. text with lines
3. Blue box not filled just dashed.

Do you have any experience with this display ? I don't think this dashed graphic has something todo with the resolution, is it crappy st7789 library ?

This is the code in the example:

Code: Select all

from machine import Pin, SPI
import gc

from st7789 import *
SSD = ST7789

pdc = Pin(8, Pin.OUT, value=0)  # Arbitrary pins
pcs = Pin(9, Pin.OUT, value=1)
prst = Pin(15, Pin.OUT, value=1)
pbl = Pin(13, Pin.OUT, value=1)

gc.collect()  # Precaution before instantiating framebuf
# Conservative low baudrate. Can go to 62.5MHz. Depending on wiring.
spi = SPI(1, 30_000_000, sck=Pin(10), mosi=Pin(11), miso=Pin(12))
ssd = SSD(spi, dc=pdc, cs=pcs, rst=prst)

ssd.rect(70, 0, 50, 50, 0xFFFF)
ssd.fill_rect(0, 0, 50, 50, 0xFFFF)
ssd.text('Waveshare Test!', 0, 80, 0xFFFF)
ssd.hline(0, 90, 240, 0xFFFF)
ssd.vline(60, 90, 70, 0xFFFF)
ssd.show()
Any thoughts ? Thank you

tonygo
Posts: 10
Joined: Thu Apr 12, 2018 1:23 pm

Re: Waveshare 2.8inch Touch Display Module for Raspberry Pi Pico 262K Colors 320×240 - ST7789

Post by tonygo » Tue Nov 16, 2021 3:02 pm

I think you will find that the bytearray needed to drive this display is massive and takes up so much of the Pico's RAM that there is little left for program instructions.

I've got the four smallest Waveshare Pico displays 160x80 160 x128 240x240 and 320x240 and the biggest suffers from this problem but the others leave plenty of room for code.
See here:
https://www.instructables.com/WaveShare ... -Pi-Pico-/
and
https://www.instructables.com/WS-Pico-1 ... y-Workout/
https://www.instructables.com/WaveShare ... y-Workout/
https://www.instructables.com/Computer- ... lour-Disp/
https://www.instructables.com/Drawing-F ... -MicroPyt/

Stick to the smaller ones. I also noticed that the code for the touch screen was still a 'work in progress' so avoided the device.

Sorry to bring bad news but the 3 smallest screens are great and I recommend them.

Tony Goodhew

misiek303
Posts: 4
Joined: Tue Nov 16, 2021 4:26 am

Re: Waveshare 2.8inch Touch Display Module for Raspberry Pi Pico 262K Colors 320×240 - ST7789

Post by misiek303 » Tue Nov 16, 2021 3:46 pm

Thanks for the reply. I kind of needs that screen size :(

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

Re: Waveshare 2.8inch Touch Display Module for Raspberry Pi Pico 262K Colors 320×240 - ST7789

Post by pythoncoder » Tue Nov 16, 2021 3:55 pm

In general a 320*240 display on a Pico is feasible, see my ili9341 driver which has supported some quite substantial applications. The "trick" is to use 4-bit color, mapped at runtime to 16 bit through a lookup table. This restricts you to 16 colors but for many GUI applications this is plenty, see this (developed by a user of my GUI)

Image
Peter Hinch
Index to my micropython libraries.

misiek303
Posts: 4
Joined: Tue Nov 16, 2021 4:26 am

Re: Waveshare 2.8inch Touch Display Module for Raspberry Pi Pico 262K Colors 320×240 - ST7789

Post by misiek303 » Tue Nov 16, 2021 4:35 pm

Is hard to believe in this all. You can do it with Arduino UNO and not Pico with a lot more RAM ?
https://github.com/adafruit/TFTLCD-Library


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

Re: Waveshare 2.8inch Touch Display Module for Raspberry Pi Pico 262K Colors 320×240 - ST7789

Post by pythoncoder » Sat Nov 20, 2021 10:26 am

Display drivers vary depending on whether the frame buffer is stored on the host or on the display. Storing it on the host makes for a very simple driver with basic graphics functionality supported in the MicroPython firmware. The cost is RAM, which can be mitigated as I described above.

If the frame buffer is stored on the display, RAM usage is much lower. The graphics primitives may or may not be implemented on the display. Either way, the driver has to interface to them, or implement them using whatever support is provided on the display. I guess Arduino drivers must work this way. With MicroPython you have a choice. The application in the above image is hosted on a Pico with the frame buffer on the host.
Peter Hinch
Index to my micropython libraries.

Achilleas
Posts: 1
Joined: Mon Mar 14, 2022 3:35 pm

Re: Waveshare 2.8inch Touch Display Module for Raspberry Pi Pico 262K Colors 320×240 - ST7789

Post by Achilleas » Mon Mar 14, 2022 3:53 pm

Hello community!
First post!

Although my knowledge is still limited, having been helped by this open community immensely, i felt compelled to make an account now that i've found something i too can help with.
Most people start accounts when they need something but i am not most people!

Dear @misiek303
The display is brilliant and you have suspected it correctly already, although i cannot sentence the ST7789 driver myself, due to limited knowledge, i can verify that i hated the display with it as well !

I have been working on my project for months now with the brilliant plug/play driver by Tony Goodhew which you can find
here
https://www.instructables.com/WaveShare ... -Pi-Pico-/

and here you can watch a video of it.
https://www.youtube.com/watch?v=GHtVo2coA4E


If Pico was not this limited, i would have used his code for the dice throw too, flashing through my project, because i just can't stop looking at it!

If i have any question about the driver, it'd be whether the ST7789 uses less of that limited and precious microcontroller memory than Tony's driver, but honestly i haven't been tampering with it much as it worked so well to worry about it for now.
I have removed all the demos and kept it to the bare functional minimum as i am already pushing my pico.

Even if delayed, I hope this helps and works for you as great too!

I can't make any suggestions on the touch driver, as i haven't even tested it and will not install its pins either as there will be a separate glass over mine.




@pythoncoder thank you for all your help understanding what i have so far, couldn't have done it without your help!

Post Reply