Before I get started here, dear reader needs to be aware that this is a long and wordy reply and not only a damn good set of instructions, but also my opportunity to finally dump my rant on all the noble RPi fanatics that seems to have found it beneath themselves to write something straight forward that the newbies can use to actually get something like this working. I mean if you want the community to actually grow, you have to promote the projects with uplifting results, and not keep telling them to read the stupid man pages. (My rant on the usefulness of those man pages at another time.)
I have a RPi3 and a RPi2 to work with and this is how it went.
Okay, I have spent a week dredging every forum and "how to" instructable I could find to try to solve this problem.I even purchased someones RPi image that was supposed to do this all so neatly. The purchased option did work, but had limited room for changing it to fit any special needs. So, I took all the information I could find and spent another week experimenting to find a sure fire way to make this work by combining all the ideas in all that research until I had the sure-fire formula. And here it is...
First of all in most revisions of Jessie for the RPi, the changing of the autostart file does NOT work.
Secondly... wait a sec... say what!!! There are multiple revisions of Jessie?!? Uhmm... Yup
And that is the key to getting a functional signage display. Knowing what revision to get and what to do to it to make it display your webpage nicely. So for the beginner, you must get over this surprise if you are going to make something work in your lifetime, or at least without copious quantities of beer and anti-depressants. So, let's start there...
From your favorite browser, do a search for "older revisions of RPi jessie". You should eventually stumble across the complete list of older revisions. At the time of this writing, I had found it at downloads.raspberrypi.org/raspbian/images
Now this next part just made me pull my hair out, or it certainly delayed me finding this stuff for a few minutes but I had a whole refrigerator full of cheap mexican beer and alot of time on my hands anyway.
From the list of revisions, and for THIS particular set of instructions, you want to download the image file:
2016-09-23-raspbian-jessie.zip ok, waiting..... waiting.... Oh! you mean you cant find it in the list?!?
That's right! The filename is the one you want, but there is no such date listed on the page we found. huh.
That is because someone hid it in the link dated 2016-09-28. Well, ain't that just special. Pause here. Drink beer. Ok move on.
So don't believe everything you here or read about "must have the latest revisions of everything" or it may not work. Well, guess what. The latest revision of everything at the time of this writing is broken anyway! Unless you can become an expert in the "systemd" package and figure out what is pointed where in the 2017-1-11 rev, the you will never get it to work.
Download the image I told you to get and write it out to a fresh (micro)SD card.
Put it in the pi and boot it up. Now, if you have a keyboard and mouse to attach to your pi, then your good. If not, just make sure you can ssh into the pi from another pc on the same network. Either way the commands are all the same whether you do it in a terminal window on the fancy desktop or do it in a ssh terminal session.
So get your terminal window open and type:
then use the old fashioned text menu to do the following:
- Expand the filesystem (option 1)
- Change the User Password (option2)
- Change Boot Options to "Desktop Autologin" (option B4 under Boot Options)
- Change your regional settings (option 5)
- Set your Hostname (option A2 under Advanced Options)
- Make sure SSH is turned on (option A4 under Advanced Options)
- Change the Memory Split to 128 (or more) for video or intense graphic content (option A3 under Advanced Options)
If you want to alter any of the other stuff, do that now before you select <Finish> to end it and reboot.
**Special Note: Do NOT try using the overclock feature. If you plan to use this pi as a signage display, do you really want to receive the embarrassing phone call on your day off that your little unattended pi box burnt up? Swallow your pride and let it run at it's own speed. If you wanted something faster you should have spent more money on different hardware.
'nuff said! Pause... Drink beer while pi reboots... ok, move on.
Now, here is where the noble ones would tell you to apt-get update, upgrade, distro upgrade, your girlfriend upgrade, Just STOP okay. In this particular instance we don't want to upgrade the little pi to the stratosphere because at the time of this writing it would cough and gasp and maybe still let your browser work. Whoops! My bad. No it broke chromium damn it!
Pause... deep breathe... Drink another beer... It's all behind you now... find your zen... okay screw zen, drink another mexi-beer and move on.
So, open your terminal and type the following commands
sudo apt-get update
(we just want to know what is new for the few things we really need)
After the update finishes we have to download and install 2 packages that are not part of this rev of jessie:
apt-get install unclutter
apt-get install xdotool
The unclutter tool lets you hide the mouse pointer on your fancy signage display and the xdotool lets you hack a way to do some other important stuff later in this rant, uhm, I mean instrunctions.
Now you should still be in the /home/pi user directory, so if not then get there so we can move on. Drinking beer while I wait
Okay, we need to create 2 little scripts in your landing directory so we can circumvent the maddening, tempermental, ugh. Maybe I don't have enough beer after all.
Create the scripts like this:
# Run browser after boot to desktop
sudo -u pi chromium-browser --kiosk --incognito http://your.favorite.website &
# End of script
Ctrl-x to close and save the file.
(If I need to tell you to replace "your.favorite.website" with your intended display webpage, then maybe you need another beer)
Okay, now let's do the other script:
# Start a goofy command loop to refresh the browser every 90 seconds
/usr/bin/lxterminal --command watch -n 90 xdotool key ctrl+F5 &
# End of goofy script
Ctrl-x to close and save the file.
Okay, now to explain what we just did. The scripts are named "start_chromium.sh" and "start_URLrefresh.sh" and I kinda hope you can figure out what each one does by the name?!? The sleep command turns out to be necessary to get the timing of the programs correct so don't ignore it. Also notice the extra space and the & symbol at the end of the commands. This turns out to be needed as well. It starts the package and then lets the focus move past it so other things can get underway in the right order. In the URL refresh script, the watch command forces the system to do the command that follows it every x number of seconds (in this case 90). The lxterminal is needed to run the commands because the typical init or xinit methods of starting stuff in jessie are hit or miss based on what revision you have, so this way may not look clean, but it works every time. Finally the xdotool lets you force a simulated keyboard entry of anything you want on the currently open/focused page. In this case we are telling it to hit the <Ctrl> and the <F5> key. This represents a shortcut key to make chromium refresh the page. The <Ctrl> key means it ignores anything in the browser cache. As for the script to start the browser, the switches that follow the command are all that is needed to open a webpage in full screen with no borders, no title or navigation bars etc. As long as you are NOT going to be displaying a Google page, everything will work fine. If you must display a Google page, then you will have to figure out a way to get it to stop telling you you are using an old version of chromium. There is just not enough beer for me to fix that one.
Okay, so you have your needed script files, but they will not work unless you make them executable. There are 2 ways to do this and I just did BOTH in one behind the other to make damned sure they were executable. If you want to pick just one, so be it. But I will laugh at you if it doesn't work for your particular case. Been there, done that, so I did both. Pause, drink, move on.
I typed the following commands:
sudo chmod 755 start_URLrefresh.sh
sudo chmod +x start_URLrefresh.sh
sudo chmod 755 start_chromium.sh
sudo chmod +x start_chromium.sh
Now your scripts are for sure executable.
Next the autostart file needs to be modified to make use of our scripts and the following commands added to the end of the file and in the specific order you see them here:
@xset s off
@xset s noblank
@unclutter -idle 5 -root
Now don't close the file just yet, you need to comment out one line with a #, so edit to look like this:
# @xscreensaver -no-splash
Now you can Crtl-x to close and save the file.
The first 3 xset commands work together to stop the screen blanking. The unclutter command hides the mouse pointer on your display after 5 seconds. Then you can see your 2 scripts listed. If you reverse the order of the scripts you will have an open terminal window in the middle of your pretty signage display. Whew, almost there. Pause.. take leisurely long drink of beer. Ahhhh. Move on.
**Special Note - There may be some pi boards that are faster or slower than my examples. In this case you may find that your display either has the dreaded terminal window out in front, or that your refresh is not working at all. When we made the 2 little script files they each had a /bin/sleep command. You can tune your system by altering the number of seconds each one sleeps. You see, it turns out that you have to start the refresh just before the browser loads in order for it to work properly. Yet, you done want to have the terminal window it starts to be displayed any longer than really needed because, well... it's just ugly, even for those few seconds. Since the browser is so huge of a package it takes longer to load than you might want. While it loads, the wallpaper background image of the desktop is displayed until the browser finishes loading. The sleep commands are your way of fine tuning that experience.
Finally there is one last thing that bugged me about how the pi started up. That goofy cartoon fruit splash screen. If you want to be rid if it you can edit it out by removing the word "splash" form the single command line in /boot/cmdline.txt file. To do that:
sudo nano /boot/cmdline.txt
and edit out the splash, then Ctrl-x to save and close the file.
Now, sit back and open another beer. This is the moment you have been waiting for...
and watch your signage display come to life.
Ok, so now I expect to get all the stuck up, uh.. I mean noble pi fanatics to immediately jump in here to critique these instructions with their "Oh, that is so clunky and dirty looking for making a simple signage display". So let me tell you all now.... Bite Me!
If you want to spend your precious time critiquing my instructions (mixed in with my rant about you) then you should have damned well taken the time to write something that definitively works EVERY TIME. How are we supposed to , as hobbyists, suffer through inaccurate man pages, endless trial and error efforts, and put up with holier-than-thou responses to our efforts to find help. That is no way to build a community of fledgling developers. Take some time one day and pick a target problem, then explain the solution in simple terms like I tried to do here. You will have done something good, because everyone that reads the article will gain knowledge that can be used in their future attempts at pi work. Otherwise, If you really want to do something useful with your blessed life, then at least add on to what I have here by telling us in laymans terms how to blank out the scrolling script messages that whiz by during boot-up. Or, how about a way to stop Google from overpowering your chromium settings to display a message telling you that your version of chromium is old, or maybe a way to make all this stuff work in the newest raspbian release EVERY TIME. But don't waste your time correcting my spelling or my approach. I admit up front is it a Macguiver bull dozer tactic to make a display, but it freaking works if done exactly as I laid out. If you tried these instructions on the 2017-01-11 raspbian jessie (or any other rev for that matter) and it didn't work, then maybe you should give up drinking beer with me and read the instructions again.
Ok, done here. Time to buy more beer. Let the nay sayers chime in now.