Office control system
Toilet telemetry and door control

Installed in a busy London IT department, the Office Control System allows the office toilet status to be determined via a simple desktop interface. In addition, the office door lock can be released by all IT staff using the same interface.

Problem 1: toilet disappointment
There are 10 boys and 3 girls in the office and single pair of lavatories. This can lead to device contention, especially after a long lunch. To prevent a wasted journey and disappointment, a system was developed to enable the toilet status to be transmitted to a server PC and displayed on a intranet web page. A desktop application was also produced to present this information in an unobtrusive way in the system tray area of the screen.
Click here for live toilet status!

Problem 2: getting up to let people in
The IT department is continuously plagued by enquiries from lusers, many of whom sadly still insist on using the real-time audio/visual 'human interaction' interface. While this is clearly something to be discouraged, it can sometimes be unavoidable and so a method was needed to trigger the office door's electronic lock remotely without having to move from our terminals.

The solution:

The following system was developed to address the problems:

The details of the system are discussed below.

1. Toilet telemetry

Toilet occupancy is determined by switches attached to the toilet door frames, cunningly fashioned from paperclips and drawing pins. These switches are closed when the doors are locked and are springy enough to stay open even if the doors swing shut.

Toilet temperature is measured using the Dallas 1821 temperature sensor. The data is gathered by a PIC16F84 microcontroller and transmitted to the server via hybrid 433MHz digital transmitter/receiver pair. The data is transmitted once every 5 seconds and the rest of the time the PIC is in low power sleep mode. So far the system has been operating for 6 months on the original set of 4 alkaline AA batteries.
The receiver is located in the office and connected to a USB/serial converter on the server PC. Power for the receiver and the door-release transmitter (see later) is taken from the USB port.

The receiver module and door transmitter driver transistor

The data is transmitted as 2400 baud RS232. The format of the radio data packets consists of 7 characters:


Where '*' is a 'ready' character, 'B' and 'G' are the door states of the boy's and girl's toilets and are encoded as 'O' for open and 'C' for closed. 'T' is the binary encoded temperature in degrees Celsius plus 50 and 'C' is a simple 8-bit checksum. The packet is terminated with a carriage return/linefeed.

The server PC receives and decodes these packets and runs a simple web server. The telemetry data is presented on a HTML page:

In addition, a tray application gathers the data from the web page and displays it as a tray icon. The boy's toilet is the figure on the left and the girl's on the right. The boy and girl icons change to red to indicate that the toilet is in use.

The temperature is determined by hovering the mouse over the tray icon.

To make sure the Mac users don't feel left out, a Konfabulator widget is also available:

The toilet status is uploaded to the internet whenever the state changes. It can be viewed here: Live toilet status!

2. Remote door control

In order to be useful the door had to be controllable by everyone in the office and so a network application similar to the toilet status indicator was required. This door isn't near any network points or computers so it was decided that radio control to the existing toilet status server was required.

The IT room door lock is triggered by a button on the inside of the door. A relay was connected across this button to allow the door mechanism to be triggered electronically. The receiver module from a miniature RC car was removed and the main drive motor control was used to trigger the relay.

The transmitter was modified so that the 'forward' signal is always transmitted when the transmitter is powered up. Then the transmitter power was connected via a transistor to the server PC's serial port CTS line. When this line goes high the transmitter is energised and the door is unlocked. The toilet status web server software was modified so that a certain password-protected HTTP request triggers the door. This request can be generated by clicking a link on the toilet status web page or by double-clicking the task bar toilet status indicator described above. This way anyone on the company intranet can open the IT room door. Some method to determine the client's physical location may have to be determined as people working from home over VPN as well as in the Hong Kong and San Francisco offices can do it too.

The server installation