Internet usage is typically measured in Mb/s (Megabits per second) and dispalyed as a graph on a monitor or smartphone. In this project I’ve taken the same data and translated it to a real world gauge. A steam pressure gauge from the early 20th century.
Data is collected by polling an Internet router, in this case the router for the Vancouver Convention Center. The data is converted to a 0-200 scale to match the steps on the pressure gauge. Next the data is sent to a microcontroller which moves a servo to the appropriate postion. The servo is connected to the needle of the pressure gauge.
While this seems relatively straight forward, it required a lot of trial and error and adjustments to get accurate physical movement that matched the Internet usage data.
The most interesting thing in this entire project was the realization that Interenet usage statistics are usually averaged over a longer period of time. The Internet Steam Gauge checks utilizaiton every 10 seconds and is therefore more accurate than most monitoring systems…
I renewed my project in 2013 satisfied that it needed to be a wired device. I didn’t want to run it from my home computer, I wanted it to be portable… maybe a cheap laptop. Cheap. hmm… I recalled a hobby computer called Raspberry Pi. I’d been playing with Linux for a couple of years so it seemed like a good fit. Next I needed a programming language to read the Internet bandwidth and send it to my servo. I’d always wanted to learn Python, ok Python it is.
The RasPi has connections to drive the servo directly. So this will be simple, connect the servo, a little programming, and done. Wrong.
Learning a new language is challanging but the real problem came when my servo developed a smilar jitter problem as my original wireless design. The problem this time was the computer itself. The RasPi is a hobby computer, designed to be inexpensive for learning. It is not very fast. The interrupts from the normal RasPi operations created enough inconsistancy in the servo output to cause the jitter. The solution was another device, an Arduino microcontroller to drive the servo.
My first thought was to use the Arduino by itself, why even connect the RasPi? The Arduino can run code but you have to tell it everything you want it to do. That’s a problem because Arduino doesn’t know the current bandwidth. To get the bandwidth I need to poll my Internet router via SNMP. Arduino can respond to SNMP, but I could find nothing that allowed it to make SNMP queries. It might be possible but I don’t know how. So my Arduino knowledge (zero), needed to be expanded. Weeks of small aggravating problems like why did I loose my serial connection, or did I just brick my Arduino, unexpected reboots, etc. It was fun-aggravating-fun.
But in the end, I found no way for the Arduino to read the bandwidth directly from my router. Instead, the RasPi will read the data and pass it to the Arduino.
Each Friday is PiDay here at Adafruit! Be sure to check out our posts, tutorials and new Raspberry Pi related products. Adafruit has the largest and best selection of Raspberry Pi accessories and all the code & tutorials to get you up and running in no time!