User Tools

Site Tools


raspberry_magic_mirror

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
raspberry_magic_mirror [2020/01/25 20:11] – created herwarthraspberry_magic_mirror [2024/04/19 12:38] (current) herwarth
Line 1: Line 1:
-====== Raspberry as Magic Mirror ======+====== Raspberry Pi 4 as Magic Mirror ======
 =====Prerequisites===== =====Prerequisites=====
 Use the Kiosk howto to install a R/O Kiosk. Magic Mirror software runs from the home directory of the user and can only be R/W. I used a USB SSD connected to the USB3 port of the Raspberry Pie 4. Use the Kiosk howto to install a R/O Kiosk. Magic Mirror software runs from the home directory of the user and can only be R/W. I used a USB SSD connected to the USB3 port of the Raspberry Pie 4.
Line 21: Line 21:
 tmpfs                 /var/run           tmpfs   defaults,noatime,nosuid,mode=0755,size=2m   0 0 tmpfs                 /var/run           tmpfs   defaults,noatime,nosuid,mode=0755,size=2m   0 0
 tmpfs                 /etc/console-setup tmpfs   defaults,noatime,nosuid,mode=0755,size=2m   0 0 tmpfs                 /etc/console-setup tmpfs   defaults,noatime,nosuid,mode=0755,size=2m   0 0
-tmpfs                 /var/lib/chrony    tmpfs   defaults,noatime,nosuid,mode=0755,size=2m   0 0 +tmpfs                 /var/lib/systemd/timesync tmpfs defaults,noatime,nosuid,mode=0755,size=2m 0 0 
-tmpfs                 /var/lib/lightdm  tmpfs   defaults,noatime,nosuid,size=30m            0 0+tmpfs                 /var/lib/lightdm  tmpfs   defaults,noatime,nosuid,size=30m             0 0
 </code> </code>
 Reboot and see if /home is mounted. Create a directory for the user pi Reboot and see if /home is mounted. Create a directory for the user pi
Line 30: Line 30:
 chown pi. /home/pi chown pi. /home/pi
 </code> </code>
-===== X-server settings =====+===== Display settings ===== 
 +==== X-server ====
 Now we are going to undo the changes of the system wide autostart and put them in the homedir of the pi user. Make it look like it was: Now we are going to undo the changes of the system wide autostart and put them in the homedir of the pi user. Make it look like it was:
 <code - /etc/xdg/openbox/autostart> <code - /etc/xdg/openbox/autostart>
Line 61: Line 62:
 xset s noblank xset s noblank
 unclutter -idle 0 & unclutter -idle 0 &
-cd ~/MagicMirror 
 xrandr --output HDMI-1 --rotate left & xrandr --output HDMI-1 --rotate left &
-npm start & 
 </code> </code>
 Rotate the graphical interface does not seem to work on a Pi 4. As you can see we are using xrandr to rotate. Rotation of the console must be disabled and the GL driver must be enabled. Rotate the graphical interface does not seem to work on a Pi 4. As you can see we are using xrandr to rotate. Rotation of the console must be disabled and the GL driver must be enabled.
 Use raspi-config to change to GL driver: 7 Advanced Options -> A8 GL driver -> G2 GL (Fake KMS) Use raspi-config to change to GL driver: 7 Advanced Options -> A8 GL driver -> G2 GL (Fake KMS)
 +==== Console ====
 Then change /boot/config.txt to remove rotate screen Then change /boot/config.txt to remove rotate screen
  
Line 84: Line 84:
 disable_splash=1 disable_splash=1
 </code> </code>
- +The console messages will be in unrotated format which is ugly. Disable all console logging: 
- +<code - /boot/cmdline.txt> 
- +console=serial0,115200 console=tty3 root=PARTUUID=6c586e13-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait fastboot noswap ro logo.nologo quiet loglevel=3 vt.global_cursor_default=0 
 +</code> 
 +===== Install===== 
 +We are going to use the recommended manual way: 
 +====Install packages==== 
 +We must be the pi user 
 +<code> 
 +curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - 
 +</code> 
 +<code> 
 +sudo apt-get -y install git nodejs libnss3 libxtst-dev libxss-dev 
 +</code> 
 +==== Install Magic Mirror ==== 
 +<code> 
 +cd ~ 
 +git clone https://github.com/MichMich/MagicMirror 
 +cd MagicMirror/ 
 +npm install 
 +npm audit fix 
 +npm install electron@6.0.12 
 +</code> 
 +Now copy the sample config in place: 
 +<code> 
 +cd ~/MagicMirror/config 
 +cp config.js.sample config.js 
 +</code> 
 +==== Autostart Magic Mirror on boot ==== 
 +Install PM2 process manager 
 +<code> 
 +sudo npm install -g pm2 
 +pm2 startup 
 +</code> 
 +The startup command creates a commandline we need to execute to create a systemd service. Execute it. In our case: 
 +<code> 
 +sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u pi --hp /home/pi 
 +</code> 
 +Create a little script in homedir of pi with name mm.sh 
 +<code - /home/pi/mm.sh> 
 +cd ~/MagicMirror 
 +DISPLAY=:0 npm start 
 +</code> 
 +<code> 
 +chmod +x mm.sh 
 +</code> 
 +<code> 
 +bash -c "$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror_scripts/master/fixuppm2.sh)" 
 +</code> 
 +Reboot and enjoy 
 +{{tag>linux}}
raspberry_magic_mirror.1579983087.txt.gz · Last modified: by herwarth