Trafficlights

The trafficlights are three little light bulbs shining on three posters. On these posters you can see hardcopies of websites of the TecO. The aim is to visualize the traffic on our pages. We try to achieve this by controlling the brightness of the light. If we have many accesses on particular pages then we will see a particular very bright light. Allright, if somebody use a spider on our pages then all lights have their maximum output. :-)

trafficlights

Background

 

The trafficlights architecture consists of two parts. The first is hardware. You'll need three lights and a little electronic for controlling. Below you can download the board schematic (as pdf), the C-Code of the program the PIC on the board was programmed and a description of the commands (also called the protocol) the board can understand. (Thanks to Götz Mayser - mayser@teco.edu

light.pdf (board schematic)
light.c (C-Code for the PIC)
protocol.txt (commands the board can understand)

The second part is the software (completely developed under Linux). It is a little perl script for accessing and analysing the log file of the webserver and a little C program for sending commands over the serial port to the hardware. The hardware understands commands for controlling the speed of decreasing the brightness(look at the protocol) of all lights and commands for increasing the brightness of a particular light.

How does it work?

 

The perl script is started by a user how has access to the logfile and to the serial port. It gets two parameters: path to the access.log and a positive integer which is the timeloop for controlling the lights.
The script trafficlights.pl forks a child proccess which does a 'tail -f' on the access.log of the webserver. The output of the tail-command is piped into a file. This file is accessed, read and also killed by the parent proccess. This proccess compares the strings in the accessed sites with search patterns defined at the beginning. A particular hit is a particular positive integer between 1 and 3. So the scripts builds a string of integers (e.g. 11221333331). Then it executes the C program (sersend) in the background with the string as one of the parameters. The other parameters (baudrate etc.) are for controlling the interface. Sersend sends one integer every second. Meanwhile the parent proccess of trafficlights.pl sleeps the time you given as the second parameter at starting. After the time exceeds the whole comparing and string building will be done again. The child process (tail -f ...) runs the whole time till you stop trafficlights.pl.

Code:
trafficlights.pl
sersend.c

Further Readings


Matching Information and Ambient Media

http://www.teco.uni-karlsruhe.de/~albrecht/publication/cobuild99/ambient.pdf
http://www.teco.uni-karlsruhe.de/~albrecht/publication/cobuild99/slides/ambient_media.html

Photos

 

The controller hardware
look here for further information)

controller hardware

trafficlights in action

trafficlights