Wood Clock Gears with Motor Drive – Part 3 of 3

Reading Time: 4 minutes

Picking up from Part 2, the third and final part of the wood click gears with motor drive build covers the stepper motor drive. The gears ended up driving this really beautiful clock. Note that I did not build the clock, just the gears driving the hands.

This part of the build was fairly simple since it was just a matter of driving a stepper motor at a constant speed. I also included a switch to be able to reverse direction.

Block Diagram

block diagram
Block diagram

The drive system is extremely simple as shown in the block diagram. I did not create a schematic for the build and just used the block diagram for reference instead. The circuit was powered by a standard 5V regulated wall charger.

Stepper Motor and Driver

Since the project didn’t require a large motor, I used the 28BYJ-48 stepper stepper motor with the ULN2003 driver. This is an extremely popular stepper/driver combination with a great deal of documentation available online.

ATtiny85 Microcontroller

ATtiny85 Pinout

I opted to use the ATtiny85 microcontroller since I only needed a few pins to control the stepper motor driver. The ATtiny85 has 5 usable I/O pins — I used 4 for the stepper driver and 1 for the forward/reverse switch. Lastly, it is largely Arduino compatible so many library work without modification.


The code (included below) was fairly straightforward — there is nothing fancy happening and I used the AccelStepper library. It is able to run the motor more efficiently than the default Arduino stepper library and includes a half-stepping mode, which is recommended for this motor.

Here is a great tutorial on using the Arduino Uno to program the ATtiny85. As a side note on the tutorial, you can get away with programming it without using the capacitor. 

// Simple program to drive a stepper at a constant speed
// using an Attiny85
// Paul Bupe Jr

#include <AccelStepper.h>;

// Defining some useful constants
#define HALFSTEP 8
#define MINUTE_STEPS 1.13777
#define SECOND_STEPS 68.266
#define SECOND_STEPS 115

// Motor pin definitions
#define motorPin1  0     // IN1 on the ULN2003 driver 1
#define motorPin2  1     // IN2 on the ULN2003 driver 1
#define motorPin3  2     // IN3 on the ULN2003 driver 1
#define motorPin4  3     // IN4 on the ULN2003 driver 1

#define dirPin     4     // Input for Clock Direction

bool last_dir = HIGH;
float step_speed = SECOND_STEPS;

// Initialize the stepper library in half-stepping mode
AccelStepper stepper(HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);

void setup()
   pinMode(dirPin, INPUT);
   stepper.setMaxSpeed(1000); // Arbitrary max speed 

void loop()
  int dir = digitalRead(dirPin); // Get direction from switch
    // Only executes if the direction changed
    if (last_dir != dir) {
      if (dir) {
        stepper.setSpeed(step_speed); // Clockwise
        last_dir = HIGH;
      } else {
        stepper.setSpeed(-(step_speed)); // Counter Clockwise
        last_dir = LOW;

Putting Everything Together

With all the parts in and program written, I did some quick prototyping just to make sure everything worked as expected.

I then designed a quick mount in SolidWorks and printed it out using my 3D printer.

Then it was just a matter of crimping a few wires and soldering everything together.

After that I tested everything out then mounted it on to the back of the gear assembly.

Motor Drive

Finally a quick test with everything assembled and it was good to go!

4 thoughts on “Wood Clock Gears with Motor Drive – Part 3 of 3”

  1. Nice work. thinking of making something similar and have been trying to figure out how to get started. Any chance you can post the CAD/DXF files? Anything you’d change in a second iteration?

  2. I’ve updated the page with download links for the DXF file.

    In a new version would definitely use a more powerful stepper motor so that it can run 24/7. Since this was just a showpiece that wasn’t meant to be used for 24/7 timekeeping I used a smaller motor, which ran hot. This would also allow me to add a “fast run” mode so that the time can be adjusted quickly since there is no way of disengaging the gears.

    I would also remove the mounting holes in the plates — maybe just replace them with small pilot holes.

    Let me know if you have any other questions!

  3. Hi Paul, I am trying to create a clock mechanism in which the minute hand sits behind the hour hand, and am having difficulty trying to create this. Do you have any ideas?

Leave a Reply

Your email address will not be published. Required fields are marked *