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

When wanting is more pleasing then having : What drives YOU to buy new gear ?

May 22

“Wanting is more pleasing then having” : It’s not logical, but it is the truth. It’s a line Spock must have quoted in some long gone Star Trek episode somewhere (please don’t ask me, I can’t remember which one). For some reason it has stuck in my mind for the longest time. “It’s not logical but it’s the truth” is the follow up line .. completing the entire statement and lifting it to the realm of existence-pondering quotes out there.

spock crying

I’m reminded of the quote as I’m browsing through a similar quote (of the financial kind) of my current gadget-infatuation (or toy-crush) : The Dell XPS13 laptop. This sleek small 13 inch laptop has been on the market for quite a while and sports very cool specs in a very small form factor. I could go on telling you about how its innards, the software, the reviews and the hours of research I have been doing about it .. but that is a little beside the point. To sum it up : I’m infatuated with it at the moment. Because its a cool new toy and I want it !
There .. I said it : I want it ! I have read reviews, talked to people who own one, looked up insanely detailed technical documentation on how to take it apart should I ever need to. Adds for the laptop have been popping up in Facebook and Youtube is now convinced my only goal in life is to watch MORE review video’s about the XPS13. If the XPS13 was a girl, I would be considered a stalker. But since its only a laptop (and a gorgeous one at that) it’s called research and I’m called a Geek.
I don’t wear sandals and have a neck beard.
Mulling over this quote in my hands I took the time and step back a little, to the days before my gadgetary obsession with the device to ask myself the question : When did the XPS13 become the perfect laptop for me ? Was it after some long quest through the digital wastelands in search for the perfect portable laptop ? Was it after a life changing event that made me realize that in fact did not OWN any portable computer ? Am I to become a Linux Developer working for canonical in the morning (and hence need such a device ?)…. No. I in fact have a laptop (and multiple portable devices) and I don’t wear sandals and have a neck beard. I can’t even write a decent bash script so .. the developer option is out.  Somewhere along the line I must have just decided that I wanted to have it.
The journey is more important then the destination.
What is important to know is that the journey that took me towards the point where I decided I really WANTED it, has never really started at any point where I NEEDED it. I’m not ashamed to point this out. My “urge” to posses the Dell XPS13 started when I read some article about its existence and from that point out I have started to dream up reasons why I need it. Sure, there were issues with the current size of my Macbook pro (in combination with my mobile lifestyle) that gave me some problems : The Macbook Pro is a little bit too big (and too expensive) to carry around everywhere and it would be handy to own something smaller. Also I have been playing around with Linux for a while now and have always wondered what it would be like to buy a machine pre-installed with Linux .. but none of these reasons truly validate the purchase of a new machine.
When it comes to the small form factor I have an older Surface Pro 1 which is perfectly portable (I take it to all my business meetings) and although Linux runs on it (I’ve tried it) the experience isn’t quite flawless. In its defense it does run Ubuntu linux perfectly in a full screen VM having plenty of power left. So if my “reasons”‘ for buying a new machine are that I need a small portable linux running device .. why don’t I settle for the machine I already have ?
I’ve probably been marketed.
The answer is probably marketing. Subconsciously I’ve been influenced by the mega marketing machine that is the internet into believing I NEED the Dell XPS13. And because of that I”ve started to rationalize the purchase by telling myself all the things I can do with it. Falling for the marketing trick is not something we should be ashamed of our shy away from. For one our economy would collapse and we would all end up living in our own cabin in the woods like hermits .. but it IS a good thing to be AWARE of this.
I for one have been taking a close look at those reasons I came up with why I NEEDED this new device.
– I needed something that was smaller then my Macbook Pro.
– I needed something that was powerful and portable so I could take it with me everywhere without being afraid to break our bump it.
– I would LIKE to have a machine that runs Linux flawlessly.
– It would be great to have a little laptop that I could take with me te blog on and record podcast.
– I would be so much more productive if I had this ONE laptop that could kind of do anything..
….
So dp I need it ? 
There are plenty of more reasons where these came from if you query me long enough .. So I decided to take this shortlist and throw it at the hardware I already have. (In this case my I5 Surface pro) . Turns out that (aside from running Linux natively) it CAN do all the things I want to do (and then some) Add in the stylus and the transformable laptop-tablet form factor and it is actually a more versatile device then the XPS.
Then why do I want it ? 
The second thing I did was to take long look at the list and figured out what it really meant. When I read beyond the technical desires there are some creative desires there. What my subconcious is actually trying to tell me is that I want to have more time to be creative. My creative urges see the XPS13 as kind of a promised land to write more, podcast more .. have more time to myself. They also are urging to have a less complicated life. Those are the things I really WANT.
The bottom line is that what I really WANT is more time to unleash my creativity and a less complex and hectic life to do this. Thanks to clever marketing the XPS (and its specs) has been heralded as the enabler of these solutions. The fact is : it’s not true. If I want to be more creative , i CAN … I just need to do it on the hardware I already have. Instead of upgrading my machine I might need to upgrade the way I spend my time. Perhaps I need to upgrade the importance of listening to my creative urges. Perhaps what I really want is an XPS version of my own life at the moment.
Its funny how a cool gadget triggers thoughts about what you really want out of life .. but in the end THAT is what matters. So when you feel the urge coming up to get a cool new toy you don’t really “need”‘ .. figure out WHY you want it. It might uncover some hidden desires or frustration that you want to resolve.. Getting those sorted out might be harder then just buying a cool new toy in a shiny box .. But it will be much more rewarding. So you see 🙂 Wanting is not as pleasing as having .. It’s not logical : It’s the truth.

