Outils pour utilisateurs

Outils du site


issue62:linuxlab

Ceci est une ancienne révision du document !


Hackerspaces are awesome! In our city, we’re lucky enough to have a great hackerspace, Kwartzlab. I’ve visited Kwartzlab a few times to check out some of the cool equipment and projects members were working on: 3D printers, motherboard artwork, a large laser cutter, even an icosahedron flight simulator. One of the simpler items around the space that caught my eye was a small picture frame that displayed a twitter feed of tweets that include the @kwartzlab tag.

I thought it would be interesting to have the same kind of device in our computer recycling shop - displaying tweets including our organization’s @ tag and tweets by other computer refurbishers. I considered doing this project with an Arduino and LCD, but it seemed more fitting to use one of the older notebooks donated to our project. After sorting through a bunch of notebooks missing parts I managed to build a functional IBM Thinkpad R31. The R31 is a vastly underpowered notebook by today’s standards, but Thinkpads were generally well-built notebooks. Our R31 had a Celeron 1066MHz CPU and 128MB of RAM - which we bumped to 512MB. A notebook with built-in wireless would have meant one less cable, but I chose the R31 because it was one of the few notebooks in salvageable condition.

Because we wanted the notebook to do one task, serve our twitter updates, choosing a lean OS was important. Lubuntu seemed a practical choice, it’s current, lightweight, and uses a modern browser, Chromium, as its default.

It was also a snap to install since our project uses a PXE boot server to deploy Ubuntu, Lubuntu, and Xubuntu images. All of our Linux images are set to autologin, so I didn’t need to modify lxdm, but, for the sake of completeness, you can set an account to autologin in Lubuntu by finding the following line in /etc/lxdm/lxdm.conf and uncommenting it, then inserting the appropriate username:

#autologin=username

By default, most Linux distributions are set up to display a screen saver after a short period. This is a good practice for security, but not so great for our Twit Screen project. To disable the screensaver, click the Lubuntu button > Preferences > Screensaver, then select Disable Screen Saver from the Mode dropdown option.

I thought that Midori might be a tad lighter on memory than Chromium, but discovered when I ran cat /proc/meminfo | grep MemFree that Chromium was slightly lighter. The load process for Chromium also felt slightly faster, and, since Twit Screen should act like an appliance and the CPU is already slow, any extra speed was beneficial.

The next step was figuring out how to display live Twitter feeds in a cool manner. For that I found Cameron Adams’ visibletweets.com. Visibletweets has a couple of nice features I like, a choice of 3 types of animated tweets, and, more importantly, you can use Twitter search operators. Visibletweets also doesn’t require a login. Since I already knew I wanted to search for multiple tags and twitter accounts, the OR operator came in handy. As a test I entered: @WorkingCentre OR @chaslinux OR @kwartzlab OR “Computer Recycling”

Tweets started to appear beginning with Computer Recycling tweets. At the moment I typed in the search, one company’s tweets kept coming up with the same message in a really spam-like fashion. I learned that the minus operator (NOT seemed more appropriate but didn’t work) can be used to limit results and you shouldn’t include the @ sign when eliminating particular results from a twitter user, just -username. My revised test:

@WorkingCentre OR @chaslinux OR @kwartzlab OR “Computer Recycling” -60IT

This kept @60IT results from showing in the tweets. I also noticed that if I left off the quotation marks around “Computer Recycling”, visibletweets seemed to display only computer recycling tweets. Normally, it displays the most recent tweet. So, if you’re testing against multiple words, put them in quotation marks.

Next, I took note of the URL that resulted when I typed in the query - it wasn’t pretty: http://visibletweets.com/#query=%40WorkingCentre%20OR%20%40chaslinux%20OR%20%40kwartzlab%20OR%20%22Computer%20Recycling%22%20-60IT&animation=2

The idea is that just after autologin, I’d start chromium in full-screen mode with the search URL. LXDE does have some applications that can be enabled just after logging in by clicking the LXDE button > Preferences > Desktop Session Settings, but, out of the box, it doesn’t seem to have a graphical way of adding applications to startup the way Gnome does. To start an application, its *.desktop file needs to be copied to ~/.config/autostart. When I changed into the ~/.config folder, I noticed there was no autostart folder, so I made one.

At first I thought there was no chromium.desktop file until I remembered the full filename is chromium browser, so I needed to run locate chromium-browser.desktop. I then copied the file to the ~/.config/autostart directory:

cp /usr/share/applications/chromium-browser.desktop ~/.config/autostart

But, I also wanted it to start with that nasty URL, so I changed into the ~/.config/autostart folder and changed the line that read:

Exec=/usr/bin/chromium-browser %U

I replaced the %U with the long URL from visibletweets. When I logged out and logged back in, visibletweets now started with the operators I wanted.

Nice, but I could still see LXDE’s interface. As an appliance, I wanted this to disappear. The solution, run chromium-browser in full-screen mode. Full-screen mode is known in chromium parlance as kiosk mode, and starting in kiosk mode was as simple as appending –kiosk to the end of our arguments in the ~/.config/autostart/chromium-browser.desktop file:

Exec=/usr/bin/chromium-browser <url> –kiosk

Note that I’ve put <url> in place of where that nasty URL goes.

With chromium loading the website in full-screen on autologin, the last step on the software side of things was to install SSH:

sudo apt-get install ssh

Since the keyboard was going to eventually be inaccessible behind the screen, I needed a way to remotely administer the system (to apply updates, and perhaps setting the system up for other functions at a later date), and SSH is my favoured method.

Several years ago I built a similar system to display photographs. It was a success initially, but I learned the hard way that you have to be very careful about Electro Static Discharge (ESD). My photobox worked well, but the back end stuck out of the photo-frame. When I went to remove more components from the notebook I forgot to properly ground myself … and you probably know the rest of the story.

Next month: Tweet Screen - Part 2 - Hacking the hardware

issue62/linuxlab.1341291509.txt.gz · Dernière modification : 2012/07/03 06:58 de fredphil91