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.

    MagicMirror on Pi Zero W

    Scheduled Pinned Locked Moved Tutorials
    46 Posts 19 Posters 63.1k Views 21 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.
    • rootsudoR Offline
      rootsudo
      last edited by yawns

      How to install MagicMirror on Pi Zero W

      This guide is not my own and the information provided came from many contributors: @evos, @Wieber, & @randombullet. I spent the past 24 hours playing with my new pi and this is what worked for me.

      I built my pi using a windows 10 machine.

      Tested 3.14

      The Beginnings:

      1. Download Jessie Lite and use Win32DiskImager to write img to SD card (8GB card recommended)
      2. Boot SD card and verify you can login
      3. Create wpa_supplicant.conf via windows text editor and plug SD back into windows machine
      network={
         ssid="NAME_OF_WIFI_AP"
         psk="WIFI_PASSWORD"
      }
      
      1. Place wpa_supplicant.conf in Boot folder of SD card
      2. Boot SD card and login
      3. Enable SSH: sudo raspi-config -> Select Interfacing Options -> select SSH -> select Enable -> select Finish

      You are now ready to connect to your pi via Putty. Please do so for the next portion.

      The fun parts:

      1. sudo wget http://node-arm.herokuapp.com/node_latest_armhf.deb
      2. sudo dpkg -i node_latest_armhf.deb
      3. sudo apt-get install npm
      4. sudo apt-get install git
      5. cd /home/pi/
      6. git clone https://github.com/MichMich/MagicMirror
      7. cd MagicMirror
      8. sudo npm install #This will take a LONG time, expect 30 minutes
      9. sudo apt-get install midori
      10. sudo apt-get install unclutter
      11. sudo aptitude install xinit
      12. sudo apt-get install matchbox
      13. sudo raspi-config -> Boot Options -> B1 Desktop/CLI -> B2 Console Autologin
      14. sudo nano /home/pi/start.sh
      #! /bin/bash
      cd /home/pi/MagicMirror
      node serveronly &
      sleep 45
      sudo xinit /home/pi/startMidori.sh
      

      15 Control + x > Y > Return
      16 sudo chmod a+x /home/pi/start.sh
      17 sudo mv /home/pi/start.sh /etc/init.d/startMagicMirror.sh
      18 sudo update-rc.d startMagicMirror.sh defaults 100
      19 sudo apt-get install x11-xserver-utils
      20 sudo nano /home/pi/startMidori.sh

      #!/bin/sh
      xset -dpms # disable DPMS (Energy Star) features.
      xset s off # disable screen saver
      xset s noblank # don’t blank the video device
      matchbox-window-manager &
      unclutter &
      midori -e Fullscreen -a http://localhost:8080
      

      21 Control + x > Y > Return
      22 sudo nano /boot/config.txt

      disable_overscan=1
      framebuffer_width=1050 #match your res
      framebuffer_height=1680 #match your res
      framebuffer_depth=32
      framebuffer_ignore_alpha=1
      hdmi_pixel_encoding=1
      hdmi_group=2
      display_rotate=1
      

      23 Control + x > Y > Return
      24 sudo reboot

      Congrats, your pi should now boot to MagicMirror. To configure your modules please follow the ‘Readme’ on the Github: https://github.com/MichMich/MagicMirror

      Source - https://forum.magicmirror.builders/topic/1183/how-i-got-my-magic-mirror-working-on-a-raspberry-pi-0-zero/2

      I actually got it to working just hours ago, on Pi Day!

      markbajajM G P 3 Replies Last reply Reply Quote 6
      • R Offline
        rmd6502
        last edited by

        Nice and thorough tutorial!
        I followed most of it, but got off the train at Midori since I already had chromium-browser installed on my pi.
        What I did instead was modify package.json to add a serveronly script thusly:

          "scripts": {
            "start": "electron js/electron.js",
            "serveronly": "node serveronly"
          },
        

        then modified serveronly/index.js to kick off chrome thusly:

        const spawn = require('child_process').spawn
        ...
        console.log("Ready to go! Please point your browser to: http://" + bindAddress + ":" + config.port);
                process.env.DISPLAY=':0.0'
                var browser = spawn('chromium-browser',['http://localhost:8080', '--kiosk', '--incognito'])
        

        Without --incognito I would get an annoying popup from Chrome telling me it didn’t shut down cleanly, and would I like to restore my window configuration.
        I then added

        su - pi -c "cd /home/pi/Documents/MagicMirror && PATH=/usr/local/bin:${PATH} && /usr/local/bin/npm run serveronly" &
        

        to /etc/rc.local (how’s that for lazy?)
        Anyway, HTH

        1 Reply Last reply Reply Quote 1
        • MitchfarinoM Offline
          Mitchfarino Module Developer
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • MitchfarinoM Offline
            Mitchfarino Module Developer
            last edited by

            Thanks for posting this, I’ve followed it through my Pi Zero (not the W)

            The minute I try and add any kind of config, I just get a blank screen. Is there something I am missing?

            I just tried it with the clock module, and it doesn’t give me anything.

            If I corrupt the config file in any way, I get the standard error message saying to create a config.js file.

            Do you have any idea what my issue could be?

            H 1 Reply Last reply Reply Quote 0
            • H Offline
              Hawking @Mitchfarino
              last edited by Hawking

              @Mitchfarino
              I’m using the Zero W but have exactly the same problem (just a blank screen).
              I found that the clock module gives me frequent errors in /var/log/daemon.log (complaining about missing “moment”, similar to my post here) do you get these as well?
              However also most of the other modules don’t work for me. What worked for me was to remove all default modules from the config file and just use the very simple “halloworld” module

              {
                              module: "helloworld",
                              position: "top_bar",
                              config: {
                                      text: "Hello world!"
                              }
                }
              

              Then I got at least some text on my empty screen and knew that in principle MM was working. I also could get the externally installed MMM-Globe and MMM-SystemStats running.
              But of course it would be good to get the default modules running…

              I also got this empty page if I requested the website from my regular PC using Firefox, so I think it is not related to a shortcoming of the midori browser.

              I tried Jessie and Jessie Light and different versions of node.js/npm. During the npm install step I get several errors/warnings, however some people said that some of these are normal…

              I 1 Reply Last reply Reply Quote 0
              • I Offline
                Iseknutz @Hawking
                last edited by

                @Hawking @Mitchfarino
                I have the same problem too. I have set up the MM2 on Pi Zero W, everything looks good, but only the modules “helloworld” and “alert” are working. If I try to use the clock module I got a blank, black screen.
                Did you solve the problem? Maybe the other modules use any functions that the Pi Zero don’t understand…?

                1 Reply Last reply Reply Quote 0
                • M Offline
                  McSorley
                  last edited by

                  Wish I found this earlier! Spent a few days trying to get it running myself using docker but failed at every turn.

                  I will give this a run through later today and report back my findings.

                  1 Reply Last reply Reply Quote 0
                  • B Offline
                    blueeyed1
                    last edited by

                    I have same problem, too. Any idea of solution?

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Hawking
                      last edited by Hawking

                      @Iseknutz said in MagicMirror on Pi Zero W:

                      Did you solve the problem? Maybe the other modules use any functions that the Pi Zero don’t understand…?

                      No, I didn’t solve the problem yet.
                      I found out that the working modules (helloworld and alert) don’t use the “moment” js library but the modules that result in a blank screen (calendar, clock, compliments, newsfeed and weatherforcast) do. As the error in my /var/log/daemon also contains “ReferenceError: Can’t find variable: moment” I think it is likely that something went wrong in installation of (the moment.js library of) node. And indeed, the installation with

                      sudo npm install
                      

                      gave some warnings and errors in my case. As only the Pi Zeros seem to be concerned it must be something due to our “special” installation. The Pi Zero needs a special (ARM) node variant. The version one gets via

                      sudo wget http://node-arm.herokuapp.com/node_latest_armhf.deb
                      sudo dpkg -i node_latest_armhf.deb
                      

                      is quite old (version 4.2.1; the regular installer of MM2 updates nodes to version 6 if the version of node is below 5.1.0 and in an other thread somebody reported that version 7 is working for a regular Pi as well) However, I also tried to use version 6 and 7, but the result was still a blank screen.
                      I also get this blank screen if I access the provided data via network using Firefox of a regular PC, so I think it is not related to some issues with the midori browser.

                      But I’m not not at all an expert in this issue, so I might have done something wrong or it could be an other reason (the working modules are also in other ways simpler than the other ones). I would be happy if somebody could tell us how to solve this issue.

                      strawberry 3.141S MitchfarinoM 2 Replies Last reply Reply Quote 0
                      • strawberry 3.141S Offline
                        strawberry 3.141 Project Sponsor Module Developer @Hawking
                        last edited by

                        @Hawking you should check if moment weas installed properly it sits in the vendor directory in node_modules, if it isnt there run npm install in the vendor directory

                        Please create a github issue if you need help, so I can keep track

                        H 1 Reply Last reply Reply Quote 0
                        • MitchfarinoM Offline
                          Mitchfarino Module Developer @Hawking
                          last edited by

                          @Hawking

                          I saw errors stating that MM requires a higher version of node, but I couldn’t figure out how to do it.

                          Could you provide the command you used? Then I’ll try it on mine too and will feed back

                          1 Reply Last reply Reply Quote 0
                          • M Offline
                            McSorley
                            last edited by

                            I am getting an issue with sudo npm install getting the following error.

                            npm WARN cannot run in wd magicmirror@2.1.1 cd vendor && npm install (wd=/home/pi/MagicMirror)
                            npm WARN cannot run in wd magicmirror@2.1.1 sh installers/postinstall/postinstall.sh (wd=/home/pi/MagicMirror)
                            
                            strawberry 3.141S 1 Reply Last reply Reply Quote 0
                            • strawberry 3.141S Offline
                              strawberry 3.141 Project Sponsor Module Developer @McSorley
                              last edited by

                              @McSorley try npm install --unsafe-perm

                              Please create a github issue if you need help, so I can keep track

                              1 Reply Last reply Reply Quote 0
                              • MitchfarinoM Offline
                                Mitchfarino Module Developer
                                last edited by

                                I think if someone can get this up and running, they should host the image somewhere for people to download.

                                Don’t load any modules, just go with the default.

                                Then people can install the ones that they need.

                                1 Reply Last reply Reply Quote 0
                                • H Offline
                                  Hawking @strawberry 3.141
                                  last edited by Hawking

                                  @strawberry-3.141 said in MagicMirror on Pi Zero W:

                                  @Hawking you should check if moment weas installed properly it sits in the vendor directory in node_modules, if it isnt there run npm install in the vendor directory

                                  With “vendor directory” you refer to “~/MagicMirror”?
                                  I have a folder
                                  /home/pi/MagicMirror/node_modules/moment with several files (including moment.js) and subfolders. Is this enough indication for a proper installation or should I check other details?

                                  @Mitchfarino said in MagicMirror on Pi Zero W:

                                  @Hawking

                                  I saw errors stating that MM requires a higher version of node, but I couldn’t figure out how to do it.

                                  Could you provide the command you used? Then I’ll try it on mine too and will feed back

                                  Yes, I got the same error/warnings, that’s why I tried to use a more recent version of node. I used the scripts available here
                                  https://github.com/sdesalas/node-pi-zero
                                  I tested it for v6 (don’t remember which subversion) and v7.7.1. Both was without success (no error/warning about old node version, instead other issues and finally still a blank screen). But maybe I made something wrong. Please try your self and let us know about the results (and post the error you get, I don’t remember them in detail).

                                  @Mitchfarino said in MagicMirror on Pi Zero W:

                                  I think if someone can get this up and running, they should host the image somewhere for people to download.

                                  I would strongly prefer to know the commands that worked. An image is a huge file that gets outdated (replacement of jessie…), has to be stored on some external server (the free one are usually slow…) The commands on the other hand are hopefully only a small modification of the tutorial writen above, can easily be used and even adapted more easy.

                                  strawberry 3.141S 1 Reply Last reply Reply Quote 0
                                  • strawberry 3.141S Offline
                                    strawberry 3.141 Project Sponsor Module Developer @Hawking
                                    last edited by

                                    @Hawking said in MagicMirror on Pi Zero W:

                                    /home/pi/MagicMirror/node_modules/moment

                                    it should look like this /home/pi/MagicMirror/vendor/node_modules/moment do you have a package.json file in /home/pi/MagicMirror/vendor?

                                    Please create a github issue if you need help, so I can keep track

                                    1 Reply Last reply Reply Quote 1
                                    • H Offline
                                      Hawking
                                      last edited by

                                      @strawberry-3.141 said in MagicMirror on Pi Zero W:

                                      @Hawking said in MagicMirror on Pi Zero W:

                                      /home/pi/MagicMirror/node_modules/moment

                                      it should look like this /home/pi/MagicMirror/vendor/node_modules/moment do you have a package.json file in /home/pi/MagicMirror/vendor?

                                      I have a directory /home/pi/MagicMirror/vendor containing
                                      package.json and vendor.js but noting more.

                                      I now used npn version 2.14.7 (checked by npm -version) to

                                      cd ~/MagicMirror/vendor
                                      npm install
                                      

                                      This gave

                                      npm WARN package.json magicmirror-vendors@ No README data
                                      font-awesome@4.7.0 node_modules/font-awesome
                                      moment-timezone@0.5.13 node_modules/moment-timezone
                                      weathericons@2.1.0 node_modules/weathericons
                                      moment@2.18.1 node_modules/moment
                                      

                                      and the folder /home/pi/MagicMirror/vendor/node_modules/moment that you mentioned before was created.
                                      I then rebootet (not sure if necessary) and it seems to work (I see the date and time, holidays,quote…). I’ll now set everything up but it looks way better then before.
                                      So thanks a lot for your help!! I hope that your fix also works for the other people who have the same problem.

                                      Just to understand the fix a bit better:
                                      Is there a reason that one seem to have to do run
                                      sudo npm install once in /home/pi/MagicMirror/ (this is already included in the initial post) and once npm install in /home/pi/MagicMirror/vendor/? (this is not mentioned in the initial post and also not directly done by the standard installer (that does not work for the pi-Zero) located in /home/pi/MagicMirror/installers/raspberry.sh (at least I don’t see it therein).

                                      strawberry 3.141S 1 Reply Last reply Reply Quote 1
                                      • strawberry 3.141S Offline
                                        strawberry 3.141 Project Sponsor Module Developer @Hawking
                                        last edited by strawberry 3.141

                                        @Hawking the command npm install in the directory /home/pi/MagicMirror/ has a hook in the package.json file which automatically runs npm install in /home/pi/MagicMirror/vendor as well, so there is no need to mention this because it’s done automatically ;)

                                        Please create a github issue if you need help, so I can keep track

                                        H 1 Reply Last reply Reply Quote 0
                                        • H Offline
                                          Hawking @strawberry 3.141
                                          last edited by Hawking

                                          I now did a installation on a fresh image and used node version 6.6.1 which automatically includes npm 3.10.8. So instead of

                                          sudo wget http://node-arm.herokuapp.com/node_latest_armhf.deb
                                          sudo dpkg -i node_latest_armhf.deb
                                          sudo apt-get install npm
                                          

                                          I did

                                          wget -O - https://raw.githubusercontent.com/sdesalas/node-pi-zero/master/install-node-v6.9.1.sh | bash
                                          

                                          Then I got later on no warnings about to old or insecure version any more but just

                                          npm WARN prefer global coffee-script@1.10.0 should be installed with -g
                                          npm WARN prefer global jsonlint@1.6.2 should be installed with -g
                                          npm WARN prefer global colorguard@1.2.0 should be installed with -g
                                          
                                          > electron-chromedriver@1.6.0 install /home/hawking/MagicMirror/node_modules/electron-chromedriver
                                          > node ./download-chromedriver.js
                                          
                                          
                                          > electron@1.6.5 postinstall /home/hawking/MagicMirror/node_modules/electron
                                          > node install.js
                                          
                                          npm WARN lifecycle magicmirror@2.1.1~install: cannot run in wd %s %s (wd=%s) magicmirror@2.1.1 cd vendor && npm install /home/hawking/MagicMirror
                                          npm WARN lifecycle magicmirror@2.1.1~postinstall: cannot run in wd %s %s (wd=%s) magicmirror@2.1.1 sh installers/postinstall/postinstall.sh /home/hawking/MagicMirror
                                          

                                          (in this installation I did not use the pi user, but I had the same problem when I used the default pi user).

                                          If one knows the solution for the blank screen it is obvious that this is a strong hint that one should run

                                          cd ~/MagicMirror/vendor/ && npm install 
                                          cd ~/MagicMirror/ && sh installers/postinstall/postinstall.sh 
                                          

                                          (the later at the moment just prints a success message and is therefore not really needed)
                                          I don’t know why these commands did not work automatically, maybe an issue with some directories that are not set (I assume in the error instead of %s the directory should be displayed).

                                          MitchfarinoM 1 Reply Last reply Reply Quote 0
                                          • I Offline
                                            Iseknutz
                                            last edited by

                                            I installed the image from https://forum.magicmirror.builders/topic/1183/how-i-got-my-magic-mirror-working-on-a-raspberry-pi-0-zero/84 , updated the System to use the onboard wifi and this works for me.

                                            kylelmartinK 2 Replies 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
                                            • 1 / 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