Planetary Gear Clock

24,071

308

56

Introduction: Planetary Gear Clock

(Old) mechanical clockworks are incredibly interesting and pleasing to watch, but are unfortunately almost impossible to build yourself. Mechanical clocks also lack the carelessness of the precise digital technology available today. This Instructable shows you a way to combine the best of both worlds; by driving mechanical clock hands through a planetary gearbox with a stepper motor and an Arduino!

Supplies:

General components:

  • 5mm wood and acrylic sheet
  • M5 bolts (countersunk), washers and nuts
  • PCB standoffs
  • M3 screws for the stepper motor

Electrical components:

  • Stepper driver (i used the L293d)
  • Any type of Arduino
  • Real Time Clock (i used the DS3231)
  • Hall effect sensor (i used the A3144)
  • 5mm Neodium magnet
  • Buttons for user input
  • 10K resistor
  • 100uf 25V capacitor
  • DC jack
  • 5V 2A DC power supply
  • Battery for the RTC (cr2032 in my case)

Mechanical components:

  • Any type of 1.8 degree/step stepper motor with 5mm axle
  • GT2 400mm timing belt
  • GT2 60 tooth 5mm axle pulley
  • GT2 20 tooth 5mm axle pulley
  • 5x16x5 mm bearing (3x)
  • 5x16x5 mm flanged bearing (2x)
  • M5x50 threaded rod

Step 1: Designing and Making the Gears

One of the goals of this project was to have one motor that drives the complete clock, similar to a real mechanical clock where one escape mechanism drives the complete clock. The minute hand however needs to make 12 rotations in the time the hour hand makes 1 rotation. This means a 1:12 reduction gearbox is needed to drive both hands with one motor. I decided to do this with a planetary gearbox, the included video beautifully explains how this type of gearbox works.

The next step for me was to determine the tooth count for the different gears to create a ratio of 1:12. This website was very helpful and contains all the needed formula's. I attached the sun gear to the minute hand and the planet carrier to the hour hand, leaving the ring gear stationary. Let's do a little bit of math!

  • S = number of teeth on the sun gear
  • R = number of teeth on the ring gear
  • P = number of teeth on the planet gear

The gear ratio (i) is determined by:

i = S/R+S

Note that the number of teeth on the planet gear doesn't matter for the gear ratio in this case, however we do need to respect the general constraint:

P = (R - S)/2

After some puzzling i ended up using the following numbers: S = 10; R = 110; P = 50; They seem to be on the edge of what is possible since there is very little clearance between the planet gears, but it works!

You can draw the gears in your favourite CAD program, most of them have special gear plugins. You can also just use the files attached to this Instructable. of course. Note that all gears, although differing in sizes, have the same tooth pitch.

I thought it would be awesome to make these gears from 5mm aluminium and contacted a local shop with a waterjet if they could cut these gears for me. Normally you would never make gears with water cutters, but these are very low performance gears. Surprisingly they agreed to try, but this plan failed horribly. The parts were simply to small for the waterjet and started to move around while it was cutting.

This setback meant it was time for plan B, so i bought some 5mm smoke black acrylic and found a place with a laser cutter, which had no problem cutting my gears. If you do not have a laser cutter available you can probably also use a 3D-printer for these gears, i included the STL files (the ring gear might need to be split into 3 parts).

After cutting i press fitted bearings into the planet gears. To get the fit right i made a test piece of acrylic with several holes which each had a slightly larger diameter (0.05 mm steps). After finding the setting with the correct fit i changed the hole size in the planet gears to this setting. This is something that differs with material and type of machine so you should always do this yourself.

Step 2: Assembly of the Gear System

To assemble the gears, the frame of the clock is needed. Now this is the part where you can let your creativity go wild since the shape of the frame is relatively unimportant as long as all the bolt holes are in the right place. I Chose to make a lot of holes in the dial plate and back plate to emphasize the gear mechanism. This is also the reason the planet carriers and minute hand are kind of see-through, but it also just looks cool!

I once again used the laser cutter to make these parts, and since the acrylic parts were 5mm thick i also made the wooden parts 5mm thick. All holes in the dial plate and planet carrier were countersunk to accommodate matching bolts.

The central axle of the clock runs in two bearings inside the planet carriers. Since i made this axle from 5mm bar stock it has a really tight fit inside the bearings and i was not able to disassemble these components anymore. It would be a lot easier to just use a piece of M5 thread since you also would not have to cut your own thread anymore (if only i realized beforehand.....). To stop the sun gear from rotating around the axle it has a D-shaped hole, so the axle also needs to be filed into this D-shape. When the sun gear fits around the axle you can assemble the axle, don't forget the planet carriers if you use flanged bearings! Check out the exploded view for assembly instructions.

