Network Bandwidth Meter

This was a fun project. I like the idea of analog gauges monitoring the vital statistics of computers. Network traffic meter

Hardware

The meter came from eBay, and has a 1 mA full scale movement. It was already marked 0 to 100. I simply removed the original scale, scanned it, and added the "% NETWORK" markings over some of the original ones with an image editor. I then printed the new scale and glued it over the old one.

The circuit is a simple design using a Maxim MX7224 8-bit D/A converter, with the digital inputs driven directly by the parallel port. Power and reference voltage come from a disk drive connector. The schematic is available here. I built the circuit on a piece of perfboard and affixed it to the back of the meter. There's nothing critical about the circuit, but be particularly careful to avoid shorts. PC power supplies can source 30 amps or more. This will destroy a meter movement in an instant, and smoke the insulation right off thin wire without the supply even recognizing a fault. The MX7224 is a CMOS chip, so use some precautions to avoid static discharge while handling it, and use a grounded soldering iron if you don't socket the chip.

Possible refinements would include using the MX7224's latch lines to allow driving multiple meters off one port, or to allow a printer pass-through. An antique wood-cased meter with this circuit built inside would make a lovely external version; the MX7224 can source up to 5 mA, and an emitter follower could be used to boost the current for meters that need more.

Software

The software includes a simple C program to do the actual bit-twiddling, and a Perl program to calcuate the bandwidth usage from netstat's output. These are both pretty FreeBSD-specific. It should, in theory, be possible to do everything from Perl, but using non-standard ioctls from Perl isn't easy.