in danish  air quality | prototypes | specifications | contact
Final version

Below are the diagram and Java code of the final version. The Java code pulls data from the Internet. Through a "labjack" a linear acentuator is controlled that opens and closes the window accordingly. There are as well installed contacts on the window to stop the acentuator from going beyond the maximum positions.
diagram (.pdf)
java code (.zip)
The code is open source.
Diagram and code by Kristian Fredslund

Image on the left from installation on the Copenhagen City Hall
Previous version
LED prototype in the city. The indicatoren shows levels for today and the next two days,
About the indicator
The indicator takes data from the Internet about the current degree of pollution and prognosis for the next two days. The data is supplied by The National department of Environmental Investigation and is updated 4 times a day. It works in the following way: a computer reads a web page, sorts the information and send them to the serial port. This is connected to a processor that in the example to the left controls a series of LEDs.

The Indicator is Open Source and copyright free
That means that everyone is encouraged to copy and modify the code and develop it further. All software is made with programs that are freely available on the Internet.

Environmental computing
To take data from the Internet and give them a physical form open to many possibilities for DIY monitoring, or to make actions take place in the "real world" as a consequence of action, news or statistics from the Internet.


Window indicator on the city hall

In this proposal a similar system controls a window opener, that closes and opens a window on the city hall depending on the current pollution level. The public can read the indicator from the street. Closed window=warning, all open=below average

Image of a board (click for larger image) servo in bottom of picture. Picaxe processor top right

List of components (for prototype)

Picaxe 18x processor
9V battery
5V regulator
servo motor
Resistors; 330,10K, 180, 22K
USB to serial port converter

Comming soon
Thanks to Niklas Roy

The program is written in Processing which is an open source programming environment.

It is written by Jörg Pohl from based on code by Tom Igoe, and idea by Nis Rømer. The code can be seen below or downloaded here

// Pollution Display
// written by Jörg Pohl
// uses http client written by
Tom Igoe
// concept Nis Rømer

/* Comment, what this program does is connect to an internetpage and "read" the content, then it searches  for special characters that identifies the data we are interested in in the webpage. From there it sends the data to the computers serialport. A Picaxe processor takes the data from the serialport and mooves a servo acordingly. The script can be modified to suit a number of purposes that deals with displaying data from the internet in the "real" world. A beginners manual for customizing the script is to follow.

// uses http client, written by Tom Igoe
// http client

// Starts a network client that connects to a server on port 80,
// sends an HTTP 1.1 GET request, and prints the results.

import processing.serial.*;

Client client;
Serial port;

char thisByte = ' ';
int hour_old = -1;
String sInput;
String sOutput;
PFont fontA;        // Font for printing

void setup()
  size(200, 200);

  // Load and prep fonts to print to window
  fontA = loadFont("CourierNewPSMT-24.vlw");
  textFont(fontA, 24);

  // Open a TCP socket to the host:
  client = new Client(this, "", 80);
//above is where you fil in the domaine ex

  // Print the IP address of the host:

  //the port is set to 2 and baudrate set to 4800,  changed to COM1, 4800bps
  port = new Serial(this, Serial.list()[2], 4800);


void draw()

  int m = month();  // Values from 1 - 12
  int y = year();   // 2003, 2004, 2005, etc.
  int h = hour();   // 0-23

  int i;
  String s;

  if ( m < 10 )
    s = String.valueOf(y) + '0' + String.valueOf(m);
    s = String.valueOf(y) + String.valueOf(m);
  text(s, 10, 56);

  if (h != hour_old)   // read website every hour
    // Send the HTTP GET request:
    client.write("GET /the_path_to_your_file.html HTTP/1.1\n");
//this points to the file on the internet with the data (rest of path. ex you want:
// then you write /news.html
    client.write("HOST: \n\n"); //again substitute with your URL
    hour_old = h;

  // Print the results of the GET:
  while (client.available() > 0)
    sInput = client.readString();
    i = sInput.indexOf (s);  // searching for datestring yyyymm
    i = i + 10;  // add offset to information
    if (i != -1)
      sOutput = ':' + sInput.substring (i,i+3) +',' + sInput.substring (i+5,i+8) + ',' + sInput.substring (i+10,i+13) + char(13) + char(10);

  // reads and print serial input from PICAXE     for Debugging
  while (port.available() > 0)
    String inBuffer = port.readString();
    if (inBuffer != null)

/* Example of what is printed:
this is an example of what the http client writes
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
X-Powered-By: ASP.NET
Date: Mon, 29 Aug 2005 08:15:03 GMT
Content-Type: application/octet-stream
Accept-Ranges: bytes
Last-Modified: Mon, 29 Aug 2005 05:13:27 GMT
ETag: "c3fc566358acc51:96b"
Content-Length: 25



'PICAXE Environment Pollution Display
'serial connection to PC

'Connect IN5 with TXD (PC)
'Use Terminal with 4800bps, 8, N, 1
'09/2005 author: Joerg Pohl
'using picaxe 18x processor

'Define ports
symbol SIn = 0      ' serial Input Port
symbol SRVOut = 0         ' Servo Output Port

'Define variables
symbol day1 = b0
symbol val1 = b1
symbol day2 = b2
symbol val2 = b3
symbol day3 = b4
symbol val3 = b5
symbol srv  = b6

  serin SIn,N4800,(":"),#day1,#val1,#day2,#val2,#day3,#val3 
' read from serial
  sertxd (#day1,#val1,#day2,#val2,#day3,#val3)  
' feedback for debug

  srv = 150                                     
' for safety if value wrong
  lookup val1,(0, 75, 112, 150, 187, 225), srv

  servo SRVOut, srv

  goto main

397 397