Raspberry Pi Week : Guestblog : Serve Your Message With a Slice of Pi

May 27

This weeks guestblog is brought to us by Daniel Messer, aka the Cyberpunk librarian. Find out more about Daniel, his podcast and his awesome website over at Cyberpunk librarian.Com


1740959_1558668224413538_2131227828_n

Digital signage is a passion of mine which is odd because, for the most part, I hate advertising. When you think “digital signs” you have to think about advertising because the two go hand and hand, right? You see them all over the place from your local big box store where they use monitors on end-caps to sell you stuff you don’t need to the trendy Apple store where they’ll use an iPad Air 2 as a digital sign.

 

That’s a baseline US$500 device sitting there. It kicked off the tablet revolution and ushered in a so-called “Post PC Era.” And there it is, bolted to a table, telling you why you’d want to buy a PC. That’s irony so thick you could spread it on toast.

But it doesn’t have to be this way.

As a public library webmaster, one of my jobs is managing the digital signs in our branches. I don’t create the content so much anymore, but I handle the tech side when needed. These things run off of small, dedicated PCs running Windows 7. Their administrative interface is lousy, the PCs are overkill as they’re rolling glorified PowerPoint presentations, and the big screen monitor and PCs kick out enough heat to keep you warm in the winter.

For the record, I live in Phoenix. We really don’t have a winter here.

When I first got my hands on a Pi, I knew this would be better for getting the library’s messages out on digital signs. They’re tiny, produce little heat, could be velcroed to the back of a monitor, and they run on free software. Diving into different software packages I played withScreenly OSE, Concerto, RiseVision, and others before landing on something I really liked — an idea I got at an airport.

The Phoenix Mesa Gateway Airport, aka AZA, uses Pis for almost all of their digital signs from the ones dropping ads to the ones that tell you when your flight departs and from what gate. Even the monitors beside the gates use Raspberry Pis to display the gate number, flight number, destination, and so on. I talked with a couple of their IT staff to find out what they used and the answer was surprising and refreshing.

They use a web browser. When you look at those signs, you’re simply looking at a website, in a browser, in full screen mode. The website refreshes itself every so often, and there’s a quick blank screen while it does this, but then you’re presented with the latest information.

I went back to my desk and got to work.

An old server bound for surplus found new life in our racks with an Ubuntu Server installation. I knew I’d have to do things slightly different as our library district covers a huge area while the airport covers a single large building. Instead of using the Pis to call a website, I’d have them bring up web content stored locally, but synced from the server.

I installed Chromium on the Pis because I like how easily you can feed it switches through a command line. That’ll be useful later. I also need to make sure that the screens don’t go blank or into power-save mode. Turns out there are a couple of ways to worry about this, but an easy way to handle it is to simply install XScreenSaver and then disable it.

My Pi OS of choice is Raspbian, which uses LXDE as its desktop environment. That’s excellent because to make all the necessary changes I just need to edit a couple of files, maybe three if you’re running the latest version. Opening up LXTerminal and then running

sudo nano /etc/xdg/lxsession/LXDE/autostart

I added the following lines:

@xset s off

@xset -dpms

@xset s noblank

@chromium --kiosk --incognito /home/pi/display/index.html

(Depending on your version of Raspbian, you might need to put the @chromium line in

/etc/xdg/lxsession/LXDE-pi/autostart

The other three can go in the first file.)

The first three lines disable all the screen blanking stuff that Raspbian would normally do, which forces our screen to stay on. The last one launches Chromium, in a full screen kiosk mode which. When you launch Chromium in incognito mode it won’t remember any previous shutdown errors and thus, never throws an error on startup. Then it displays my index.html in a local directory. Since we’ve put these in the autostart file(s), they will automatically happen when the pi user logs into the GUI. (Which you can set to happen immediately after boot up through sudo raspi-config.)

The index.html is simply a slideshow powered by JavaScript. It displays images, sized to fit the monitor’s resolution, and that’s it. It also refreshes itself every ten minutes to pick up new content.

But how to update it?

Since the geographic area covered by the library district is bigger than some east coast states, I wanted things to update quickly, in the background, on a schedule, while reliably pulling down the data and resuming the odd failed transfer. Fortunately, you can do all of that with rsync and cron.

Remember that old server now running Ubuntu? That’s the only place I update the code and content. I can change and add slides, modify the code, save everything, and ten minutes later all the Pi displays are updated. Here’s how that works:

On each Pi, I set up rsync to talk to the server. To do this without a password you need to set up a keypair for the Pi and the server. First thing to do is make sure ssh works between the Pi and server. If so, generate a keypair on the Pi using ssh-keygen. Don’t use a password to generate the keypair and don’t use sudo as the user pi will be doing all the work. Once you have the keypair transfer it to the server using:

ssh-copy-id -i ~/.ssh/id_rsa.pub user@servername

Replace the user@servername with the user on the server where you’re hosting these files. In this case, the syncing directory is under my own username, dan, in a directory called display.

ssh-copy-id will ask for your login password to the server and, if all goes well, that’ll be the last time it asks for it. Once the keypair is set up between the Pi and the server, you should be able to ssh and rsync without a password.

Now we’re ready to sync things up! Set up a cron job using:

crontab -e -u pi

This will launch nano and you can set up a cron job to call rsync as you like. Me, I do it every ten minutes. That means that, on the very outside, any change I make to the master files will take up to twenty minutes to reflect on the monitors in the branches. I could set it to go more often, but there’s nothing so critical as flight information on those screens. So my cron job looks like this:

*/10 * * * * rsync -az --partial dan@piserver:/home/dan/display /home/display/