When the central axis is mounted, its time for the planet gears. These also need the small washers, just like the central axle, to make sure the gears run smoothly. Once everything is mounted to the planet carriers, check if the planet gears and sun gear run smoothly.

The central part can now be mounted into the clock frame. This is a tedious job, but sticking the bolts through the front plate and taping them in place helps a lot. It can also be useful to raise the front plate to create room for the minute hand. The photos show that i placed six small pieces of paper between the gear ring and back plate to give a little bit of clearance for the gears. When inserting the planet carrier make sure the dials are pointing at a sensible location (if jour minute hand points at 12, the hour hand should not be in-between two hours of example)

Step 3: Connecting the Stepper and Sensor

Now that we have a gear mechanism that drives the hands correctly, we still need to drive the gear mechanism correctly. Various types of electric motors could be used, I chose a stepper motor since it can make precise movements without constant angular feedback sensors. A stepper motor can also make a real "Click" sound, which is great for the semi-mechanical clock!

A regular stepper motor can make 200 steps per revolution, which translates to 200 steps per hour if we connect it to the minute hand. This would mean an interval of 18 seconds per step, which does not yet sound like a ticking clock. Therefore i used an 1:3 transmission between the stepper motor and the minute hands so the stepper motor needs to make 600 steps per hour. Using the half step mode this can be increased to 1200 steps per hour, which equals one step per 3 seconds. Sounds better!

One problem with stepper motors it that you never know where they are when you power up your Arduino. This is why all 3D printers have end-stops, so you can move your printer to a known position and then continue from that point. This is also needed for the clock, only an end stop will not work since a clock should make continuous rotations. To realize this position sensing i used an A3144 Hall-effect sensor that senses a magnet (check the polarity! ....) attached to the planet carrier. This is used to move the hands to a specific position on start-up, after which they can move to the needed time.

Assembly is very simple; Attach the stepper motor to the back plate, leaving the screws slightly loose. Then you can mount the small pulley on the stepper motor axle and check if the timing belt runs straight. Now you can slide the stepper motor to adjust the tension on the timing belt. The timing belt needs a tiny bit of play to make sure you are not putting any stress on the gears. Play around with this setting until you are satisfied, then tighten the screws of the stepper motor completely.

The hall-effect sensor is glued in place. Its best to solder three wires to the sensor first, making sure to put heat shrink around each leg of the sensor so they cannot short each other out. After soldering the sensor can be glued into place. It does not really matter which side is up, as long as you have not attached the magnet yet. After you have glued the sensor in place, connect it to an Arduino or a small LED circuit to test if its working. (NOTE: the hall effect sensor only works if the magnetic field lines go in the correct direction). Using this test circuit, verify how the magnet should be glued. Once you are absolutely sure which side of your magnet should face the sensor, glue the magnet in place.

Step 4: The Electronics That Make the Clock Tick

You could use a very simple Arduino code which makes a half step with the motor and then takes a 3000 millisecond delay until the next step. This would work but it's not very precise since the internal Arduino clock is not ultra accurate. Secondly the Arduino would forget the time every time it loses power.

To keep track of the time its therefore best to use a real-time clock. These things are specially designed chips with a back-up battery that accurately keep track of the time. For this project i chose the DS3231 RTC which can communicate with an Arduino via i2c, making wiring easy. Once you set the time correctly on his chip it will never forget what time it is (as long as the cr2032 battery has some juice left). Check out this website for all the details about this module.

