How To build a Raspberry Pi powered Twitter Display

Use a Raspberry Pi to develop a stand alone Twitter appliance that can be used to display tweets in a public environment.
hashtag #5thLetchworth

Background

Every two years, Letchworth and Baldock District Scouts holds its Arts and Crafts competition. This year, it was decided to hold it in a pop-up shop in Letchworth town centre. The theme was Adventure.

The Scouts in my troop, 5th Letchworth, decided it would be a good idea to have a multi-media display; comprising a physical hashtag and a display of tweets containing that hashtag. The hashtag was, of course, #5thLetchworth.

The Scouts constructed the physical hashtag and decorated it with pictures, poems and other items that conveyed the notion of adventure. It was my task to create the twitter display.

System design

The obvious base for the display was a Raspberry Pi! of which I have several. This would be connected to a large screen TV via the built in HDMI interface, and to the Internet via my own Mi-Fi.

The Pi already has XWindows installed, so that would be used to run the Chromium browser. Chromium would be set to display a feed from www.twitterfall.com.

Setting up

Configuring the Pi

As the basis of the system, I chose to stick to the stock Raspbian distribution as it has almost everything I needed. The only changes I needed to make were to set it to startup in headless mode and allow remote VNC connections (because there wouldn’t be a keyboard or mouse connected when the system was in use). I also had to set it to auto-start Chromium.

Setting the Pi to startup in headless mode

To do this, you need to install the x11vnc package.

  1. Logon as the default user pi
  2. Open a terminal session and download the x11vnc package:

    sudo apt-get update
    sudo apt-get install x11vnc

  3. Set a password for when you attach via your VNC client.
    x11vnc -storepasswd

  4. Create a startup configuration for x11vnc. From your home directory:

    cd .config
    mkdir autostart
    cd autostart

  5. Now use your favourite editor to create the file x11vnc.desktop with the following contents:

    [Desktop Entry]
    Type=Application
    Name=X11VNC
    Exec=x11vnc -forever -shared -usepw -display :0 -ultrafilexfer
    StartupNotify=false
    Terminal=False
    Hidden=False

  6. Now reboot the Pi
  7. After it has rebooted, you should be able to use your favourite VNC client to connect to the IP address of the Pi on port 5900 using the password set it step 3.

Installing and autostarting Chromium

  1. Open another terminal session and install chromium.
    sudo install chromium
    cd .config/autostart
  2. Create the file chromium.desktop with the following contents:
    [Desktop Entry]
    Type=Application
    Name=chromium
    Exec=chromium
    StartupNotify=false
    Terminal=False
    Hidden=False
  3. If you now reboot again, the chromium browser should open automatically

Setting Chromium to open www.twitterfall.com automatically

For this to work, you need to authenticate to a twitter account and decide in advance what you wish to display. In my case I wanted to display the output from a specific Twitter List.

Complete the following in the chromium browser:

  1. Open the URL www.twitterfall.com
  2. Authenticate to the Twitter account.
  3. Set Twitterfall to display the appropriate content
  4. Copy the full URL from the chromium address bar; including the /?oauth suffix
  5. Now open a terminal session and edit the file ~/.config/autostart/chromium.desktop and change the Exec= line to be
    Exec=chromium twitterfall.com/?oauth_token=whatever
  6. Save and close and then reboot to test.

Starting Chromium in kiosk mode

The last step is to set Chromium to start in Full Screen mode

  1. Edit ~/.config/autostart/chromium.desktop again and change the Exec= line again to be:
    Exec=chromium -kiosk twitterfall.com/?oauth_token=whatever
  2. Reboot again and it should all work.

One last thing

You will have noticed that Twitterfall cannot be configured to launch in Presentation Mode. This is why you need the remote VNC connection.

I was going to have my MacBook Air with me when I installed this so I simply connected remotely and clicked on the Presentation Mode button in Twitterfall. If anybody knows how to avoid needing to do this, I’d love to hear from them.

The finished article

Display of tweets from #5thLetchworth

Connecting to the Mi-Fi

The topic of How To connect a Raspberry Pi to a 3G network is covered elsewhere.

Author: Gareth Howell

IT Professional, radio amateur, scout leader and beer drinker. I enjoy helping small business use their limited IT budgets to best effect