Renovating antique pressure gauge to display internet bandwidth

Who doesn't like old technologies? Like a Nokia cell phone as heavy as a brick and built to last centuries (literary)? I do like old stuff, my dear readers. That's why when one day I came across a cool looking (and rightly priced!) antique pressure gauge on ebay I bought it with very little hesitation. Presumably, gages like this had been used on steamboats and locomotives. At that point I already got an idea to upgrade it to use this piece of the ancient technology for modern purposes, specifically to measure my home internet bandwidth utilization.

And this is what I got in the mail few days later:

Source 01

Source 02

Not cool. I am not ready to hang this at my desk - it's too ugly even for me, not to mention my wife. What I really wanted to see is a brass bezel and black body not a rusty bezel and grey rusty-dusty body.

I desperately needed some magic and I found it in the local hardware store: sandpaper, paint remover and spray paint!

After applying my newly acquired magic the gauge started to look much more appealing:

Progress 01

That’s better. But I still needed a different kind of magic to make it measure something more useful for me than steam pressure. I was thinking of creating an application (running on the PC) to calculate bandwidth utilization and somehow send this information to the gauge via USB.

But how to make the needle move? The answer came from China in form of the miniature RC servo. RC servos are typically used by hobbyists in the radio-controlled models and robotic applications. And it’s a perfect fit for this project because:

  • It’s small, so it fits to the gauge easily
  • It needs 5V power supply (since I am planning to use USB and it provides 5V)
  • It’s easy to control it

But here is a downside - RC servo needs a precise PWM (Pulse Width Modulation) signal for positioning. PC/Windows was born to be almost useless for generating any precise timing/pulses, so I needed something else to generate it. I elected an Atmel AVR microcontroller for this job. Why AVR? Just because I used it before, know this platform reasonably well and love it (well, sort of). Unfortunately, the smallest/simplest AVR microcontroller I was planned to use didn't support USB communication, so I had to add USB-to-serial converter to the mix, since serial protocol is easy to implement even on the tiniest microcontrollers.

Now I am ready to put it all together:

  • PC runs a .NET application. This application calculates bandwidth utilization and sends it to the gage. It sends utilization as percentage, since the gauge is calibrated 0-100
  • Inside the gage there is a USB-to-serial converter that talks to the AVR microcontroller via asynchronous serial communication (this is just a fancy term for serial port)
  • Microcontroller converts utilization percentage to the PWM signal and sends it to the RC servo.
  • RC Servo controls needle position utilizing parts from the original mechanism.

Completed gauge with scale removed:

Completed Open 01

On the picture above: RC servo (blue thing, covered with whitish mass), USB to Serial adapter (green board) and microcontroller (small 8-pins chip, to the right of the green board). Everything mounted inside the gauge using my favorite method - glue gun (I am pretty sure Wikipedia knows a better term for it, but "glue gun" is just sounds dangerous).

Now back to the .NET application. It turned out that it's very easy to read a whole bunch of the statistical data from my home wireless router, because it supports a SMNP protocol. SNMP is a standard network management protocol supported by most of the network devices (computers, routers, printers, etc); it provides access to the device internal status/variables/parameters.

The most important variables to me were sent/received byte counters. There is one set of counters (upload/download) per each Ethernet port (my router has 5 ports); I care only about Ethernet port connected to my DSL modem. By querying these counters every second it's trivial to calculate upload/download speeds. But to calculate bandwidth utilization I also needed to know my maximum Internet upload/download, is a hero of determination of true Internet speed.

Cool, I can calculate both upload and download bandwidth utilization, but which one should I use for the gage? I tried a few options and I found out that I personally like a maximum between upload and download: it tells me when to expect web surfing bog-downs.

.NET application interface is pretty simple, nothing fancy:

Application 01

This is how completed gage looks like:

Completed Closed 01

Thank you for reading my hummble blog and have fun hacking the stuff.

Ah right, I forgot the video of the completed system, enjoy: