Gear Clock

by abbtech in Circuits > Clocks

52714 Views, 294 Favorites, 0 Comments

Gear Clock

4027191023_3ea7412e7d.jpg
The heart of the clock is a PIC 16f628A microcontroller (PDF). This microcontroller has an internal oscillator however an external 20MHz crystal oscillator is being used since it will have to accurately keep track of time for weeks and months. The microcontroller is interfaced to two buttons and one motor.

For more details have a look at the project Website.
alan-parekh.com/projects/gear-clock

The Gear Clock Kit is now available. Have a look at our kit page for more details. If you have a CNC machine you can cut your own gears and just purchase the electronics for the clock.



Cut and Paint the Gears

4027169867_12722bda5b.jpg
4027925256_fe42459142.jpg
4027924066_29d0c5c531.jpg
4027926596_82cd09d3df.jpg

The gears are made out of MDF. They were painted to have a metallic look however the look I was going for was not achieved. Initially I was thinking of making the gears look like they were made of metal and left to rust for a few dozen years. I found some cool products that would give me that rusted effect but they were a bit too expensive. I settled for a can of Krylon Black Metallic Hammered Finish paint. The sample on the lid is a very nice black with subtle bit of gray. I think this might be from a bad batch since the final look is not as black as it should be. It also made taking pictures of the final clock a bit tough since even with modest lighting the glare was horrible.

The gear arrangement is as follows:

  • 9 tooth motor gear
  • 72 tooth minute gear with a 24 tooth secondary
  • 72 tooth intermediate gear with a 18 tooth secondary
  • 72 tooth hour gear

To achieve the correct timing the 9 tooth motor gear is advanced 4 steps every 9 seconds. By moving 4 steps at a time the motor routines can be simple since the motor is always at rest with the same coil energized.

Construct the Clock Electronics

4027943662_f29795e220.jpg
4027187543_8d165f6f36.jpg
4027941700_57601e0b82.jpg
4027192161_3ca20f8f0e.jpg

Microcontroller

The brains of this project is a PIC 16F628A microcontroller. It keep track of time and activates the stepper motor when needed.

Buttons

The interface is very simple, it consists of two buttons. When the left button is pressed the clock advances time using the motor. When the right button is pressed the clock decrements time using the motor. The only issue is when you need to correct time by many hours you would have to keep the button pressed for a long time. The stepper motor is also always energized to prevent the gears from slipping. To overcome this issue when both buttons are pressed the stepper motor is deenergized and the minute gear can be spun freely.

Motor

The motor is a unipolar stepper motor that has been harvested from an old 5 1/4 inch floppy drive. This is the motor that used to move the read write heads back and forth, to get one of this size and power you’ll need to find a nice old one. Modern floppy drives don’t have steppers with this level of torque.

This motor moves 1.8 degrees per pulse which means that with 200 pulses it will make one full rotation. Since it’s a bipolar motor it is simple for the PIC to drive it with only 4 transistors.

Code

The code is basically split into two sections, there is an iterative loop that monitors the buttons for a change in state and checks if the internal clock has crossed the 9 second mark. If one of those conditions has occurred the stepper motor is driven appropriately.

The other section of code is interrupt driven and it keeps track of time. An interrupt is triggered every 0.1 seconds and adjusts an internal clock as needed. There is a true running clock inside, if you connect the clock PIC pin 6 to a computer serial port operating at 9600 bps you will see the internal clock values update once per second. The clock value in this case is arbitrary since it is never shown and will not be the same as what the gears are displaying but this same code will be used in future projects which will use this code display time.

Assemble and Enjoy

4027934754_980cf8a32e.jpg
4027935840_bdb9aeb1ea.jpg
4027936444_5edce38e76.jpg
4027181861_7de77de2c3.jpg
4027932692_1e1de1b381.jpg
4027927312_7322eede8a.jpg
All the pieces screw together, the only piece that is glued is the stepper motor into the motor holder.