Looking back, let’s see what we’ve built. We’ve got a Raspberry Pi, connected to a monitor in a remote location. It’s running a slide show through Chromium and all the content is local, so it comes up fast with no lag. That content is synced to a server via rsync running as a cron job and everything updates every ten minutes, both the browser and the content.

So in the end, we’ve used no software geared specifically towards digital signage. The digital sign is powered by open source operating systems, running open source software, on open source hardware. As a librarian into open access, that’s the kind of thing that really makes my day.

Related Posts

“Whats in your bag week” Day 2 : Daniel Messer

Oct 28

daniel

I sometimes joke that I live online, but that’s not far from the truth. By profession, I’m a Web Content Manager for a public library district in Phoenix, Arizona. I create and manage online content for the library’s website and assorted web based properties and presences. Beyond that, I’m a podcaster and the host of Cyberpunk Librarian; a show about libraries and technology. I blog and write for websites. I’ve done online video and an online documentary series dealing with popular history. Im a digital illustrator and graphic designer. I’ve written two non-fiction eBooks you can find on Amazon and composed music you can find on Soundcloud

Sooner or later, almost everything I do ends up on the web.

It’s not just my job to create stuff and put it on the web, it’s my passion. On the librarian side of things, it’s crucial that the library’s web content work in as many places as possible, so I carry gear devoted to the life of a professional web guy who’s enthusiastic about online content.

What's In Dan's Bag

  1. My bag is very simple, a basic Merona messenger bag I picked up at Target maybe a year ago. It’s got a big space for stuff, a smaller zipper pouch for smaller stuff, and two big pockets on the front for whatever else. It’s not as feature rich as a Timbuk2 bag, but it does the job well.
  2. Magazines – Yes, words and images printed on dead trees and I’m fortunate to have a job where Rolling Stone is considered a “professional periodical.” I love magazines and frequently read them on my tablet.
  3. Panasonic Lumix DMC-FZ8 – This is a step up from a basic point and shoot, but it’s not as feature filled as a DSLR. I’m an image junky, so I take pictures occasionally and I’m trying to take more of them more often.
  4. Albuterol inhaler – “Sucks to your ass-mar!” Ralph. Lord of the Flies (A literary reference from a librarian. Go figure!)
  5. Yak Pak disc headphones – These things don’t have sound like Sennheiser headphones or anything. However I also won’t freak out if they get lost or broken. If I carried Sennheisers and they were lost or stolen, I’d cry myself to sleep that night.
  6. Wallet – No cash, so don’t bother. I don’t carry cash all that often but I do need someplace to put my driver’s license, debit and credit cards, and medical insurance stuff. Truth be told, I hate wallets. This is just easier than carrying the stuff loosely.
  7. Business cards – Daniel Messer. Web Content Manager. Maricopa County Library District. Can I help you?
  8. Samsung Galaxy Note 3 – Running Kit Kat on the Verizon network. I carried an iPhone 4s for two and a half years before moving up to this. I can’t go back, I love my big phone. This is the computer I take everywhere and the thing that keeps me connected 24/7.
  9. iPad 3 – Okay, I know this is weird, but when it comes to tablets I prefer iOS over Android. I just haven’t found an Android tablet as nice as an iPad that does all of the things an iPad does for me. This is my daily driver as far as tablets go and it goes with me almost everywhere.
  10. Old prescription bottle – Unfortunately, there’s nothing stronger than ibuprofen and some antacid tablets. I have a bad back so the ibuprofen gets a fair bit of use.
  11. MagSafe charger for my….
  12. Mid 2013, 11 inch MacBook Air – This is my digital baby. I love this laptop and take it to work every day. Sure, I tell people that I use it to test website changes on Safari. The truth is, this is my primary computer. I produce video and audio on it. I use it for digital illustration. It’s my writing platform and my podcasting production system. I call her Angelique.
  13. Wired, USB mouse – I love the trackpad on the MacBook, but when I’m writing, I need a mouse. It’s just easier for me to write prose, emails, and code with a mouse nearby. I don’t use the mouse at all most of the time, but when I need to get the cursor between two letters, the mouse wins. Yes, it’s a simple USB, wired mouse. While I like Bluetooth mice, I’ve never had a connection issue with a wired mouse.
  14. Samsung Galaxy Tab 3, 7 inch – My eReader for eBooks. I’m a librarian, I read a lot. I guess it kind of makes sense that, as a technologically minded librarian, I read a lot on several different devices.
  15. Grid-It organizer by Cocoon – It’s like lots and lots of runner bands! It holds the various charging cables for the various devices. It has a zippered pocket on the back for…
  16. Various plugs – Well, yeah. You have to have something to plug those cables into.
  17. Battery charger for the Lumix DMC-FZ8 – It’s an older camera and the battery is still good, but it certainly doesn’t last as long as it used to.
  18. Merkury Innovations Power Bank – Merkury is a decent supplier of inexpensive tech. They make Bluetooth keyboards which aren’t bad at all and this little power pack will charge my phone from dead to 60%. I don’t use it often, but when I need it, it’s a life saver. It’s also much cheaper than a Mophie Pack.
  19. Refillable spray sanitizer – Just a little spritz and you’ll kill most of the germs on anything. Basically, it’s just rubbing alcohol in a sprayer. I’m not a germaphobe at all, but sometimes, yeah, you need to clean your hands.
  20. Assorted pens – Oddly enough, I don’t have a single thing to write on.
  21. Apple BlueTooth Keyboard  – When you write as much as I do, this thing is a must have. Sure there are other keyboards for the iPad out there, but I’ve yet to find anything as good as this. My iPad is my daily computer and I use it as much as my MacBook Air. It’s great for work, for my own projects, for writing, for blogging, and almost anything else. When I leave the house with my bag, you can guarantee that this keyboard and my iPad are in it.

Related Posts