Use a Raspberry Pi to develop a stand alone Twitter appliance that can be used to display tweets in a public environment.
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.
- Logon as the default user pi
- Open a terminal session and download the x11vnc package:
sudo apt-get update
sudo apt-get install x11vnc
-
Set a password for when you attach via your VNC client.
x11vnc -storepasswd
-
Create a startup configuration for x11vnc. From your home directory:
cd .config
mkdir autostart
cd autostart
-
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
- Now reboot the Pi
- 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
- Open another terminal session and install chromium.
sudo install chromium
cd .config/autostart
- Create the file
chromium.desktop
with the following contents:
[Desktop Entry]
Type=Application
Name=chromium
Exec=chromium
StartupNotify=false
Terminal=False
Hidden=False
- 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:
- Open the URL www.twitterfall.com
- Authenticate to the Twitter account.
- Set Twitterfall to display the appropriate content
- Copy the full URL from the chromium address bar; including the
/?oauth
suffix - Now open a terminal session and edit the file
~/.config/autostart/chromium.desktop
and change theExec=
line to be
Exec=chromium twitterfall.com/?oauth_token=whatever
- 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
- Edit
~/.config/autostart/chromium.desktop
again and change theExec=
line again to be:
Exec=chromium -kiosk twitterfall.com/?oauth_token=whatever
- 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
Connecting to the Mi-Fi
The topic of How To connect a Raspberry Pi to a 3G network is covered elsewhere.