THE LINUX COFFEE PROJECT

In this project we upgrade an ordinary coffee machine with a computer interface. The objectives are:

Hardware

Turning the coffee machine on and off was simply realized with a relais. Measuring the contents is a bit more tricky. We choose to let the coffee pot be one capacitor, and connected that to an oscillator. The frequency of that oscillator varries with the capacity of the coffee pot. A second oscillator works with a fixed frequency, serving as a clock generator. For each clock pulse, the amount of pulses from the first oscillator are counted, and outputted as a 8-bit number. This number is aquired with the parallel port, and compared with calibration data to yield a usable estimate of the coffee level in the pot.

Software

For controlling the parallel port in Linux, the parapin package is used. This is a library which allows the user directly to control each individual pin of the parallel port.
Since the parapin package demands root priviliges and the apache web server does not permit to run scripts with the SUID bit set, a client server model is designed: The web interface talks to the server via some simple programs located in the cgi-bin. These program use named pipes (FIFOs) to send commands to the coffee server, which runs with root privileges. Some commands require an answer back from the coffee server, which then are interpreted by the CGI script and converted into HTML code.
The source code of the files are available [ here ].
A page with pictures from the assembly can be found [ here ].
Screenshot of the web interface
Software concept overview.