MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Rpi 4 and two monitors

    Scheduled Pinned Locked Moved Hardware
    60 Posts 6 Posters 34.7k Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Do not disturb
      sdetweil @NathTheDude
      last edited by

      @NathTheDude how about the output of xrandr -q

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      N 1 Reply Last reply Reply Quote 0
      • N Offline
        NathTheDude @sdetweil
        last edited by

        @sdetweil . I get the following when trying to run different xrandr commands:

        Can't open display
        
        1 Reply Last reply Reply Quote 0
        • N Offline
          NathTheDude
          last edited by

          @sdetweil - ahhh. I need to do this from the desktop:

          pi@MagicMirrors:~ $ xrandr -q
          Screen 0: minimum 320 x 200, current 2160 x 1920, maximum 7680 x 7680
          HDMI-1 connected primary 1080x1920+0+0 left (normal left inverted right x axis y axis) 477mm x 268mm
             1920x1080     60.00*+  60.00    50.00    59.94  
             1680x1050     59.88  
             1280x1024     75.02    60.02  
             1440x900      59.90  
             1280x960      60.00  
             1280x720      60.00    60.00    50.00    59.94  
             1024x768      75.03    70.07    60.00  
             832x624       74.55  
             800x600       72.19    75.00    60.32    56.25  
             720x576       50.00    50.00    50.00  
             720x480       60.00    60.00    59.94    59.94    59.94  
             640x480       75.00    72.81    66.67    60.00    59.94    59.94  
             720x400       70.08  
          HDMI-2 connected 1080x1920+1080+0 right (normal left inverted right x axis y axis) 477mm x 268mm
             1920x1080     60.00*+  60.00    50.00    59.94  
             1680x1050     59.88  
             1280x1024     75.02    60.02  
             1440x900      59.90  
             1280x960      60.00  
             1280x720      60.00    60.00    50.00    59.94  
             1024x768      75.03    70.07    60.00  
             832x624       74.55  
             800x600       72.19    75.00    60.32    56.25  
             720x576       50.00    50.00    50.00  
             720x480       60.00    60.00    59.94    59.94    59.94  
             640x480       75.00    72.81    66.67    60.00    59.94    59.94  
             720x400       70.08  
          pi@MagicMirrors:~ $ 
          
          S 1 Reply Last reply Reply Quote 0
          • S Do not disturb
            sdetweil @NathTheDude
            last edited by

            @NathTheDude ok, I can see the same results now that I have my adapter…

            may have to wait til tomorrow to work on it…

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • N Offline
              NathTheDude
              last edited by NathTheDude

              Hey @sdetweil , no problem at all - no rush indeed. Thank you for your help thus far.

              So thanks to this page I have been able to run up two chromiums, one on each page but I have started up chromium directly via terminal from the desktop. Not quite figured out how to implement this as two MM’s and if running up two at once would kill the CPU.

              raspberrypi.org forum post

              1st terminal session

              DISPLAY=:0 /usr/bin/chromium-browser \
              --noerrdialogs \
              --kiosk \
              --window-position=0,0 \
              --start-fullscreen \
              --user-data-dir=Default
              

              2nd terminal session

              DISPLAY=:0 /usr/bin/chromium-browser \
              --noerrdialogs \
              --kiosk \
              --window-position=1920,0 \
              --start-fullscreen \
              --user-data-dir=‘Test2’
              
              S 1 Reply Last reply Reply Quote 0
              • S Do not disturb
                sdetweil @NathTheDude
                last edited by sdetweil

                @NathTheDude copy one MM folder tree to MagicMirror1

                then change the config on MM1 to use a different port (8081 maybe)

                then start both MM in serverOnly mode (u can set that in config.js too, serverOnly: true,

                then launch your two browsers, with the url pointing to separate MM’s…
                –app=http://localhost:MM_port,
                –app=http://localhost:MM1_port

                you can edit the run-start.sh on MM1 to add the

                --window-position=1920,0 \
                --user-data-dir=‘Test2’
                

                parms to the ones already provided

                then change both MM configs to serverOnly: “local”,
                and it will launch the chrome browser for you
                (this is what we call split mode, using a separate browser)

                then u can have pm2 start both of those when the system boots…
                have to change the mm.sh in MM1/installers, and maybe the json file title to MagicMirror1, and point to the local mm.sh

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 1
                • N Offline
                  NathTheDude
                  last edited by NathTheDude

                  Hey @sdetweil , thanks for the info on this - I am grateful.

                  I think I am nearly there but just missing a bit or two.

                  I copied the ‘MagicMirror’ to ‘MagicMirror2’ folder, updated the config.js, run-start.sh and the pm2_MagicMirror.json files.

                  When I reboot I now get MM and MM2 load up but both on the same screen.

                  I have messed around with the chromium line from the ‘run-start.sh’ and I don’t think it is actually be used in this case, I even commented the line out and this did not prevent me from running ‘npm start’ and MM2 still loaded albeit on top of the first MM.

                  Any ideas on where it is getting it’s info on how to start up chromium?

                  Thanks

                  Nathan

                  S 1 Reply Last reply Reply Quote 0
                  • S Do not disturb
                    sdetweil @NathTheDude
                    last edited by sdetweil

                    @NathTheDude sorry. I left out the pm2 steps

                    From mm2 folder do

                    pm2 start installers/pm2???.json
                    pm2 save
                    

                    Where the json file is the one u modified.

                    It should start the second mirror app.

                    The only difference is that window-positio info. And on reboot

                    pm2 status should show both.

                    Can u show the two chromium browser lines?

                    I will attempt to recreate here

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • N Offline
                      NathTheDude
                      last edited by NathTheDude

                      Hey @sdetweil , after looking at how the current MM is setup with pm2 (pm2 show MagicMirror) this had the ‘mm.sh’ as the target.

                      Within the MM2 folder I ran: ‘pm2 start ./installers/mm.sh --name MagicMirror2’ which started the MM2 but on the first screen. Then used pm2 save.

                      I just setup pm2 with the .json file instead of the mm.sh file and the results seem to be the same from what i can see with it getting displayed on the first screen.

                      Within the start-run.sh, I can comment out the chromium line and and it will not break anything which makes me think this line is not being referenced.

                      MM line:

                      chromium-browser --noerrdialogs --kiosk --user-data-dir='Default' --window-position=0,0 --disable-infobars --app=http://localhost:$port  --ignore-certificate-errors-spki-list --ignore-ssl-errors --ignore-certificate-errors 2>/dev/null
                      

                      MM2 line:

                      chromium-browser --noerrdialogs --kiosk  --disable-infobars --app=http://localhost:8082 --ignore-certificate-errors-spki-list --ignore-ssl-errors --ignore-certificate-errors --window-postion=1920,0 --user-data-dir='Test2' 2>/dev/null
                      
                      S 2 Replies Last reply Reply Quote 0
                      • S Do not disturb
                        sdetweil @NathTheDude
                        last edited by

                        @NathTheDude if u start the json file, pm2 reads the info, gives u a nice name etc.

                        pm2 delete 0 or 1
                        pm2 save

                        Then pm2 start the json file.
                        And pm2 save
                        To save for reboot

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        1 Reply Last reply Reply Quote 0
                        • S Do not disturb
                          sdetweil @NathTheDude
                          last edited by

                          @NathTheDude

                          I was able to recreate the problem, and good news its just a typo

                          --window-postion=1920,0
                          

                          should be

                          --window-position=1920,0
                          

                          missing i in position

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

                          1 Reply Last reply Reply Quote 0
                          • N Offline
                            NathTheDude
                            last edited by

                            @sdetweil

                            Thank you for this although it is still producing 2 x MM’s on the first screen (MM and MM2), not sure what could be wrong. If you have it working it obviously must me something I have done wrong…hmmmmm.

                            I will review all the files and let you know if I find anything.

                            1 Reply Last reply Reply Quote 0
                            • N Offline
                              NathTheDude
                              last edited by

                              @sdetweil . I know it is a bit extreme but thought I would just start again and burn another image to the SD card. I am in the same position though

                              • burnt image to sd card, booted rpi and did an update, enabled SSH and VNC
                              • installed MM with your automation script
                              • copied the ‘MagicMirror’ Folder to ‘MagicMirror2’, in the new folder I updated:
                                – config.js - just updated port to 8082
                                – run-start.sh - updated with window position and profile
                                – mm.sh - new location
                                – pm2_MagicMirror.json - updated with new locations
                              • within the MagicMirror2 folder,
                                – pm2 start ./installers/pm2_MagicMirror.json
                                – pm2 save
                              • This then started another MM from the MM2 folder on to screen 1
                              • htop confirms that processes are running from both MagicMirror and MagicMirror2
                              • pm2 status confirms that both are up

                              In your setup, if you update the chromium line within run-start.sh with bad entries does that break your setup. Does not seem to be running this command from what I can see in my setup

                              1 Reply Last reply Reply Quote 0
                              • S Do not disturb
                                sdetweil
                                last edited by sdetweil

                                well, I finally got it to work , note I have two displays that support 4k, 3840x2160, so my screen pos is double yours

                                in /boot/config.txt

                                [pi4]
                                # Enable DRM VC4 V3D driver on top of the dispmanx display stack
                                dtoverlay=vc4-fkms-v3d
                                max_framebuffers=4
                                

                                and in /boot/cmdline.txt
                                add cma=384M to the end of the line, like this…

                                plymouth.ignore-serial-consoles cma=384M
                                

                                then you must power down and back up for these changes to be applied

                                found here
                                https://retropie.org.uk/forum/topic/24436/drm_ioctl_mode_create_dumb-failed-cannot-allocate-memory/9

                                I was getting the DRM cannot allocate memory error

                                MagicMirror/run-start.sh line for chromium

                                chromium-browser -noerrdialogs -kiosk --user-data-dir='Default' --window-position=0,0 -start_maximized  --disable-infobars --app=http://localhost:$port  --ignore-certificate-errors-spki-list --ignore-ssl-errors --ignore-certificate-errors 2>/dev/null
                                

                                MagicMirror2/run-start.sh line for chromium

                                chromium-browser --disable-bundled-ppapi-flash -noerrdialogs -kiosk -start_maximized  --window-position="3840,0" --disable-infobars --app=http://localhost:$port  --ignore-certificate-errors-spki-list --ignore-ssl-errors --ignore-certificate-errors  --user-data-dir='Test2'  # 2>/dev/null
                                

                                this boots up and both MM start via pm2 and display on separate screens, with different content (modules in different positions)

                                here is a screenshot of my dev system connected to both MM servers at the same time
                                (the displays are two hdmi ports on the same TV, so I can’t show them physically at the same time)
                                alt text

                                Sam

                                How to add modules

                                learning how to use browser developers window for css changes

                                1 Reply Last reply Reply Quote 1
                                • N Offline
                                  NathTheDude
                                  last edited by

                                  @sdetweil - nice 2 x 4k’s.

                                  So, I did what you mentioned in your last post but unfortunetly I am in the same issue. I wonder if your problem was more to do with 2 x 4k’s which is perhaps different to mine? I am not sure.

                                  1 Reply Last reply Reply Quote 0
                                  • N Offline
                                    NathTheDude
                                    last edited by

                                    @sdetweil - if you comment out the chromium line in the run-start.sh does this cause you any issues/errors?

                                    S 2 Replies Last reply Reply Quote 0
                                    • S Do not disturb
                                      sdetweil @NathTheDude
                                      last edited by

                                      @NathTheDude no… you could just change config.js to serverOnly:true, then it won’t try to start chrome

                                      Sam

                                      How to add modules

                                      learning how to use browser developers window for css changes

                                      1 Reply Last reply Reply Quote 0
                                      • S Do not disturb
                                        sdetweil @NathTheDude
                                        last edited by sdetweil

                                        @NathTheDude I started by doing

                                        cd MagicMirror
                                        node serveronly 
                                        

                                        note no npm start needed, will run til you ctrl-break out

                                        then tried multiple tries to get chrome on the second display…
                                        (it works manually if the position is mispelled!)

                                        then once it worked reliably,
                                        i killed the server instance
                                        then I used pm2 to stop/start that instance til I got that to work.

                                        note that I had to use
                                        –disable-bundled-ppapi-flash
                                        on the second instance as it collided with the 1st…

                                        Sam

                                        How to add modules

                                        learning how to use browser developers window for css changes

                                        K 1 Reply Last reply Reply Quote 0
                                        • K Offline
                                          krocaq @sdetweil
                                          last edited by

                                          @sdetweil

                                          @saljoke
                                          Hi. Thats right. i only use 1 Pi4 to serve both displays via 2 MM instances. first the originally MagicMirror directory and the second in a MagicMirror2 directory. Both powered up via PM2 and turned off and on via PIR sensor.

                                          The config looks like this:

                                          language: “de”,
                                          logLevel: [“INFO”, “LOG”, “WARN”, “ERROR”],
                                          timeFormat: 24,
                                          units: “metric”,
                                          electronOptions: {fullscreen:true, x:1920},

                                          1920 is the resolution witdh of the main display.

                                          Very easy to handle and good for the electrical consumption

                                          S 1 Reply Last reply Reply Quote 0
                                          • S Do not disturb
                                            sdetweil @krocaq
                                            last edited by sdetweil

                                            @krocaq see my comment here , you can do it with ONE directory
                                            https://forum.magicmirror.builders/topic/17239/two-display/2?_=1663555322286

                                            Sam

                                            How to add modules

                                            learning how to use browser developers window for css changes

                                            1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 3 / 3
                                            • First post
                                              Last post
                                            Enjoying MagicMirror? Please consider a donation!
                                            MagicMirror created by Michael Teeuw.
                                            Forum managed by Sam, technical setup by Karsten.
                                            This forum is using NodeBB as its core | Contributors
                                            Contact | Privacy Policy