Octoprint LogoI run a 3D printer at home, and to control it I use the excellent OctoPrint (written by the awesome Gina Häußge), distributed as a ready-to-go SD image OctoPi.  I use port forwarding and can control and check in on the printer visually through OctoPrint.

At work I now have a Lulzbot TAZ 6 printer, but not the network control to port forward, etc., so I am trying Astroprint, which is based on top of OctoPrint and offers a web-based service to manage and monitor your 3D printer.   I will soon find out if that will work correctly behind the corporate firewall.  Locally, Astroprint offers a web-based interface, which should be convenient for me and others to work with the printer.

Astroprint LogoAt the printer itself, I wanted more than just the built in ‘full graphic controller’ with wheel and click to control it.  To add to the Astroprint Raspberry Pi, I bought the official Raspberry Pi 7″ LCD and a nice bamboo case/stand, which makes a much nicer control ability; both direct and remote.   

The Astroprint image is meant to run ‘head-less’, so took a bit of work to set up as a kiosk interface to the controller.  After digging around the not-so-seedy parts of the interwebs, I was finally able to gather the information I needed to make this happen.  I will try to post links to all articles to which I referred, at the end of the post.

Step 1 – Install GUI

The GUI is not installed on the Astrobox image to save space, but we need it.  Sign into your RPi as the standard pi user and run these commands, which will install the files needed:

sudo apt-get install lxde lightdm xinit xserver-xorg

Step 2 – Install chromium browser

The chromium browser is easy to configure for a kiosk mode.  Still as the local pi user, run these commands to install the browser:

# Make sure everything installed is up-to-date
sudo apt-get update
# Download public key and install source to get chromium browser
wget -qO - http://bintray.com/user/downloadSubjectPublicKey?username=bintray | sudo apt-key add -
echo "deb http://dl.bintray.com/kusti8/chromium-rpi jessie main" | sudo tee -a /etc/apt/sources.list
# Make sure (again) that everything is up-to-date
sudo apt-get update
# Install the browser, x11-xserver-utils, and unclutter (hides mouse when no movement) 
sudo apt-get install chromium-browser x11-xserver-utils unclutter

Step 3 – Setup chromium kiosk mode

# The lines are added to the autostart file for user pi  
# Stop the screensaver from running on startup
sudo sed -i.bak -e 's/@xscreensaver -no-splash/#@xscreensaver -no-splash/' ~/.config/lxsession/LXDE/autostart
# Turn off power savings and timeouts
sudo sed -i.bak -e "$a@xset s off" ~/.config/lxsession/LXDE/autostart
sudo sed -i.bak -e "$a@xset -dpms" ~/.config/lxsession/LXDE/autostart
sudo sed -i.bak -e "$a@xset s noblank" ~/.config/lxsession/LXDE/autostart
# Checks and clears flag that is created on a crash or unexpected restart
sudo sed -i.bak -e "$a@sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/chromium/Default/Preferences" ~/.config/lxsession/LXDE/autostart
# Start the chromium browser with desired URL. "--enable-offline-auto-reload" will help with network disconnects
sudo sed -i.bak -e "$a@chromium-browser --noerrdialogs --disable-infobars --incognito --enable-offline-auto-reload --kiosk http://localhost" ~/.config/lxsession/LXDE/autostart

Step 4 – Setup Raspian to boot into GUI

If you haven’t done this step already, run these commands to tell the Raspberry Pi to boot into GUI versus command line.

sudo raspi-config

In the version I am using (