Hacking Up the Odominator

March 06, 2013

Like most Squares, I like to make things. By day, that means coding up a storm, but by night, you can often find me standing over a laser cutter or inhaling some solder fumes. When our quarterly Hack Week rolls around, I like to try to think of projects that combine my personal interests with what my fellow Squares and I are doing day to day.

If you’ve ever visited Square’s offices, you’ll have noticed monitors hanging from walls and ceilings all over the place. We call these inforads (“information radiators”), and we use them to display various dashboards and metrics. They cover everything from transaction volume to system health to our @Square Twitter feed. We like inforads because they provide us with useful information and give us an opportunity to experiment with visualization technologies.

My Hack Week idea was to create an inforad of a different kind, one that was low-tech but high-style. I wanted to use my physical maker skills to create a display that was informative, fun to look at, and fun to build. What I came up with is The Odominator. Here's a video of it from testing:

The Odominator is a mechanical counter. It works just like an old-fashioned (non-digital) car odometer, except it doesn’t count distance – it counts dollars. The digits are driven by a motor that’s controlled via a website hosted on the embedded Arduino microcontroller.

Oh, and did I mention that it’s two feet across?

This was a challenging, but super fun, project to take on. As a software engineer, doing projects that take place in “real space” are challenging for a number of reasons: cost and imperfection of materials, errors in fabrication and assembly, and lack of alignment between physics and my imagination. (It turns out that geometry is not too flexible, and, you know, not easy.) But with the help of a few fellow Squares’ complementary maker skills, we were able to produce a working prototype in a week. After some thoughtful reconsideration of the mistakes we made, we finally completed The Odominator last week.

So how are we planning to use it? At Square, one of our most important metrics is something we call GPV, which stands for Gross Payment Volume. It measures all the money that flows through Square, and it is one of the clearest measures of our success as a payments company. When thinking about a physical way to display GPV, an odometer was the most obvious answer, since it only goes up and never resets. Plus, you get that nice “roll over” experience when higher digits advance.

How it works

The whole project was custom-designed in an open-source CAD solid modeling tool called OpenSCAD. It’s a great tool that’s much-loved by the 3D printing and laser cutting communities for its great flexibility and open nature. Unlike expensive tools like SolidWorks, it has fewer features but really caters to the software developer audience – instead of drawing your design with your mouse, you type instructions that render into 3D objects, and it allows use of things like functions, loops, and variables. Lots of people in the community have contributed libraries to do things like render involute gears, making it easy to design complex devices like this one.

The trickiest part of the build was getting the mechanical counter gearing correct. It’s just about a textbook implementation of a mechanical counter, using what’s called “mutilated gears” to translate constant rotation into the periodic movement of the upper digits when the lower ones roll over. It turns out that it’s very important for the ratio of teeth between the number-bearing gears and the connecting gears between them to be exactly 20:8, which is something I didn’t understand until the prototype was completely assembled. Instead, I chose 40:8 for the sake of convenience, and ended up with a machine that didn’t rotate cleanly for more than one roll-over. Luckily, after some desperate simulation in my CAD software, I figured out that I could modify the ratio to 40:5 and it would work. This was a huge relief because otherwise I would have had to scrap the eight copies of the numeral drum I’d already fabricated. At $20 and 45 minutes at the laser cutter each, it would have been an enormous rework cost that might have sunk the project.

To control the digits’ motion, our team fabricated a custom electronics package around an Arduino Uno, which is a low-cost, easy-to-use microcontroller, and an Ethernet adapter designed to work with it. The microcontroller publishes a minimal web interface which does nothing but offer a text box where you can enter how many steps you want it to advance. When you enter a number, the microcontroller turns on a small DC gear motor. The motor is equipped with something called a quadrature encoder, which counts how many times the output shaft has turned. The microcontroller monitors the quadrature encoder’s output and turns off the motor when it’s reached its target.

The external case was also designed in OpenSCAD. For the most part, it’s just a clear acrylic box that slots together and is bolted shut across the top and bottom. One of our great visual designers took some time and hand-lettered the text and customized logo, which I laser-etched on the face of the box.

To finish it off, we created connections on the side of the box for 1/2" steel pipe flanges. Originally designed to be hung from the ceiling, we ultimately decided to put it on a tabletop instead, so I built a set of legs and feet out of off-the-shelf pipe fittings. The power, Ethernet, and USB programming interface wires are threaded down the tube and out the back of the device.

All of the components, except for the motor, off-the-shelf electronics, pipe fittings, and fasteners were custom-made. We made the custom electronics on a proto shield in our hardware lab, and the rest of the components (gears and case) were laser cut out of acrylic plastic around the corner at TechShop.

The best part? It’s open source! You can find the all the design files and custom software we’ve written in my GitHub repo. Additionally, here’s a detailed parts list. If you want to put one together, get in touch through the comments or on GitHub and we can talk about the project!