Wednesday, 19 August 2015

Using the Raspberry Pi and Screenly OSE as a low cost display advertising solution

I am using Screenly OSE (Screenly's Open Source Edition of its Screenly Display Ad solution) running on a Raspberry Pi to display ads on screens in a number of locations. Screenly's OSE provides a free display ad solution that can be used with an inexpensive Raspberry Pi to make the lowest cost display ad solution I could find.

My requirements meant that I needed to have the Raspberry Pi running Screenly on a WiFi solution. I needed to be able to access Screenly remotely so that it could be updated at any point, and, I needed access to the Screenly admin screens to be password protected, which at the time of writing, they weren't by default.

This post summarises the setup of Screenly OSE on a Raspberry Pi with the following configuration:
  1. Screenly OSE installed and running on a Raspberry Pi 2
  2. Password protection on Screenly's admin screens
  3. The Raspberry Pi connecting via WiFi
  4. The ability to update the display images remotely

Screenly OSE Basic Installation

The basic instructions for setting up Screenly OSE can be found at:
These instructions will give you a basic working setup of Screenly but you will need to use a cabled network connection, not wifi, and we need to secure the Raspberry Pi but make it accessible remotely.

Complete the instructions above to get to the Screenly start up screen which will show you the IP address of the Raspberry Pi. 

Screenly OSE post-installation

You can SSH into the Pi using the IP address and the pi user account. From a linux box or a mac terminal on the same network:
  • ssh pi@xxx.xxx.xxx.xxx
Make sure you have completed all of the steps including
  • Expanding the root filesystem with "sudo raspi-config"
  • Updating Screenly to the latest version with "~/screenly/misc/run_upgrade.sh
Additionally, you should update the operating system while you are at it:
  • sudo apt-get update
  • sudo apt-get upgrade
Also, change the pi user account password using the passwd command:
  • passwd
Reboot the box after the updates
  • sudo reboot

Screenly Password Protection Update

The current release of Screenly OSE does not include any password protection. If you know the IP address and port that Screenly is running on (which it displays for about 20 seconds every time the Raspberry Pi reboots) you can freely get in to modify what the display shows. There are no restrictions.

James Singleton has forked the current Screenly release and updated it to include some basic password protection. His updates are available on github:
The easiest way to update Screenly OSE to incorporate these password protection changes is to simply replace the existing server.py with James' updated server.py.

Use the following command to copy James' updated code to the Raspberry pi:
  • git clone https://github.com/jpsingleton/screenly-ose.git
and then copy the new server.py over the original one.

  • cp screenly-ose/server.py screenly
Finally, change the standard password by editing the server.py file:

  • sudo nano screenly/server.py
# Update the web admin login credentials here:
# Good to use only SSL (script in misc folder)
def check_creds(username, password):
    return username == "admin" and password == "Scr33nlyOSE"

Raspberry Pi WiFi Setup

Raspberrypi.org gives simple instructions to get your Pi Wifi enabled and connected at :
It basically explains how to:
  • Scan for wireless networks: sudo iwlist wlan0 scan
  • Edit the Wifi setup files: sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Go to the bottom of the file and add the following:

network={
    ssid="The_SID"
    psk="Your_wifi_password"
}

wpa-supplicant will normally notice a change. You can verify if it has successfully connected using ifconfig wlan0. If the inet addr field has an address beside it, the Pi has connected to the network. If not, check your password and SSID are correct.

To set up multiple wireless networks, give each network in wpa_supplicant.conf an id_str and then add an entry for that id_str in /etc/network/interfaces

For example, in /etc/wpa_supplicant/wpa_supplicant.conf

network={
    ssid="The_SID"
    psk="Your_wifi_password"
    id_str="work"
}

and in /etc/network/interfaces

iface school inet dhcp

Screenly OSE Remote login

To access the Raspberry Pi remotely and and remotely control Screenly OSE, you need to open a port on the network router that the Raspberry Pi is connecting to.

Opening or forwarding ports varies on different routers but you are looking for the advanced settings and information about virtual servers in the routers admin menus.

You’ll need to set which incoming port your router should watch and the protocol to watch for along with the IP address of the Raspberry Pi which will be the destination for this port’s requests. Lastly, you’ll be able to choose which port the request should be targeted to on the destination IP.
  • Incoming port: 8080 - you could change this to another port if you like
  • Protocol: TCP or select Both
  • IP Address: Probably something like 192.168.xxx.xxx. This is the IP address shown on the Screenly boot screen.
  • Target Port: 8080 - this must be 8080 as this is what Screenly uses


No comments:

Post a Comment