I wanted a clock. But not just any clock! I wanted it to be able to change the timezone being displayed at the flip of a switch. And I also wanted to use it at Burning Man, to show my location not in time, but in the clock-face addressing system used in Black Rock City. And I wanted it all mounted inside a hat. And, of course, it should look great.
This meant I needed separate control over each clock hand, driven by a microcontroller of some kind. I decided to go with Arduino because that's easy and relatively cheap, but it doesn't really matter.
To drive the hands I used micro RC servos, because those give easy angular control. Libraries exist for pretty much any microcontroller that let you control RC servos. You tell them what angle to go to, and they go to that angle. Simple! For use in controlling a clock hand. though, there's a problem. Standard RC servos only have a 180 degree range, sometimes a bit less. That's no good for a clock hand that has to rotate at least 360 degrees! I'd have to use gears, which meant the drive system was definitely too large to fit inside the hat. It would have to be mounted on the back side, with the clock hands controlled via coaxial drive shafts that passed through the center. A bit clunky, but in an enjoyably steampunk fashion. Why, yes, those are gears on my hat -- and they do something!
Step 1: Gear System and Mounting Brackets
The first step was designing the gear system. I went with 3:1 -- 36 teeth on the servo gear and 12 on the clock handle shaft gear. This was a bit overkill, and if I were building it again I'd probably go with 30/12 or 28/12. Might as well save some torque since we only slightly over 360 degrees of range.
The problem with gears is that they're annoyingly expensive, and it can be difficult to mount them concentrically with the equipment in a home shop. Both of these problems are solved if you get your own laser cut. I do my design in Inkscape, but other vector drawing programs would work. Inkscape comes with a tool for drawing gears, but it's not very configurable and the gear tooth profiles it generates are quite crude. To solve this I wrote an Inkscape extension for generating gears. (It also does sprockets.) This creates mathematically accurate teeth profiles, allows the size to be specified in all 3 major industrial systems, and can even generate internal gears for a planetary system. I might be biased, but I highly recommend it over the stock Inkscape tool.
While I was getting the gears cut, I decided I might as well get other stuff cut as well. In the SVG example file I've attached, there are also mounting brackets for servos and shafts, spacers for the gears, and basic clock hands. The servo gears screw directly to the servo horns, and the shaft gears are sized to fit snuggly in the brass tubes I used for coaxial shafts, reinforced by crimping the ends. Make sure that the inner shaft can rotate freely when you select your stock! It's being turned by a tiny servo, at a 3:1 mechanical disadvantage. You might need to lubricate it with powdered graphite to get it working.
Step 2: Mode and Power Switch
A system like this needs a control panel, obviously. I decided to make mine from etched brass, a technique I use on many of my projects. This process is explained very well in other places, so I'll only briefly cover it here.
First I designed the panel in Inkscape. Coming up with fancified, steampunky names for on/off as well as the timezones was particularly fun. I used a basic rotary switch for the mode selector, and a weird toggle switch I found in my collection for main system power. Once I was happy with the design, I printed it backwards on glossy photo inkjet paper using a laserjet printer. This was then transferred to a sheet of brass by use of a hot iron. The brass was immersed in ferric chloride, which ate away at the metal everywhere it was exposed. The sheet was cut to the final shape with the use of a jeweler's saw, then painted black. I carefully sanded away the raised sections of the plate, revealing the shiny brass underneath. Finally I bent the plate to match the curve of the hat and pop-riveted it in place. When riveting something like this, be sure to protect the finish with a shop rag or something. The rivet gun tends to jump and can easily scratch up the surface you just spent hours getting perfect!
Step 3: Arduino Control
The whole system is controlled by an Arduino. This has a screw-terminal breakout shield, to make sure the connections don't vibrate loose as I'm walking around, as well as a GPS shield for the Burning Man address mode. It also has a real time clock (RTC) module, since the main point of this whole thing is for it to keep time!
These are all mounted at the top of the hat, along with the 9 volt battery supplying system power. I recommend getting as tall of a hat as possible, as the components do tend to poke my head a bit at certain angles. There is plenty of room on either side of the coaxial shafts, but you'll have to be a bit creative to get it all to fit. Make sure nothing is rubbing on the shafts, as they need to turn freely!
The Arduino code that I've attached handles both the clock and the GPS modes. In clock mode, it reads from the RTC, adjusts for the specific time zone, and sets the hands accordingly. In GPS mode it reads the current position, calculates the angle from 12:00 using the 2014 Burning Man coordinates, and sets the hands accordingly.
Step 4: Final Results
With a final touch of cutting a pair of custom clock hands from brass sheet with a jeweller’s saw, the hat was finished. It has proved to be one of my more successful projects. It works well for wearing at cons, and it's a good conversation starter. Most people are surprised that it's a real clock at all, much less that I can change the timezone, much less that it has a GPS mode!