Digital Signage

digital-signageHello!

Well, if you’re here, then chances are you either attended my talk at AzLA or you know someone who did. Either way, thanks for swinging by and here are some resources about digital signage that I mentioned in my talk.

My slides

The Slideshare service muddles the look of the slides a bit. So if you’d rather download them directly, that might be better.

Choose from: Keynote | PowerPoint

Links

Notes

Setting up and deploying a digital sign using Chromium and rsync

For this, I assume you’re using Raspbian, which uses the LXDE desktop. You’ll need to install a few things to up and running. If you’re working with a new Pi, I suggest doing the following:

After the initial set up of Raspbian and after connecting it to the Net either via WiFi or cable, launch the Terminal and type sudo apt-get update This will check for the latest updates for the operating system and firmware.

When the update is over type sudo apt-get upgrade This will download and install those updates. This can take a few minutes.

Just in case one of the updates requires a reboot, go ahead and reboot the Pi with sudo reboot

Once it comes back up, get back into the Terminal. We’re going to install [Chromium][1] (an open source version of Google Chrome) and [XScreenSaver][2] (an open source screen saver package). To do this, type sudo apt-get install chromium and, after it finishes, sudo apt-get install xscreensaver

With that software installed, time to modify some files to make use of them!

Type sudo nano /etc/xdg/lxsession/LXDE-pi/autostart At the bottom of the file add

@chromium –kiosk –incognito http://Link-To-Your-Website.here

This starts up the Chromium browser when the device logs in. Additionally it starts it in kiosk mode, which is full screen, and in incognito mode, which eliminates any error messages that may have popped up from before. The link should go to your web server or if you’re pulling content off the Pi itself, change it to file:///home/pi/index.html or wherever you’ve stored the web code on the Pi.

Now let’s type sudo nano /etc/xdg/lxsession/LXDE/autostart Add the following, and put them on individual lines as you see here: @screensaver -no-splash
@xset s off
@xset -dpms
@xset s noblank

Save that file and close it. Finally, we’re going to edit one more file, but you’re going to have to look for the line. Type sudo nano /etc/lightdm/lightdm.conf Now look for a section called [SeatDefaults]. Change the first line under that section to read:
xserver-command=X -s 0 dpms

You’re ready! You can now call a website from your webserver or populate content locally. If you’d like to be able to update and sync that content remotely, here’s your ticket.

Setting up rsync to sync content from one place to another in the background

Note: This section assumes a bit of familiarity with ssh and the Terminal.

First, verify your connection to the remote server via SSH. After all, you need to make sure the connection works before you start working the connection.

Next, type ssh-keygen This will generate a ssh key pair to use with ssh connections.

Once you have your keypair, type ssh-copy-id -i ~/.ssh/id_rsa.pub user@server In this case, replace user@server with the username and the server name where you’ll sync from. You’ll be asked for a password one last time.

Now verify connection without using the password. You should be able to connect via ssh from your Pi to your server without the need for the password.

The command to sync from the server to the Pi goes something like rsync -az –partial user@server:/home/user/sync /home/pi/ Once again, replace user and server with the proper information along with the path that you want to use.

I set up my Pis to sync every ten minutes. This can be done through a cron job, using the pi user account on the Raspberry Pi. To set this up we’ll create and edit a new cron job by typing sudo crontab -e -u pi

At the bottom of the file, add */10 * * * * rsync -az –partial user@server:/home/user/sync /home/pi/ Save and exit the editor.

As you can see, the command is the same, and the part before tells cron to run that command every ten minutes, of every hour, of every day, of every week, of every month. This is a long-winded, Linux way of saying “do this every ten minutes.”

Upon Deployment

When you’re ready to deploy this Pi into the wild, there are a few things you’ll want to check and do.

Change default password for user pi

Record IP of the device after connection to the network

Attempt ssh to confirm connectivity and verify that everything is working over the network

It’s also not a bad idea to set it up for a regular reboot. If you’ve set up things to launch upon login, then a daily or weekly reboot can keep things fresh in the memory. Using cron at the root level, we can set a daily reboot by typing sudo crontab -e and at the bottom adding:

30 4 * * * /sbin/reboot

This sets the Pi to reboot every day at 4:30am. You can change the time to suit your needs!