I recently set up a TV for a storefront that rotates through Chrome tabs. I didn’t want to have to mess with it at all when I powered it on — so this thing requires no keyboard or mouse once you’ve finished setup. Just turn it on and it fires up like a charm!
What you’ll need
Step 1: Install the Raspberry Pi Operating System
Before using your Raspberry Pi, you’ll have to install its operating system (OS) called Raspbian. The easiest way to do so is with New Out Of Box Software (NOOBS), which you can get here: https://www.raspberrypi.org/downloads/noobs/
Download the ZIP and extract (unzip) it.
Once you’ve unzipped and opened the NOOBS folder, you’ll see a file called INSTRUCTIONS-README.txt. Open this up and follow all the instructions. By the end you’ll have a working Raspberry Pi! This will involve formatting your SD card, which can take some time for your computer to do.
Step 2: Format the Raspberry Pi so it never sleeps
Now you should have a working Raspberry Pi. Yay! Let’s make sure it never falls asleep while it’s displaying your tabs. While we’re at it, we’ll also make sure it doesn’t freak out when starting up if it was powered off incorrectly.
Open up the terminal by clicking the icon at the top of the screen that looks like it’s used for coding. It’s black and has these characters: >_
Time to hack into the mainframe! We’re going to edit the file that tells the Pi what to do whenever it starts up. Type the following and then press Enter in order to open up the autostart settings:
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
You should now be in an editor window that says
/etc/xdg/lxsession/LXDE-pi/autostart at the top. You won’t be able to use the mouse to move the cursor around, just the arrow keys.
[Side note: If you’re having trouble getting this part to work, you may want to check out a tutorial on nano or vim. Both of these are text editors you can use to edit the autostart file. If you want to use vim, replace
Edit the file so that it looks like this:
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xset s off
@xset s noblank
@sed -i 's/"exited_cleanly": false/"exited_cleanly": true/'
Now press Ctrl+X to exit. You will be asked to save — enter
Y for yes. Then press Enter and it will save and exit.
Step 3: Find your Chromium (Chrome) tabs
Fun part incoming! Open up the browser with the globe icon and find all the tabs that you’ll want to display. This browser is Chromium, which is essentially Google Chrome.
These tabs can be images if you want to just display an image — just right click any image and click Copy Image Address, then paste into your url bar.
If you want any of the tabs to start out zoomed in, press Ctrl+Plus multiple times (and/or Ctrl+Minus) until you’re as zoomed in as much as you want. This zoom setting will be saved and applied each time this url is opened.
Step 4: Hide the Chromium scrollbar
Follow the instructions here. The actual instructions start under a reddish orange header that says “How to Hide the Scrollbar in Google Chrome.”
Step 5: Make the Raspberry Pi open Chromium on startup
If you closed the Terminal, open it back up. To repeat the last command you entered, press Up on the keyboard. Then press enter to execute it. Here’s the command again if you don’t see it in your history:
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
Underneath all the other text, add the following:
@chromium-browser --noerrdialogs --kiosk --incognito url1.com url2.com
url1.com url2.com with the urls of the sites you want to automatically open to. You can have as many or as few as you’d like — just have a space between each url. If the urls are too long and unwieldy, you can use bit.ly to shorten them.
From now on, Chromium will open in kiosk mode whenever you start your Raspberry Pi. Kiosk mode means it will be full screen and won’t show the url bar. To switch between tabs, use Ctrl+Tab and Ctrl+Shift+Tab. To exit to the desktop, press Alt+F4.
If you restart and wait a minute and Chromium doesn’t open, it’s possible that you’re using the wrong autostart file. Open it up again, open another terminal window, and enter:
sudo nano /etc/xdg/lxsession/LXDE/autostart
Then copy everything from the LXDE-pi autostart file into this one. Anytime you see
LXDE-pi, change it to
LXDE. Save it and restart and it should work now!
Step 6: Make the tabs automatically switch around every so often
We’ll create a super simple script to switch to the next tab every 10 seconds (or 15 or 40, whatever you want!).
In the terminal, run
sudo apt-get install xdotool. This will install the ability to trick your computer into thinking that you’re pressing keys or clicking the mouse. Then run
sudo apt-get install unclutter. This will install a program that can hide your mouse pointer if it hasn’t moved in a while.
In the terminal, run
nano revolvetabs. You will now be editing a file called revolvetabs. Type the following:
#!/bin/bashunclutter -idle 0.1 -root
while sleep 10; do xdotool search --onlyvisible --class "Chromium-Browser" windowactivate key Ctrl+Tab; done
The first line at the top just lets it know that it’s a script that should be able to be executed.
The second line hides the mouse after 0.1 seconds of inaction.
The third line that starts with
while sleep is one line, don’t press enter after
“Chromium-. It uses xdotool to switch tabs every 10 seconds. If you want to change the amount of time between tab switches, change the
10 to any number of seconds you’d like.
Press Ctrl+X then
Y then Enter to save the file. Now to make the script executable, run the following command in the terminal:
chmod u+x revolvetabs
If that doesn’t work try the same thing but with
sudo at the front.
Now go back into the autostart file and add the following to the bottom:
Then use Ctrl+X,
Y, Enter to exit and save. Now the revolvetabs script will run every time the Raspberry Pi starts up.
If you want to test out the script, open Chromium with several tabs open, then go into Terminal and run
Step 7: Finishing up
At this point you can mount your Raspberry Pi to your TV with an HDMI cable. If your tv has a USB input you can plug the Pi’s power cable right into there too! At this point the Pi should turn on whenever you turn on the TV, no setup required.
If you’d like to be able to access the Pi without plugging in a mouse and keyboard, you can follow these directions, but it’s not necessary.
That’s it, you’re done! Now your customers can finally come into your store and stare at this screen for hours on end!
I wrote this article because I couldn’t find any other article/tutorial that taught everything I wanted to do. Here are the main sources I used while trying to figure it out:
Easy Raspberry Pi Based Screensaver/Slideshow for Exhibitions/Store Front
Easy Raspberry Pi Based Screensaver/Slideshow for Exhibitions/Store Front: At exhibitions you often want to show off…
Project: Raspberry Pi information screen and Slideshow - Jarrod's Tech
This is a project I have been working on for my house. It makes a nice Photo Display with weather and the time. It can…
How can I open Google Chrome in Presentation mode using a shell script
I tested this out and then it wouldn't let me exit kiosk mode. I had to Cmd+ Q to get out of Google Chrome. Save the…
How to Hide the Scrollbar in Google Chrome: While not in Use
If you have a tiny computer screen, then you might always be wondering how you could get the maximum space on it. A…
Execute script on start-up
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for…
Raspberry Pi Kiosk Screen Tutorial - Dan Purdy
For a few years now we've had a screen above our Reception area at work to inform musicians which studio they are…
xdotool: How to search for window by title and class with different patterns (similar to…
Thanks for contributing an answer to Unix & Linux Stack Exchange! Please be sure to answer the question. Provide…
xdotool with chromium browser on RaspberryPi
So sorry Mr. Haywood. But you have to realize we are all of very different levels of expertise. What seems intuitively…
How can I make my mouse auto-click every 5 seconds?
Thanks for contributing an answer to Ask Ubuntu! Please be sure to answer the question. Provide details and share your…
Five Ways to Run a Program On Your Raspberry Pi At Startup
In this tutorial we show you five ways you can run a program on your Raspberry Pi at startup. The five methods that are…
Shell programming with bash: by example, by counter-example
Bash is an interactive shell: You type in commands. Bash executes them. Unix users spend a lot of time manipulating…