How to boot Chromium into Kiosk mode on a Raspberry Pi

How to boot Chromium into Kiosk mode on a Raspberry Pi

Setting up Google Chrome to boot in full-screen kiosk mode on a Raspberry Pi can be a great way to display a web-based interface or dashboard automatically upon startup. Here’s a step-by-step guide to achieving this:

  1. Install Chromium Browser: If you haven't already installed Chromium (the open-source version of Chrome) on your Raspberry Pi, you can do so by running:

    sudo apt update
    sudo apt install chromium-browser
    
  2. Edit Autostart Configuration: You’ll need to edit the autostart configuration file to launch Chromium in kiosk mode whenever the Raspberry Pi starts up.

    • Open the autostart file with a text editor. For Raspberry Pi OS with desktop environment, you can use:

      nano ~/.config/lxsession/LXDE-pi/autostart
      

      Or for newer versions (using LXDE):

      nano /etc/xdg/lxsession/LXDE-pi/autostart
      
    • Add the following lines at the end of the file to open Chromium in kiosk mode. Replace http://your-url-here.com with the URL you want to display:

      @xset s off
      @xset -dpms
      @xset s noblank
      @chromium-browser --noerrdialogs --disable-infobars --kiosk http://your-url-here.com
      

      Here, the xset commands prevent the screen from going to sleep or displaying the screensaver.

  3. Disable Screen Sleep: To ensure the screen doesn’t go to sleep, you might also need to disable screen blanking in the LightDM configuration:

    • Open the LightDM configuration file:
      sudo nano /etc/lightdm/lightdm.conf
      
    • Add the following lines under the [SeatDefaults] or [Seat:*] section:
      xserver-command=X -s 0 dpms
      
  4. Reboot Your Raspberry Pi: After making these changes, reboot your Raspberry Pi to see if everything starts up as expected:

    sudo reboot
    
  5. Troubleshooting:

    • Ensure your Raspberry Pi is set to boot into the graphical desktop environment.
    • If you face issues with the browser not covering the entire screen, ensure you have set the correct display resolution settings via raspi-config.

This setup should automatically launch Chromium in kiosk mode displaying your chosen URL in full-screen mode each time your Raspberry Pi boots up. This configuration is especially useful for digital signage, information displays, or any application where you want a browser-based GUI to be accessible immediately on startup.