A Real-World Website Counter

Good to 100,000 hits.

The website mileage counter.

Back in the earlier days of the Internet, you always used to see those old-school image-based web counters, showing the number of times the Library Of Congress or even the White House, for example, had been whacked since their inception.

These counters were really popular for some reason, possibly because everyone was still reeling at the idea of the number of possible hits they could get from random web surfers around the world.

Princess Auto (and the inner Geek) strike again

While wandering around at Princess Auto, I came across some odometer-style hardware. In order to effectively browse, you have to be thinking ahead in terms of project ideas for using items you may come across. (You never know what you might find.)

After finding the odometer, I had to ask myself the obligatory question. "What cool stuff could I do with this $4.99 item?"

The mind's pocket-protector-bearing side (naturally,) quickly went to work: "Wire it to a computer, put it online."


Involved in this amazingly-complex1 project were the following components:

  • Electronic Counter
  • 5V/24V Relay
  • 4n33 Darlington Opto-Isolator
  • 24V Power Supply
  • 100K Resistor
  • Parallel Port Cable

The plan was to use the 5V output from the parallel port to trigger the relay via the Opto-Isolator (preventing feedback from the coil which would probably otherwise damage the port.) A roommate handled the soldering, leaving me to hack up the parallel cable and write a simple C program to handle the low-level signal output.


"Turn all pins high, then low." That was the only work required for controlling the counter (pin 6 of the parallel output is tied to the Opto-Isolator on one end, the other of course is to ground.)

  • outport.c

    #include <dos.h>
    #include <iostream.h>

    void main() {

    cout << "Output 255\n";
    outportb(0x378, 255);
    cout << "Output 0\n";
    outportb(0x378, 0);

  • PHP

    Relayed/redirected connection of some sort from server (yet to be done.)

Further considerations

Some potential future additions:

  • Browser tracking

    If you're going to grab some numbers, might as well get them all at once.

  • Counter webcam

    Somewhat ironically, tying this back to the web via a webcam-type service (providing a picture of the current nubmers,) is a possibility (though not terribly useful.)

1Apply sarcasm liberally, reconsider lightly.