Table of Contents

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:

  1. Load the img onto an sd card (using dd on linux or Win32DiskImager on windows).
  2. 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

  1. Type this:
    sudo nano /etc/default/keyboard
  2. Then find where it says
    XKBLAYOUT=”gb”
  3. Change to
    XKBLAYOUT=”us”
  4. Save and exit.

Static IP instructions

This is optional, samba and vnc will work fine on DHCP settings.

  1. Type this to change the network settings:
    sudo nano /etc/network/interfaces
  2. Comment out the line:
    iface eth0 inet dhcp

    by adding a “#” to the start

  3. 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
  4. Save and exit nano.
  5. 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.

  1. type this to install samba server:
    sudo apt-get install samba
  2. edit the smb.conf with this:
    sudo nano /etc/samba/smb.conf
  3. 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
  4. 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
  5. Save and exit.
  6. Create the directory referenced by that share with:
    mkdir /home/pi/sampleshare
  7. Restart samba with:
    sudo /etc/init.d/samba restart

Autostarting firefox/iceweasel

  1. Type this to install iceweasel:
    sudo apt-get install iceweasel
  2. Type:
    mkdir -p ~/.config/lxsession/LXDE-pi
    nano ~/.config/lxsession/LXDE-pi/autostart
  3. Add this line:
    @iceweasel
  4. 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

  1. Install tab mix plus addon in Iceweasel Addons.
  2. Under addons, tabmix preferences, menu:
    1. In the “Tab context menu” tab, enable “reload every”.
    2. In the “Shortcuts” tab, scroll down to “Toggle tabs slideshow”, click in the textbox and press CTRL+F9.
    3. Press close.
  3. Load the PDF you want to display (file:///home/pi/sampleshare/blah.pdf).
  4. 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.
  5. Rightclick the tab and set reload every to the required time.
  6. Press F11 to go fullscreen (this setting will be remembered between reboots).
  7. 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.

  1. Install xdotool:
    sudo apt-get install xdotool
  2. Create a script with:
    nano activate_slideshow.sh
  3. 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"
  4. Make the script executable with:
    chmod +x activate_slideshow.sh
  5. Edit the LXDE autostart file:
    nano ~/.config/lxsession/LXDE-pi/autostart
  6. 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.

  1. Install xdotool and xautomation:
    sudo apt-get install xdotool xautomation
  2. Create a script with:
    nano manual_tab_slideshow.sh
  3. 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
  4. Make the script executable with:
    chmod +x manual_tab_slideshow.sh
  5. Edit the LXDE autostart file:
    nano ~/.config/lxsession/LXDE-pi/autostart
  6. 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.

  1. go to about:config in the address bar, press “I'll be careful”
  2. Search for browser.sessionstore.max_resumed_crashes and set it to 100

VNC instructions

  1. Install x11vnc:
    sudo apt-get install x11vnc
  2. Set password for the first time type:
    x11vnc -usepw
  3. Enter password twice, enter to store in default location, then CTRL+C to quit x11vnc after its fired up.
  4. Type the following to edit the autostart file (make sure the directory exists first)
    nano ~/.config/lxsession/LXDE-pi/autostart
  5. Add the line:
    @x11vnc -forever -usepw -shared
  6. Save and exit.
  7. Reboot and test.

Setting the Display to portrait mode

  1. Type the following
     sudo nano /boot/config.txt
  2. Add (or edit) the following line:
    display_rotate=1
  3. Save and exit.
  4. Reboot and test.

Turning off screen blanking

  1. Type the following to edit the autostart file (make sure the directory exists first)
    nano ~/.config/lxsession/LXDE-pi/autostart
  2. Add the lines:
    xset s off
    xset -dpms
  3. Save and exit.
  4. 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:

  1. Minute to run on, a value of 0-59: 5 means on the 5th minute of the hour
  2. The Hour, a value of 0-23: * means every hour
  3. Day of the Month, 1-31: * means every day of the month
  4. The Month, 1-12: * means every month
  5. Day of the Week, 0-7 (0 and 7 are both Sunday): * means every day
  6. 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