Tuesday, 8 April 2014

Simple monitoring of a Raspberry Pi powered screen - Part 2

If you have read my previous blog post Raspberry Pi entrance signed backed by Umbraco - Part 1 which describes how we used a Raspberry Pi to drive an Entrance sign for QV Offices you will have seen I mentioned a follow up post about monitoring the sign.

As the sign is mounted in the entrance of the building on the ground floor and the reception is on the 1st floor, this meant that if there was a fault of any kind showing on the screen, the first person to see this was inevitably one of QV Offices' clients as they walked into the building.

Although the QV Offices' team were able to check the Umbraco website address that the sign uses, this did not always mean that everything was working as expected. We noticed a couple of times that the sign had Wifi issues (it is now hard wired) and this caused the Chromium browser to render a 404 error when it tried to refresh the screen.

The simple monitoring solution

We added the following line to our refresh script, so that after the sign had been refreshed a screen shot of the Raspberry Pi would be taken:

import -display :0 -window root ~/screenshot.jpg
Finally we wrote a small Crontab task that ran on a QV Offices Mac that grabs this screen shot and saved it on the desktop, admittedly we have used a package that it not mega secure, but in reality this is an internal system that only runs an office sign, so we are not to concerned about it being hacked.

*/5 * * * * /usr/local/bin/sshpass -p 'password' /usr/bin/scp pi@192.168.X.X:screenshot.jpg Desktop/QVScreenShot.jpg
As the file icon updates, if the image changes, this gives a quick visual indication of the status of the sign, if for some reason the icon does not look correct the QV Offices administrator can just click on the file to see the exact image currently displayed on the sign.

Sometimes a quick and easy solution is better than a more complex and expensive one.

Monday, 3 February 2014

Raspberry Pi entrance signed backed by Umbraco - Part 1


Being experts on all things Umbraco, we jumped at the chance to help our client, QV Offices, with their pressing signage predicament. They needed to display a sign in the entrance to their building and approached us for our advice. Of course it had to be electronic: displaying multiple names of their serviced office clients, meeting room bookings and on-the-pulse promotions. But with a winding Victorian staircase and minimal storage space how could the monitor be run, updated and managed? That’s where we came in…

  • Raspberry Pi
  • Umbraco CMS
  • Automatic updates
  • Automated monitor of the sign
  • Power saving when the screen is not in use

Mounting the screen

The screen that has been used is a standard LED low energy Full HD screen and has been mounted on the wall using it's VESA mounting points, as the wall is a stud wall we were able to add an access panel behind the screen to feed through the mains, HDMI and sensor cables.

The Raspberry Pi is then tucked away out of sight in the main electrical cupboard which just happens to be next to the sign, we had an electrician add a power point inside this cupboard to allow us to power the screen and the Raspberry Pi.

Designing the interface and editing the content

Although a room sign was the initial requirement from QV Offices, their medium term goal has always been to add online meeting booking to their website and hence we suggested adding information about the current and next day's meetings to the sign that would be pulled directly from their online booking system.

We produced the design and built the web page to fit exactly on a 1920 x 1080 screen (Full HD in Portrait)

As you would expect all the information can be edited via an Umbraco CMS, they are able to add floors, rooms, clients and virtual clients as well as add meeting bookings to their meeting diary.

How we configured the Raspberry Pi

After receiving a new Raspberry Pi we downloaded the latest release of Raspbian operating system and followed the official guide which shows how to copy the OS onto an SD card from a Mac, we then followed the majority of steps on this useful guide: 10 Things to Do After Buying a Raspberry Pi.

Installing Chromium

We chose to use the Chromium web browser which for those who do not know is the open sourced version of Google Chrome. You can install this from the terminal with the following command:

sudo apt-get install chromium-browser

Installing Unclutter

We found this little application which automatically hides the mouse pointer, it is used in the script below and is installed using the following command:

sudo apt-get install unclutter

Auto start Chromium and disabling the screen saver, power saving and mouse

When the Raspberry Pi has been installed it will not have a keyboard or mouse and hence if their was a power cut we needed it to always boot and re-loaded Chromium with the correct URL.

Our preferred command line text editor is Nano and I have assumed you know how to use this editor or will be able to work it out pretty quickly.

So using the following command:

sudo nano /etc/xdg/lxsession/LXDE/autostart
We then changed the autostart file content to:

@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@xscreensaver -no-splash
@xset s off
@xset -dpms
@xset s noblank
@chromium --kiosk --incognito http://www.qvoffices.com/someURL
@unclutter -idle 0
The first few commands turn off the screen saver and power saving, we then open Cromium in Kiosk Mode (full screen with no menu etc) and pass in the URL to use (I have changed the URL in this example) We found a useful blog post with the Cromium command line switches.

Finally we also open an application called Unclutter which auto hides the mouse after 0 seconds, so you will never see a mouse on the sign.

We also had to edit the following file:

sudo nano /etc/lightdm/lightdm.conf
And added the following line under the [SeatDefault] section:

xserver-command=X -s 0 dpms

Refreshing the screen

We decided to try and add a scheduled task that would trigger Chromium to reload the page, at some point in the future we might well change this to using Javascript to update the content, but for now this works fine.

First we installed the XDOTool which enables you to script Keyboard commands:

sudo apt-get install xdotool
We used the Refreshing Chromium Browser by Shell Script post as a reference and created the following shell script (which we called refreshing.sh):

export DISPLAY=":0"
WID=$(xdotool search --onlyvisible --class chromium|head -1)
xdotool windowactivate ${WID}
xdotool key ctrl+F5
This selects the correct display and then sends a CTRL + F5 to refresh Chromium.

You will need to give this file execute permissions:

chmod a=rwx refreshing.sh
Now we have the script file setup we just need to schedule it to call this script periodically which is done by using Crontab, to edit this you use the following command:

crontab -e
And we added the following:

*/5 * * * * DISPLAY=":.0" /home/pi/scripts/refreshing.sh >/home/pi/cronlog.log 2>&1
This calls our script every 5 minutes to refresh the display and it logs any errors to the cronlog.log file.

Summary

QV Offices now have a richer and more manageable booking system than they did before we started, and a great new sign to boot.

How could we make sure that the sign was running smoothly downstairs in a busy office centre? A second post will follow outlining exactly how Vizioz enabled QV Offices to monitor their sign simply and remotely, from the comfort of their desks.

Wednesday, 19 December 2012

We have moved to larger offices

First of all we should probably apologise for the complete lack of blogging over the last 6 months! As web developers we are constantly telling our clients that they should keep their blogs up to date and it seems we have been ignoring our own advice.

That being said, we have been very busy moving offices and helping our new host QV Offices setup their new business. As well as all the moving we have not been sitting on our hands, we have built the new site for DairyMaster over in Ireland as well as a separate private website for their global distributor network.

As Umbraco Gold Partners we have found more and more that we are working on projects where we are the silent development partners, so although we cannot talk publicly about a lot of the sites we develop, we have some real beauties now in our portfolio :)

Now that the dust has settled in our new office ( and has been hovered up! ) we are read for the new year and are looking forward to working on some exciting projects that are currently in the pipeline.

We are also intending to run some Hacking sessions for Umbraco as we now have lots of space for developers to come and work with us, so if you have any ideas of a theme for an Umbraco Hackathon then do let us know.

And with that it just remains to say Happy Christmas to you all and see you in the new year!

Top 5 most popular posts