chileflora
Posts: 8
Joined: Tue Mar 19, 2019 9:16 pm

Dual Monitors with 4 Pi

Sun Jul 12, 2020 11:31 pm

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.

User avatar
HermannSW
Posts: 2651
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Dual Monitors with 4 Pi

Sun Jul 12, 2020 11:36 pm

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
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

chileflora
Posts: 8
Joined: Tue Mar 19, 2019 9:16 pm

Re: Dual Monitors with 4 Pi

Sun Jul 12, 2020 11:59 pm

Not sure if it corresponds to my question. Basically, how can you "address" different monitors from python when "drawing"?

cleverca22
Posts: 776
Joined: Sat Aug 18, 2012 2:33 pm

Re: Dual Monitors with 4 Pi

Mon Jul 13, 2020 5:24 am

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

chileflora
Posts: 8
Joined: Tue Mar 19, 2019 9:16 pm

Re: Dual Monitors with 4 Pi

Tue Jul 14, 2020 12:27 am

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

chileflora
Posts: 8
Joined: Tue Mar 19, 2019 9:16 pm

Re: Dual Monitors with 4 Pi

Tue Jul 14, 2020 1:28 am

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...

Return to “Python”