=== Setting up a raspberry pi Status screen/sign/display === This page describes how to set up a raspberri pi to connect to a projector/tv/screen and boot up directly into a web browser with periodic update of a web page (or pdf). You can optionally load up multiple tabs and enable tab slideshow so the screens cycle through. Start by: - Download Raspbian [[http://www.raspberrypi.org/downloads/]]. - Load the img onto an sd card (using dd on linux or Win32DiskImager on windows). - Boot up your raspberry pi, and load a terminal. ==== Change default password ==== The default password for the "pi" user on Raspbian is "raspberry". Type the following to change it.sudo passwd pi ==== Change keyboard layout to US ==== - Type this:sudo nano /etc/default/keyboard - Then find where it saysXKBLAYOUT=”gb” - Change toXKBLAYOUT=”us” - Save and exit. ==== Static IP instructions==== This is optional, samba and vnc will work fine on DHCP settings. - Type this to change the network settings:sudo nano /etc/network/interfaces - Comment out the line:iface eth0 inet dhcp by adding a “#” to the start - Add the following making sure you change the IP address for the different PI#Section added for Static IP auto eth0 iface eth0 inet static #(Change to the IP you require) address 10.106.228.231 gateway 10.106.224.250 netmask 255.255.248.0 network 10.106.228.0 broadcast 10.106.231.255 - Save and exit nano. - Restart new network configuration by typing the following:sudo /etc/init.d/networking restart ==== SAMBA instructions:==== Note this is only useful if the rpi is going to be located on the same LAN as the computer that will be uploading files to it. Alternately openssh-server can be used with no further changes (ie filezilla or winscp from windows) as this is pre-installed and working by default on Raspbian. - type this to install samba server:sudo apt-get install samba - edit the smb.conf with this: sudo nano /etc/samba/smb.conf - up the top of that file somewhere is workgroup= WORKGROUP make a new line underneath that with "netbios name = BLAH" where blah is what you want to call the raspberry pi on the samba network - go to the very bottom of the file and paste this [sampleshare] comment = cammo fixme writeable = yes force user = pi create mask = 644 path = /home/pi/sampleshare guest ok = yes - Save and exit. - Create the directory referenced by that share with:mkdir /home/pi/sampleshare - Restart samba with:sudo /etc/init.d/samba restart ==== Autostarting firefox/iceweasel ==== - Type this to install iceweasel: sudo apt-get install iceweasel - Type:mkdir -p ~/.config/lxsession/LXDE-pi nano ~/.config/lxsession/LXDE-pi/autostart - Add this line:@iceweasel - Save and exit I found the fix from a comment on this page: [[http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/gui/auto-run-browser-on-startup]] ==== Setting up Tab mix plus ==== - Install tab mix plus addon in Iceweasel Addons. - Under addons, tabmix preferences, menu: - In the "Tab context menu" tab, enable "reload every". - In the "Shortcuts" tab, scroll down to "Toggle tabs slideshow", click in the textbox and press CTRL+F9. - Press close. - Load the PDF you want to display ([[file:///home/pi/sampleshare/blah.pdf]]). - Go to preference, general, and press "Use Current Page" for home page (for convenience only) but then set "restore windows and tabs from last time" otherwise the reload every setting for the tabs doesn't get restored. - Rightclick the tab and set reload every to the required time. - Press F11 to go fullscreen (this setting will be remembered between reboots). - Close firefox/iceweasel (to make sure settings get saved) and reboot the raspberry pi to test. ==== Switching on Tab Mix Plus Tab Slideshow after bootup ==== There seems to be no setting to have slideshow mode active by default on start. To solve this we'll script xdotool to send the CTRL+F9 keystroke to firefox after it has loaded. Note: for this to work, you need to have completed setting this keybinding in the instructions above for Setting up Tab Mix Plus. - Install xdotool:sudo apt-get install xdotool - Create a script with:nano activate_slideshow.sh - Paste the following commands into the script:#!/bin/bash # delay to let firefox/iceweasel load sleep 120 #find what windowID firefox/iceweasel is using WID=`xdotool search "Iceweasel" | head -1` #activate the window xdotool windowactivate --sync $WID #send CTRL+F9 to it to start the tab slideshow feature of tab mix plus xdotool key "ctrl+F9" - Make the script executable with:chmod +x activate_slideshow.sh - Edit the LXDE autostart file:nano ~/.config/lxsession/LXDE-pi/autostart - Add the following line to the end:~/activate_slideshow.sh ==== Alternative to tab mix plus tab slideshow ==== This method for rotating the tabs gives more flexibility to script PGDOWN keystrokes etc to scroll multiple PDF pages. Do this *instead* of the above CTRL+F9 method. Note: we use xte from xautomation package for keystroke events on RPI debian wheezy instead of xtotool, because xtotool on latest Raspbian seems to have a 100% cpu openbox bug. We use xtotool only to activate focus on the correct window. - Install xdotool and xautomation:sudo apt-get install xdotool xautomation - Create a script with:nano manual_tab_slideshow.sh - Paste the following commands into the script:#!/bin/bash #initial delay while iceweasel loads sleep 120 #find what windowID firefox/iceweasel is using WID=`xdotool search "Iceweasel" | head -1` while true do # delay for reading the page sleep 20 #activate the window xdotool windowactivate --sync $WID #Page down xte 'key Page_Down' #delay for reading the page sleep 20 #activate the window xdotool windowactivate --sync $WID #Home to go back to top of current tab xte 'key Home' #ctrl+tab to go to next tab xte 'keydown Control_L' xte 'key Tab' xte 'keyup Control_L' done - Make the script executable with:chmod +x manual_tab_slideshow.sh - Edit the LXDE autostart file:nano ~/.config/lxsession/LXDE-pi/autostart - Add the following line to the end:~/manual_tab_slideshow.sh ==== Setting firefox to auto load tabs after crash without confirmation ==== If the Raspberry pi is unsafely shut down (ie power pulled), firefox will come back with a crash recovery page. This increases the maximum number of "crashes" before this is displayed. - go to about:config in the address bar, press "I'll be careful" - Search for browser.sessionstore.max_resumed_crashes and set it to 100 ==== VNC instructions ==== - Install x11vnc:sudo apt-get install x11vnc - Set password for the first time type:x11vnc -usepw - Enter password twice, enter to store in default location, then CTRL+C to quit x11vnc after its fired up. - Type the following to edit the autostart file (make sure the directory exists first)nano ~/.config/lxsession/LXDE-pi/autostart - Add the line:@x11vnc -forever -usepw -shared - Save and exit. - Reboot and test. ==== Setting the Display to portrait mode ==== - Type the following sudo nano /boot/config.txt - Add (or edit) the following line:display_rotate=1 - Save and exit. - Reboot and test. ==== Turning off screen blanking ==== - Type the following to edit the autostart file (make sure the directory exists first)nano ~/.config/lxsession/LXDE-pi/autostart - Add the lines:xset s off xset -dpms - Save and exit. - Reboot and test. ==== How to run a cron job every 5 minutes ==== To edit the crontab, use the command crontab -e This uses the editor specified in the environment variable$EDITOR, and if the variable is empty, this defaults to nano The format of a crontab is 6 columns, space (or tab) separated. The first 5 columns detail the time when to run a command, which is specified in the last column. The last "column" makes up all the remaining characters, inclusive of spaces. Here is an example: 5 * * * * /home/aspera/my_script.sh What the above shows, per column: - Minute to run on, a value of 0-59: 5 means on the 5th minute of the hour - The Hour, a value of 0-23: * means every hour - Day of the Month, 1-31: * means every day of the month - The Month, 1-12: * means every month - Day of the Week, 0-7 (0 and 7 are both Sunday): * means every day - The Command: In this case, a command at /home/aspera/my_script.sh With older crontabs, like the one on legacy Solaris, this is mostly all that can be done. One variation is to use comma separated lists. Modern crontabs can use string names for days, and wildcards with increments. So, to create an entry that runsmy_script.sh every 5 minutes would be as follows on Linux: */5 * * * * sudo mount -a The */5 notation in the first column means "every 5 minutes". To make this every 10 minutes, */10 is used. ==== Remotely checking to see what screen connector is active ==== the command to see the status of displays and resolution in Xorg is "xrandr". Remoting in with vnc or on the device itself, xrandr by itself will be enough. From an ssh session xrandr needs to know which display server to query, as the shell isnt a child of the Xorg process: DISPLAY=:0.0 xrandr