top of page

Design & Build

The Design
 

The idea was simple, connect a physical gauge to display Internet usage. But having never done anything like this before, it turned into a long project costing a few hundred dollars. But to be fair, most of the expense was due to ideas or componants that I ended up not using.

 
First Attempt

 

With no idea how to connect a computer to a steam pressure gauge, I went to Google.  Since I had no clue, I decided to purchase kits from PC Control. The more I read, it appeared a servo was a better choice (smoother motion, less power consumption, more local knowledge at the hobby store).  So even though I ordered both a Servo Pack and a Stepper Pack, I never even opened the Stepper. Ultimately the servo worked fine but I am a little curious how the stepper would perform.

 

The Servo Pack Starter Kit gave me the initial understanding of how I would connect the computer to a servo... USB. But I was just getting started.

 
Wireless

 

This was my biggest mistake.  I thought it would be fantastic to have the gauge work wirelessly. I could just hang the gauge on the wall like a clock. So, back to Google, I ended up on a great site RobotShop. After a lot of research I settled on a wireless transmitter/receiver pair that could handle the servo data. It worked but it was not stable. The servo jittered and I couldn't determine why. I worked on the wireless jitter for weeks but my limited electronics background failed me. This was very discouraging and effectively killed my project for almost two years. In retrospect, a wireless soultion is not a good idea because of the power requirements. A constantly running servo can drain a 9v battery in a couple of days.

 
Hardware / Software

 

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.

 

Arduino

 

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.

 

Servo
 

I thought the servo choice was simple. It had to be small enough to fit inside my gauge and it should be inexpensive. I picked one, it worked, I was happy. Until I reached the point of checking the accuracy. My local hobby store recommended I upgrade to a digital servo. Digital servos are fast and supposedly more accurate. That speed comes at a cost... power. And power is a problem since I'd decided to power my servo directly from my Arduino (not recommended by users online). I returned to an analog servo, just a better model. I also kept my servo power from the Arduino... no problem.

 

Linkage

 

My initial connection from the servo to the gauge was a straight wire (paperclip). This worked well but introduced some accuracy problems due to the arc of the servo movement translating to an almost linear pull on the gauge mechanism. I found that positioning things temporarily with rubber cement helped, but at some point I had to make things permanent. Repositioning of the servo might have helped but it was already glued into position.

 

After the accuracy problem with the original servo, I had to replace it. I decided on a string pull around a pully for the new servo. Hopefully more consistent movement.

 
Accuracy

 

The new servo seemed more accurate but again it was difficult to be certain until everything was permanently positioned (glued). I positioned my pully, added my string from the servo to the gauge, glued it all down and began my final testing. It was still off. Accuracy was good though the middle of the servo range but the beginning and end were moving further than expected. Hours of testing and noting the expected positions vs. the actual positions. Pads of paper with lists of crazy numbers. Discussions with a math professor as to how to write a formula that would adjust the servo positions to be more accurate. Even using logarithmic functions. I got a little crazy, but...

 

My math works, and it's quite accurate.

bottom of page