« back to project listing

The Custom Watch

February 2009 - unfinished/abandoned

Backstory

I've always liked watches, and in, oh let's see... sheesh, February of 2009, I started working on making one of my own from scratch with my friend Tadge. He came down one weekend and helped me figure out the datasheet for some LCD screens I got on SparkFun, and we set to work getting a little operating system running on an ATMega that would show a few different screens.

Watches are a fun engineering challenge for a few reasons. First, they have to run 24 hours a day, every day, so you need them to be reliable and incredibly, impossibly efficient. That means no backlights except very occasionally, and preferably putting the microcontroller to sleep every chance you get. Also, they have to be small enough to fit on your wrist, and third they have to obviously be able to keep time, which means not messing up by more than a second or so a day.

How electric clocks work

The way watches, computers, synthesizers, radios, microcontrollers and all sorts of things keep time is with piezoelectric crystals. These are little electric modules with two pins that vibrate at very particular frequencies when electricity is applied. So where a grandfather clock uses a pendulum that resonates at once a second, nearly all watches use a crystal that oscillates at 32,768 times a second. Why such a specific number? It has to do with how computers count and store information. The amount of information you can store is 2 to the power of the number of bits you have. So if you just have 1 bit, 2^1 = 2. You can have a 1 or a 0, and nothing else. If you have 2 bits, 2^2, 00,01,10,11. 4 possible combinations can be made with 2 bits. 3 bits is 8 combinations, and so on. 8 bits is a byte, and a bytes can represent 255 different values (FUN FACT: the reason Link in the original Legend of Zelda for NES can only carry 255 rupees at a time is because they used an 8bit unsigned int variable to store that value!). So since 32,768 is exactly 2^15, it is a nice number to store in 15 bit binary (11111111 1111111).

In electronics, there are little chips called counters that will add up high/low transitions, like those generated by a crystal, and convert them to be bits on a bunch of pins in parallel. If you have a 15 bit one, then it will overflow and reset back to zero, everytime it hits 32,768. So, if our crystal vibrates that many times per second, then it'll do that once per second, and oingo boingo, we have our second hand.

Using a circuit like the above lets you put most of your watch to sleep for most of the time, as the built in counter on the microcontroller can run while the rest of the chip is asleep. This meant that in clock mode, I could draw whatever I wanted to on the screen to show the time, and then put the everything to sleep. At this point, the only thing really running on the watch is the tiny clock crystal and counter, which use a hysterically small amount of energy. This meant I could really sip the precious electricity from our tiny battery. This is the electrical equivalent of what an escapement does in a grandfather clock or pocket watch, and the counter acts like a 32,768:1 gear.

Writing drivers for fonts and shapes

Also the screen we got had a SUPER low-level interface. I think it was just a TTL serial interface, and you'd send it RGB values for each pixel one at a time. This meant that to show, say, some letters, I couldn't just send "HELLO WORLD" to the screen and have it know what to do. I had to get a bitmap font in a multidimensional C array on the microcontroller, and then have a lookup function that would go through a string, grab the right hunk of bits, and draw every character to the screen pixel by pixel. It was a NIGHTMARE, but I actually got pretty good at it after a lengthy and super helpful Tadge explanation, and what seemed completely impossible at the beginning actually becomes abstracted away from you pretty quickly. Knowing what was involved to get this working gave me a real appreciation for the dark magic that's required to update your multi-megapixel computer screen at 60hz.

Once I got some of the helper functions out of the way, things that would write characters to the screen, I found out that you could create pointers to functions, and started using that to make different "screens" that you'd be able to cycle through sequentially by just pointing an "update" pointer at the particular method that drew them. Since there were no drawing apis available I got/had to learn about Bresenham's line algorithm and the midpoint circle algorithm. These, at a very low level, will let you plot a line between two points on a grid, or draw a circle of a certain radius. It was empowering to get this low level, and by the end I realized I had all the tools to remake mystify and a functioning analog clock.

Why'd I abandon it?

I did the math and had a pretty good idea that I could get this running for a day or so before I'd need to change out a watch battery, and even had a tiny rechargable watch battery and some flexible solar panels that I thought might just be enough to keep it humming indefinitely as long as the backlight was pretty much always off (which turned out made the screen completely 100% invisible) and it didn't do anything but update the screen once a second (or maybe even less). But still, thin margin of error, and there's no way the solder joints would have lasted more than a day on a wrist-bound solar panel.

Also: avoid LCDs with separate backlights! These days you can get a sweet OLED panel for pretty short money that has all sorts of advantages over LCD, both in power consumption, image quality and ease of use. These weren't really around in consumer-friendly form when I was doing this project, but now there's lots of oled modules on Adafruit with demo code and nice breakout boards. Kids today have it easy, is what I'm saying.

More than anything, though, this got canned because it was before the age of 3D printers, and lacking the skills to really manufacture anything small enough to contain the ribbon cables and other nonsense on here safely, cheaply and compactly, I eventually let it go. I would like to give it another go someday, and maybe even get around to making a watch that only tells you what year it is now that I have access to places like Danger!Awesome and 3D printers have gotten pretty good and cheap. At the time, it was a bit advanced for where I was with industrial design and manufacturing.

More Info

« back to project listing