Driving the stepper motor is done with an L293d motor driver. Some more advanced stepper motor drivers use a PWM signal for micro-stepping and current limitation. This PWM signal can make the annoying peep noise every maker is familiar with(especially if you own a 3D printer). Since this clock is supposed to become part of your interior, nasty noises are not desired. Therefore i decided to use the low-tech l293d motor driver to make sure my clock is silent (besides the stepping every 3 sec, but that's actually enjoyable!). Check out this website for a detailed description of the l293d chip. Note that i run my stepper motor at 5V which lowers the power consumption and temperature of the stepper motor.

As mentioned earlier, i use an Hall-effect sensor to detect a magnet glued to the planet carrier. The operation principle of the sensor is very simple, it changes state when a magnet is close enough. This way your Arduino can detect a digital high or low and therefore detect if a magnet is close. Check out this website which shows how to connect the sensor and shows the simple code used for magnet detection.

Last but not least, I added 4 buttons for user input to the PCB. They use the Arduino internal pull-up resistors to simplify the wiring. My PCB also has headers in an Uno configuration so i could add Arduino shields for possible expansions (i have not done this so far).

I first tested everything on my breadboard and then I designed and ordered a custom PCB for this project, since it looks awesome! You could also mount the PCB on the back of your clock if you don't want to look at it.

The Gerber files for the PCB can be downloaded from my drive, Instructables does not let me upload them for some reason. Use this link to my google drive.

Step 5: Programming the Arduino

The basic code for the Arduino is actually very simple. I attached a scheme that visualises what happens inside the Arduino and how the Arduino interfaces with the other devices. I used several library’s to simplify the coding.

  • Accelstepper -> handles the stepping sequence of the stepper motor, lets you give intuitive commands like: Stepper.runSpeed(), or Stepper.move() which let you move at a certain speed or to a certain position respectively.
  • Wire -> this is needed for i2c communication, even when using the RTClib
  • RTClib -> handles the communication between Arduino and RTC, lets you give intuitive commands like rtc.now() which returns the current time.
  • OneButton -> Handles the button input, detects presses and then runs a pre-specified void to do something. Can detect single, double or long presses.

When writing code for a clock it is very important to avoid having variables that keep on increasing. Since the Arduino code will be running 24/7 these variables will quickly get bigger and bigger and will eventually cause an overflow. The stepper motor for example is never commanded to go to a certain position, since this position would only increase over time. Instead the stepper motor is commanded to move a certain number of steps in a certain direction. This way there is no position variable that increases over time.

The first time you connect the RTC you need to set the time of the chip, there is a piece of code you can uncomment that sets the RTC time equal to you computer time (the time at the moment you compile the code). Note that when you leave this uncommented the RTC time will be reset to the time at which you compiled your code every time. So uncomment this, run it once and then comment it again.

I attached my code to this Instructable, i commented it thoroughly. You could upload it without any changes or check it out and see what you think!

Step 6: Enjoy the Sound of Your Clock Ticking for the First Time!

After connecting all electronics and uploading the code, this is the result!

The basic design of this clock is very simple and it could be made in many different shapes and sizes. Since there is an Arduino on board you can also easily add extra features. Setting an alarm, have the clock turn on you coffee machine at a set time, internet connectivity, cool demo modes that highlight the mechanical movement to show of your design to others and much more!

As you might have noticed throughout this Instructable, i had to take my clock apart for the sake of writing this Instructable. Although unfortunate for this Instructable i can at least guarantee the design performs very well in the long term, since this clock has been ticking away for more than 3 years in my living room without any problems!

Please let me know in the comments if you liked this Instructable, its the first time i write one. Also if you have any tips or questions, just send me a message. And hope i inspired someone to also build a semi-mechanical clock one day!

Clocks Contest

First Prize in the
Clocks Contest

10 People Made This Project!

Recommendations

  • Clocks Speed Challenge

    Clocks Speed Challenge
  • Toys & Games Contest

    Toys & Games Contest
  • Big vs Small Challenge

    Big vs Small Challenge

56 Comments

0
slylock
slylock

4 months ago

Did anyone laser-cut feet for your clock? I notice the feet are not included in the drawings, so wondering what others did for the feet?

0
hermanklaver
hermanklaver

1 year ago on Step 6

Great clock, i am going to build one and also try one which is 50% smaller, so it dan completely be printen on my 3D printer. Good and clear description!!

0
omar.rpa.etu
omar.rpa.etu

Reply 6 months ago

Hello, I'm starting this project too and I'm wanting to resize it too, but since I'm not an expert on mechanics did you have to change the motor speed / number of tooth in the gears? Or everything worked out as planned without any further modifications?

0
hermanklaver
hermanklaver

Reply 6 months ago

Hello Omar,

Due to other things i did not find the time to build it together.
What I have done until now is resize everything and leave the rest the same.
When you do not change the gears then all should work fine i think.
I have printed everything and have to assemble it still, also i was looking for the stepper motor control which i have to build still. I am planning to use a d1 mini (esp) to control the stepper motor. So for me it is still work in progress.

Kind regards
Herman

0
Looman_projects
Looman_projects

Reply 1 year ago

Nice idea, let me know what your results are when using the 3D printer!

0
slylock
slylock

Question 10 months ago on Step 5

I haven't been able to make the code work with my board. This sample code works, and moves the motor, after changing the pins to D2-5: https://www.arduino.cc/en/tutorial/stepperSpeedControl
So I'm pretty sure the board is ok. First I installed AccelStepper by downloading from airspayce.com. Then I uninstalled that, and installed the one by Mike McCauley in the IDE library manager, version 1.59. I have the debug function uncommented, and by moving a magnet, I can see that it is supposed to be moving the motor. But motor does not move. Any suggestions to troubleshoot?

0
slylock
slylock

Answer 10 months ago

using AccelStepper Stepper1;//all defaults
instead of AccelStepper Stepper1(8,5,4,2,3,false);
and the motor moves. Is the "transistor based half-step mode" going to be significant?

0
slylock
slylock

Answer 10 months ago

Started trying the sample programs that come with AccelStepper, and the first one I tried, ConstantSpeed, works fine. So something in Mr. Looman's code?

0
NickBramley
NickBramley

12 months ago

Hi, I 3d printed this clock and it is great! I built it with the PCB from Looman_Projects (Thankyou!) but the stepper driver got red hot so I substituted the Arduino Uno with a CNC shield. I plan to produce a PCB when my CNC router is finished. I wrote code for this hardware for another clock so modified it for this setup.

IMG_20200522_100442.jpg
0
MichelD55
MichelD55

Reply 11 months ago

Hello Nick,

I'm also 3d printing the clock but I have issues with the gears, did you modify the gears? when I turn the minute hand the mechanism has some heavy points.

0
NickBramley
NickBramley

Reply 11 months ago

I also had to file the gear teeth down a little (to get rid of a little "elephants foot") but I also printed the gears a little thinner than the ring gear to give some clearance.

0
MichelD55
MichelD55

Reply 11 months ago

Oke, i printed the ringgear slightly bigger to do the same. I’m gonna file the gears down a bit and see iff that does the trick. Thanks for your reply

image.jpg
0
Looman_projects
Looman_projects

Reply 11 months ago

What input voltage did you use for the PCB? Because the voltage goes to the stepper motor directly. Mine runs on 5V and the stepper driver is warm to the touch.

0
NickBramley
NickBramley

Reply 11 months ago

Yes I was using 5v but I would guess that the stepper motor was a lower resistance than the one that you used. It didn't perform very well either...not enough torque to turn the hands. It now runs on 12v with a A4988 driver and it runs fine. The code also adjusts automatically for DST/GMT. so no need to touch the clock for years! It also checks at 6:00 and 18:00 to make sure the hands are in the correct position.

0
mikehayes.86
mikehayes.86

11 months ago

Hello everybody,
Has anybody got a printable pdf of the parts?
I am going to attempt to make mine with a scroll saw

0
neypp
neypp

Question 1 year ago

Hey all,

My clock has been ticking away for a week or so now, but there seem to be quite a lot of vibrations coming from the stepper, which causes the belt to make a noise kind of like you would flick a strung rubber band, every other step. Has anyone had similar issues and how did you fix it?

Best,
Pepijn

0
Looman_projects
Looman_projects

Answer 1 year ago

Hi Pepijn,

I have not had any problems with a flick noise of the belt. My clock makes a very audible but discrete "tick" from the stepper motor, there is no slowly decaying rubber band noise in the belt. I must say i have very little tension on the belt (just enough to keep the teeth grabbing) to reduce forces on the planet gears as much as possible. Belt tension is not really needed anyway. At wat voltage are you running your stepper motor? And are you using half steps or full steps?

Kind regards,
Kevin

0
neypp
neypp

Reply 12 months ago

Dear Kevin,

I'm pretty sure the noise is due to motor vibrations. It happens with this kind of step (noise) step (quiet) step (noise) step( quiet) pattern, so it stands to reason that it has something to do with the half-step mode that is active in the code that was attached to the instructable.
I've used the list of components you sent me earlier, so I suppose that means the motor is being run at 5v? That's the power supply output, anyway.

Any suggestions would be very welcome, the sounds are quite obnoxious :(

Best,
Pepijn

0
epicycloid
epicycloid

1 year ago

Very good write up and project for a first Instructable. Not only is your clock nice aesthetically, it combines a lot of different skills and technologies, and highlights them all in an attractive display.

I think some people will want you to add the Gerber or PCB design files, and others would appreciate if you at least posted your files for the wood clock frame parts too.

Thanks for sharing such an interesting clock project. You got my vote!

0
Looman_projects
Looman_projects

Reply 1 year ago

You are completely right about the files!
I added all the dxf and stl files for the wooden parts to step 2. Unfortunately the Gerber files died togehter with my old harddisk so i do not have them anymore....

Thanks for your vote!