Hello, I am working on a project with HAT-Mini, which has an integrated display, but I am thinking of placing it inside a case, and the position of the display is a bit awkward and difficult to see. For this reason, I was thinking of adding an external I2C display. I would like to ask if it is possible to have both displays coexist.
Thank you.
The support of multiple displays is a matter of the software. The HAT-Mini uses SPI so an I2C display won’t interfere. That is the technical perspective.
The software side is different: some software libs maintain some higher level objects, in your case e.g. a Display
object or maybe a Canvas
object or something similar related to manipulating the display content. So you have to check if your software supports only a single instance or not.
Thanks @bablokb,
So it’s just a problem with implementing the display management library. I’m using the ST7735 library to manage the display inside the Hat-mini, with these settings:
port=0,
cs=ST7735.BG_SPI_CS_FRONT,
dc=9,
backlight=25,
rotation=270,
spi_speed_hz=4000000
Do you think it is therefore possible to use another display, perhaps with the same chipset, initialised on another port?
Using multiple SPI displays is also no problem from the technical perspective. They can even share the SPI-bus if you take care (you need different CS-pins and you should have pullups on the CS-pins).
This might help
SPI0
GPIO 7, Pin 26, CE1
GPIO 8, Pin 24, CE0
GPIO 9, Pin 21, MISO
GPIO 10, Pin 19, MOSI
GPIO 11, Pin 23, SCLK
SPI1
GPIO 16, Pin 36, CE2
GPIO 17, Pin 11, CE1
GPIO 18, Pin 12, CE0
GPIO 19, Pin 35, MISO
GPIO 20, Pin 38, MOSI
GPIO 21, Pin 40, SCLK
/boot/config.txt
dtparam=spi=on
dtoverlay=spi1-1cs #1 chip select
dtoverlay=spi1-2cs #2 chip select
dtoverlay=spi1-3cs #3 chip select
SCLK - Serial CLocK
CE - Chip Enable (often called Chip Select)
MOSI - Master Out Slave In
MISO - Master In Slave Out
MOMI - Master Out Master In
I have a three LCD setup running Enviro code. I went with SPI1 as it supports 3 CS pins without much fuss code wise.
disp0 = ST7735.ST7735(
port=1,
cs=0,
dc=19,
# backlight=5,
rotation=90,
spi_speed_hz=10000000
)
disp0.begin()
disp1 = ST7735.ST7735(
port=1,
cs=1,
dc=19,
# backlight=6,
rotation=90,
spi_speed_hz=10000000
)
disp1.begin()
disp2 = ST7735.ST7735(
port=1,
cs=2,
dc=19,
# backlight=13,
rotation=90,
spi_speed_hz=10000000
)
disp2.begin()
Wonderful 3 display!
Thank you all for the information.