Crazy clock movements - Page 1
Forum section: electronics / projects

author: nsayer
author_rank: Regular Contributor
timestamp: August 20, 2014, 07:45:47 pm
content: I thought I'd share (and maybe plug) a thing I've been working on lately.If you flip around just about any cheap wall clock made in the last 30 years or so, you'll see a black or clear plastic box around 2 inches (5 cm for the rest of you) square that takes a single AA battery.There are a ton of manufacturers that make those, but apart from the details of internal component arrangement, they're all exactly the same: there's a gear train that ends with a gear that has a permanent magnet in it. That gear floats between two poles of an electromagnet. The coil wires are soldered to a small board that has a potted chip, a crystal, and two contact patches to mate with the battery contacts. The magnet gear and coil together are a lavet stepper motor. The board generates 1 Hz pulses from the battery, each of opposite polarity, and that works the clock.Once you understand all that, it's quite simple to cut the traces on the board and solder wires leading off to an alternate controller board. Once you've done that, you can make the clock tick any way you want.I've designed a board with a boost converter and an ATTiny85. The same AA battery will run the whole thing for around 6 months or so (estimated - I haven't actually run one that long to know yet). I have no fewer than 8 different firmware loads for it. 7 of them tick in odd ways, but still tick 86400 times a day, so the long term accuracy is unchanged (I buy 20 ppm crystals, so a minute-a-month, which is on a par with what these things do anyway). The 8th ticks in Martian Sols - a day is 39'36" longer.One of the "novelty" firmwares ticks once a second, but on a random tenth-of-a-second, so it's arhythmical. One ticks slightly slower, but adds "stutter" ticks once in a while to make up for it (Lord Vetinari's clock, if you're a Discworld fan). One picks random intervals and ticks that many times rapidly and then just stops. One ticks at 3 different speeds, but always balances the amount of time it ticks "slow" with an equal amount of fast ticking. One of them ticks 10% fast for 12 hours, then 10% slow for 12 hours - you give that one to your boss.The controller board is 1/2" x 1 1/4" (12.70 x 31.75 mm), which is small enough it should fit inside the movement, so it will look and work no differently than the original.As for the plug, I sell theseon Tindie, but they're open hardware and the firmware ison Github, so you can make your own if you'd rather.

author: IanB
author_rank: Super Contributor
timestamp: August 20, 2014, 08:01:32 pm
content: Fun. Do you have any YouTube videos of the special movements in operation?

author: nsayer
author_rank: Regular Contributor
timestamp: August 20, 2014, 08:06:15 pm
content: I do have one on the bench:

author: SeanB
author_rank: Super Contributor
timestamp: August 20, 2014, 08:09:55 pm
content: I wonder what you could do with those continuous clock mechanisms that appear to move smoothly by simply having 8 pulses per second. You can do some interesting things there with the stuttering, though you will have to use a ramp up and limit the speed as they likely will lose steps.

author: nsayer
author_rank: Regular Contributor
timestamp: August 20, 2014, 08:11:55 pm
content: That might be next, although from the novelty aspect, most of the fun is had from an actual *tick*. The 10% fast / 10% slow one and the Martian ones would work well with the "smooth" movements.

author: Mr.B
author_rank: Unknown
timestamp: August 20, 2014, 08:13:50 pm
content: Very cool idea.I like it.Just reading through your code... and a quick question...What is the write endurance of the EEPROM in the AtTiny85...?I can see in Lazy-Clock.ino that you are writing to the EEPROM at a rate of 86,400 times per day.

author: nsayer
author_rank: Regular Contributor
timestamp: August 20, 2014, 08:15:22 pm
content: Should be only once a day. It only does it every SEED_UPDATE_INTERVAL seconds. I don't see a bug there. Am I missing something?

author: Mr.B
author_rank: Unknown
timestamp: August 20, 2014, 08:16:13 pm
content: Oops... Sorry, I was speed reading...

author: nsayer
author_rank: Regular Contributor
timestamp: August 20, 2014, 08:17:12 pm
content: You had me worried.Of course, there'd be no symptoms of failure - it's just trying to preserve a seed so you don't get behavior patterns when you change the battery. Besides, the Arduino library's PRNG is not very good (but certainly good enough for this application).

author: Mr.B
author_rank: Unknown
timestamp: August 20, 2014, 08:20:17 pm
content: Yes, I see your methodology there.One thing I don't like about GitHub on the web is that "#define SEED_UPDATE_INTERVAL (86400)" is in the same font colour as comments...

author: nsayer
author_rank: Regular Contributor
timestamp: August 20, 2014, 08:21:07 pm
content: Yeah, I think they're conflating C with Bourne shell or PERL - where # is a legit comment char.

author: nsayer
author_rank: Regular Contributor
timestamp: October 10, 2014, 08:33:09 pm
content: Just a little update... I've been doing a lot of work to improve the design of both the hardware and firmware. I've got no fewer than 10 different firmwares now. One is "normal" - 1 tick every second, no games. 3 are "drifting" clocks - they tick regularly, but are designed with a different ticking rate. One ticks in Martian Sols (24:39:36), one in Sidereal time (23:56:04) and the third is a tide clock (24:50:28). Of the 6 novelty clocks, four of them tick in random ways, but at a long term average rate of 86400 ticks per day, so they remain accurate. The fifth is the "wavy" clock, whose ticking is proportional to a sine wave, so it sort of "surges". The last is the "warping" clock, which ticks 10% fast for 12 hours, then 10% slow for 12. I've also dramatically reduced the system clock (by increasing the prescaler) from ~500 kHz to ~32 kHz. I got this working by figuring out how to slow the SPI clock of my AVR programmer, and by replacing the math-heavy, slow random() function in the AVR libc with one that's a lot faster.On the hardware side, by shifting to the divide-by-128 prescale setting for the 4 MHz crystal, I've gotten power consumption at idle down to ~75 µA or so. By my calculations, a single AA battery will last well over 2 years - on a par with the expected life of the original controller, I believe. But even better, since the resulting system clock is ~32 kHz (31.25 kHz, in fact), I've also been able to switch to a 32.768 kHz crystal. The benefit to those is that they're available in a SMD package, and are smaller. That, in turn, has allowed me to shrink the board down to .40375 square inches (~260 mm^2). It also dispenses with the need for FCC testing, since part 15 includes an exemption for battery operated devices that operate at < 1 MHz (15.103(h)).I am still looking for a manufacturer of clock movements with whom I can work to adapt the layout of my board to be a perfect replacement for the original board, and get a run of movements manufactured with my controller in place. Alas, that's not going well.