Horizontal Clock

by mikeot851 in Workshop > 3D Printing

624 Views, 11 Favorites, 0 Comments

Horizontal Clock

DSC_0423.JPG
DSC_0518.JPG

I wanted to make a clock that stood out from the crowd and started thinking what if the numbers moved instead of the hands this developed in to tipping the clock on its side.

To control the clock's timing I used an Arduino and stepper motor

I designed all the parts using Fusion360 and manufactured on a 3D printer.

The video shows an animation of the clock working sped up on Fusion360.

Downloads

Supplies

What I used is in brackets but these can be swapped to suit your own project.

Arduino (Nano) + wiring other arduino would work as well only chose for size

Stepper motor (28byj-48)

Motor driver (ULN-2003)

Bearings (608)

Designing the Base

clock base.jpg
DSC_0519.JPG

First thing to do is decide upon the size of your clock, for this a few factors need to be considered such as the size of your 3D printer build plate, space for your components and placements of your bearings also remember that you need to leave room for wiring!

I decided to make it 200mm so that it would fit on my Ender 3 then measuring each component decide on its location. the arduino needs to be placed so that power can be attached and the motor needs to be placed so that the gear will mesh with the internal gear of the clock, this is also the case for the bearing positions for the support gears. remember that the spindle is not in the middle of the motor.

I removed a large section in the middle just to save on filament as it was unnecessary for strength.

Clock Top

clock top.jpg
clock top2.jpg

The top is relatively simple and simply needs to be a low cylinder which then needs lines cut out of the side and also numbers added this is achieved on Fusion360 through using a tangent plane and embossing the numbers on to the side face every 30 degrees to fulfil all 12 numbers.

it is imperative that you know the gear ratio between the drive motor and the clock 'face'. this will be important when setting up the arduino control later.

Assemble All Parts and Code

This should be a very straightforward task of just inserting all parts in to their respective compartments as designed earlier and wiring up the components, as can be seen from the below arduino script I used ports 5, 6, 7 and 8 but you can move these is a more convenient wiring position is needed, once you have run the clock for a while it may be necessary to tune it by adjusting the millis_per_min line to speed up or slow down the movement.

#define MILLIS_PER_MIN 60000

#define ROTATION_PERIOD_IN_MSEC 1000

#define STEPS_PER_ROTATION 4096 #define RATIO 60

#define LAP 65536

int delaytime = 5;

int port[4] = {8, 7, 6, 5};

int seq[8][4] = { { LOW, HIGH, HIGH, LOW}, { LOW, LOW, HIGH, LOW}, { LOW, LOW, HIGH, HIGH}, { LOW, LOW, LOW, HIGH}, { HIGH, LOW, LOW, HIGH}, { HIGH, LOW, LOW, LOW}, { HIGH, HIGH, LOW, LOW}, { LOW, HIGH, LOW, LOW} };

void rotate(int step) { static int phase = 0; int i, j; int delta = (step > 0) ? 1 : 7;

step = (step > 0) ? step : -step; for(j = 0; j < step; j++) { phase = (phase + delta) % 8; for(i = 0; i < 4; i++) { digitalWrite(port[i], seq[phase][i]); } delay(delaytime); } // power cut for(i = 0; i < 4; i++) { digitalWrite(port[i], LOW); } } void setup() { pinMode(port[0], OUTPUT); pinMode(port[1], OUTPUT); pinMode(port[2], OUTPUT); pinMode(port[3], OUTPUT); pinMode(14, OUTPUT); digitalWrite(14, LOW); pinMode(16, INPUT_PULLUP); }

long calc_step(long msec) { return STEPS_PER_ROTATION * msec / MILLIS_PER_MIN / RATIO; }

void loop() { static long prev_msec, prev_pos; long msec, pos;

if(digitalRead(16) == LOW) { delaytime = 2; rotate(20); delaytime = 20; return; } msec = millis() % LAP; if(msec < prev_msec) { msec += LAP; } if(msec >= prev_msec + ROTATION_PERIOD_IN_MSEC) { pos = calc_step(msec); rotate(pos - prev_pos);

if(msec >= LAP) { msec %= LAP; pos = calc_step(msec); } prev_pos = pos; prev_msec = msec; } }

Finished Clock

DSC_0524.JPG

The timepiece is now finished and simply needs to be attached to a power source, I found mine would run for over a week with a 10000mAh power pack but you could happily plug it in to an electrical outlet for continuous running.

updates to follow when I can get more pictures.