Related Posts

KW1001 First impressions of the Ubuntu Phone

May 20

sl3

We kick off season 10 of the Knightwise.com podcast with a hands on review of the BQ Ubuntu Phone. We review the hardware, talk about the fledgling OS and see how the phone holds up in “daily use”. Splice in some cool tunes selected by Daniel Mesner and you have yourself the first episode of the Knightwise.com podcast, season 10.

Links

Music

Related Posts


Raspberry Pi Week : Start learning Python with this free tutorial.

May 20

“There is an app for that ! “. How many times have you heard that phrase, probably uttered by some smartphone waving geek who instantly shows you how to fix problem Xyz in your life using a pre-packaged app. And there is nothing wrong with that.. as long as there IS an app. But what if there is not ? What if you spend hours online looking for an app that doesn’t exist or doesn’t quite do what you want it to do ? Wouldn’t your wish to be able to TELL your computer exactly what to do ? Well there is ! It’s called programming. Don’t worry if it sounds weird but before the time of beard-sporting iphone hipsters with 5997 apps on their smartphones we used to PROGRAM our machines to work for us.

python code

A great way to start to learn how to program is by using a raspberry pi. The inexpensive mini computer is a great place to start when you want to learn how to program. The Pi is geared heavily towards the Python language and offers great tools which you can use when you want to learn how to code (or teach your kid on how to code). But where do you start ?

The Full Circle magazine has been running a series on “how to program in python” for quite some time. They have collected all these articles into 3 PDF Issues of their magazine that you can download for free. Its a great way to start your first baby steps into Python scripting and discovering you don’t always need an “app for that”. Even with a few basic programming skills you can upstage those app-jockeys by saying ” I WROTE a script for that !”. So download the tutorial, grow a beard, put on sandals and start screaming profanities towards closed source software, because you’re on your way to becoming a Python Programmer !

Links :

Related Posts

Productivity Week: Simplify Task Management with Todoist

May 14

Tracking to-dos or tasks has been a problem for me for some time. My struggle with it has been well documented so I won’t get into a long explanation here. TLDR: I keep switching task tracking tools because they all seem to have major drawbacks.

Several weeks ago I accidentally came across an app that I had downloaded at some point in the past, but that I couldn’t ever remember using. That app is Todoist.

Todoist is, quite simply, a to-do list app. At it’s most basic, it allows you to put tasks on a list, and check them off when they’re done. If your needs are simple your usage of the tool can be that simple. The biggest benefit I’ve found with todoist isn’t that it has a number of additional features that can help you track and manage your tasks so that you can get more done. The features are handy to be sure. The biggest seller for me is that those features stay out of my way unless I actually want to use them.

Todoist

Some of the most obvious out-of-the-box features are things like Projects and Due Dates. By associating with a project you can group tasks together either for a specific focus or a GTD-like review session. By adding Due Dates to tasks they will show up in some of the views that exist in the app like Today and Next 7 Days. These views provide an excellent burn-down list for getting through your day.

The app will also allow you create sub-tasks. This can be done either by selecting a “Parent” task when editing a to-do item, or just by dragging things around on the task list. Tasks slide around seamlessly. Sub-tasks provide a nice visual way to break down complex work items into simpler constituent parts.

Todoist will also let you filter tasks. The filters will allow you to show you just a specific subset of tasks. The one I find the most useful is one of the built-in filters “No Due Date” for finding things which I either haven’t decided when they need to be done, or have forgotten to tag with a deadline.

The last of the basic features I want to touch on is something found throughout the app. It’s use of natural language for things like due dates and filters is fantastic. If something is due today, set the due date to “today” and it will figure it out. “Tomorrow”, “next thursday” and “four days from now” will all get you the correct due date for your tasks. If you want to see things for which you missed the date, simply type in “overdue” as the search or filter query.

While not a feature specifically, there is also some gamification at work in Todoist. The app will award you “karma” points (unless you opt out) for both using the system and getting your tasks completed on time. It sounds dumb… but to some degree, for me at least, I think it does provide a bit of an incentive for me to keep sticking to the system.

Todoist Karma

Todoist also has a premium version which adds a ton of features, most of which I’d never use, but there are a few key ones. The first is being able to add notes or attachments to tasks. This is great for tracking the status of a long-running task or something with a few intermediate actions (which maybe should be their own tasks, but I digress…) The other key feature is task backups. The app will backup your task list and maintain an archive so that you can restore from a recent backup. The cost of the premium service is $33 USD / year. I’ll be renewing my premium subscription next month. A handy comparison sheet is available on the website to show the differences between the free and paid tiers.

The last thing I wanted to touch on is platform availability. Todoist is available pretty much everywhere. Android, iOS, phones and tablets are all covered. Mac and Windows clients are also available. There are also a number of browser extensions. The basic web-based UI is fantastic. This is truly a cross-platform juggernaut.

Links:

 

Keith Murray is a software architect and developer can be found on twitter as kdmurray. He also blogs about technology and science at kdmurray.net.

Related Posts