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:
The default password for the “pi” user on Raspbian is “raspberry”. Type the following to change it.
sudo passwd pi
sudo nano /etc/default/keyboard
XKBLAYOUT=”gb”
XKBLAYOUT=”us”
This is optional, samba and vnc will work fine on DHCP settings.
sudo nano /etc/network/interfaces
iface eth0 inet dhcp
by adding a “#” to the start
#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
sudo /etc/init.d/networking restart
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.
sudo apt-get install samba
sudo nano /etc/samba/smb.conf
[sampleshare] comment = cammo fixme writeable = yes force user = pi create mask = 644 path = /home/pi/sampleshare guest ok = yes
mkdir /home/pi/sampleshare
sudo /etc/init.d/samba restart
sudo apt-get install iceweasel
mkdir -p ~/.config/lxsession/LXDE-pi nano ~/.config/lxsession/LXDE-pi/autostart
@iceweasel
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
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.
sudo apt-get install xdotool
nano activate_slideshow.sh
#!/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"
chmod +x activate_slideshow.sh
nano ~/.config/lxsession/LXDE-pi/autostart
~/activate_slideshow.sh
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.
sudo apt-get install xdotool xautomation
nano manual_tab_slideshow.sh
#!/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
chmod +x manual_tab_slideshow.sh
nano ~/.config/lxsession/LXDE-pi/autostart
~/manual_tab_slideshow.sh
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.
sudo apt-get install x11vnc
x11vnc -usepw
nano ~/.config/lxsession/LXDE-pi/autostart
@x11vnc -forever -usepw -shared
sudo nano /boot/config.txt
display_rotate=1
nano ~/.config/lxsession/LXDE-pi/autostart
xset s off xset -dpms
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:
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.
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