Page 1 of 1

Dual Monitors with 4 Pi

Posted: Sun Jul 12, 2020 11:31 pm
by chileflora
I have developped a program in python using pigame module which runs fine (on RPi 3).

I recently bought a RPi 4 mainly due to its two HDMI ports, but so far I was not able to find an answer of how to do it.

Question: Is it possible to display different graphic screens on two monitors from the same RPi 4 from Python?

Initially I had thought of using different Pis, and it is very easy to interconnect them, except for the keyboard/mouse issue. Rpi 4 with two HDMI would solve this issue, but I do not see a way of addressing two monitors.

Re: Dual Monitors with 4 Pi

Posted: Sun Jul 12, 2020 11:36 pm
by HermannSW
I don't know pygame, but you can display screens on different displays with python.
Below you can see duplicate camera preview windows (with help from splitter) showing up on two monitors:
viewtopic.php?p=1582997#p1582997
Image

Re: Dual Monitors with 4 Pi

Posted: Sun Jul 12, 2020 11:59 pm
by chileflora
Not sure if it corresponds to my question. Basically, how can you "address" different monitors from python when "drawing"?

Re: Dual Monitors with 4 Pi

Posted: Mon Jul 13, 2020 5:24 am
by cleverca22
viewtopic.php?f=91&t=279826&p=1695221&h ... s#p1695221

this thread explains how to get the 2 displays to show up as either 2 framebuffers or 2 outputs in DRM/KMS

Re: Dual Monitors with 4 Pi

Posted: Tue Jul 14, 2020 12:27 am
by chileflora
I looked at the link provided, but from what I could gather, it applies only to X raspbian. X raspbian seems to be much more resources intensive, and the objective of my python program is to run as a stand-alone application without any user interaction with the anything but the program.

I am not sure what real difference it would make switching from standard raspbian (version 10) to X in terms of stability and robustness. I defintively do not want any windows-like issues, like delays for swapping, or worse... like blue screen...

The python program I am running now has about 6000 lines of code, and what it does is reading inputs from joystick/buttons, generates SBUS stream, communicates with antenna tracker unit, etc. etc. and generates a screen for UAV instrumentation (like all flight parameters). The timing is not extremely critical (0.1 - 0.2 seconds), but not much more than that (if it hangs for more than 0.5 seconds, that would be a big deal!) The screen is generated in pygame, and there is also menu driven through tkinter.

What I want to implement is a secondary display for navigation (based basically on GDEM data with elevations).

Is it really feasable with one RPi4, or is it safer to have two separate RPis with two separate screens? Two RPi have the problem of having two mouses and two keyboards, and that is the main reason why I want one RPi doing it all on, but displaying on two monitors



Image
Image

Re: Dual Monitors with 4 Pi

Posted: Tue Jul 14, 2020 1:28 am
by chileflora
I think I solved it... Was really stupid of me:

It is very easy:
I checked the config.txt,

max_framebuffers=2 was uncommented
I uncommented:
dtoverlay=vc4-fkms-v3d

Then, using screen layout option from GUI I moved HDMI 2 under the HDMI 1,

After that I tried setting display size in pygame to y=1600 and it ran across both monitors! So issue solved...