Instructables
Picture of Laser cut gear clock - with ChronoDot!
DSC_6839.JPG
This summer, my hackerspace LVL1 (in Louisville, Ky) got an awesome laser cutter http://fslaser.com/40w-deluxe-hobby-laser-engraver-and-cutter.  LVL1 is an awesome community of creative folks that like to build stuff.  You can always check out what we are up to at http://www.lvl1.org.  If you like instructables and making stuff, you should see if there is a hackerspace in your area.  Anyway...

I decided to build a gear clock after seeing something like what I made in a friends office and after playing with the gear renderer in Inkscape.  This instructable hopefully will show you how to make what I made and also teach you a little about the design process involved when working with a laser cutter.
 
Remove these adsRemove these ads by Signing Up

Step 1: Gather your materials.

Picture of Gather your materials.
ChronoDotV2.1_MED.jpg
freeduino_proto0603-2.jpg
For this instructable I needed...
You will also need a computer to program your Arduino and also for designing in Inkscape.

Step 2: 1st prototype

Picture of 1st prototype
DSC_6827.JPG
For the first prototype, I just wanted to see if I could get the stepper gear thing working at all.  I cut a spur gear for the stepper, a small stand with a hole in it to press fit the stepper motor and a larger gear that would be the clock mechanism.

After assembly and a quick program, I decided that the clock needed to have two gears (and thus two stepper motors) - one for hours and one for minutes.  I also discovered that the numbers needed to always be right side up as the gear traveled around.  Thus, the 6 needed to be upside down in the drawing as well as the 3 and nine needed to face outwards.

Another cool thing I discovered during my first prototype is that the Arduino has enough power to step these motors without having a driver circuit.  This makes the clock considerably easier to make!  Here are a couple of links to tell you about how to hook up the Arduino to the stepper I used...

http://ryanschenk.com/2010/03/driving-a-040-stepper-with-arduino/
http://profmason.com/?p=173

I also began to think about my gears.   In my prototype, I used a 10 tooth gear for the gear connected to the stepper and a 100 tooth gear for the ring.  100 really does not translate well into hours or seconds so what else could I use? 

My stepper gear has 10 teeth and this actually works well because the stepper I am using has 20 steps per revolution.  Thus I can step the stepper 2 times to move exactly 1 tooth.

Therefore, for my minute hand, if I use 60 teeth, then each 2 steps = 1 minute = 1 tooth of movement.

Similarly, my hour hand has 144 teeth because if we divide it by 12, each hour has 12 teeth and therefore each tooth is equal to 5 minutes!  Really, the clock does not have to have a minute ring at all.  The hour ring can tell you what time it is.

Step 3: Using Inkscape to draw gears.

Picture of Using Inkscape to draw gears.
GearDLG.jpg
CenterGears.jpg
Inkscape is a wonderful program!  It can be downloaded for free at www.inkscape.org.  Inkscape is a program that is used for vector drawing.  You can think of vectors as 'drawing lines' as opposed to bitmapped images such as digital photos.  Just like any new program, Inkscape can be difficult at first, but becomes very easy the more you work with it.

Start by opening Inkscape and creating a new document.  I like to use letter landscape as the document size.  That size fits in our laser cutter well.  File->New->Letter_landscape

From there I find it helpful to turn on a grid.  File->Document Properties Grids tab.  Set your grid to what you feel comfortable using, I like to work in inches, but others work in mm's.  It really does not matter.

Now the fun part... To put a gear on your drawing, use Extensions->Render->Gear.  When I did this clock I used a circular pitch of 10 and a pressure angle of 10.  Then I varied the number of teeth to set the gear size.  As long as I used 10 and 10 for circular pitch and pressure angle, the gears fit!  Please go ahead and try it!

Once you have drawn a gear, you will most likely need a center hole.  To get a hole centered on a gear, draw the gear and draw the circle for the hole.  Then select both the circle for the hole and the gear and go to Object->Align and distribute.  Then click the icons that say 'Center on the Horizontal Axis'  and 'Center Horizontally'.

I have attached my file for cutting the gears.  It is called ClockGear3.svg and you can download it below.   The green lines in the file are lines that I use for guides.  I do not cut anything in green.

The stand is the tall trapazoid and the two triangles.  I hot-melt glued the triangles to the back of the stand.


*** UPDATE 2/29/12 ***
If you try to download the inkscape file, it will download as something.tmp.  Just rename it to clock.svg and then you can open it in inkscape.


Step 4: Cutting the Clock file on the Laser

Picture of Cutting the Clock file on the Laser
img_2107_final_3.jpg
6134336055_9817a0d421_z.jpg
Using the file Gearclock3.svg and LVL1's Lasercutter, I cut the clock out of 1/8" plywood that I purchased at Michaels.  I am sure you could use other materials, and I will probably make an acrylic clock sometime.

To cut the clock on our laser, I printed to the Retina Engrave software that came with our laser.  Retina engrave allows you to control the laser based upon which colors are in your file.  For example, I set the laser to cut completely though the plywood when the color is black and engrave only a little when the color is purple.

To cut 1/8" birch plywood on our 40W laser I use a setting of 30% cut speed and 100% power.  To engrave on our laser, I use a setting of 100% cut speed and 25% power.  The order is what order the laser uses.  I engrave (purple) first, then cut the red and then cut the black.  I set the repeats to 0 for green, because I do not want to cut any green.  It really is not as difficult as it seems.

Step 5: Building the clock

Picture of Building the clock
6134459499_7f1355b767_z.jpg
DSC_6830.JPG
DSC_6832.JPG
DSC_6831.JPG
After you cut all your pieces, you will need to assemble your clock.  Start by hot-melt gluing the small triangles on the back of the stand as in the pics.  Next, take the small gears and press fit them on to the stepper motors.  You may need to ream out the hole a little with an awl or other pointy instrument.  Push the gears on in such a way that the gear bevels in toward the stepper.  When you cut something on a laser, you will notice a very slight bevel on the cut.  If that bevel is pointed in, then the outer ring gears have less of a chance to fall off.

Press the steppers into the stand.

Get some hookup wires that can go between the stepper motor and the Arduino.  It helps to use the same colors, but it is not necessary.   The wires are hooked up as follows:

Hour Stepper:
Yellow - Digital Pin 4
Red - Digital Pin 5
White/black - Digital Pin 6
Blue - Digital Pin 7

Minute Stepper:
Yellow - Digital Pin 8
Red - Digital Pin 9
White/black - Digital Pin 10
Blue - Digital Pin 11

Hook up the Arduino via a usb cable to your computer so it is ready to program.

Step 6: Programming the Arduino

Picture of Programming the Arduino

I am not going to go over how to program an Arduino, there are plenty of example online.  I used the motor knob example in the Arduino IDE as the basis for driving the stepper motors.  From there I modified the code to drive the stepper motors. 

When programming a clock, you obviously want your clock to run and not loose time.  My first hack at the code, my clock lost about 15 minutes overnight.  That was not acceptable.  The algorithm for that code was to count to 60 seconds, tick the minute hand, then count to 5 minutes and tick the hour hand.  Not the most elegant of solutions.

So what i did next was to use a date/time library and keep track of the last minute, then I would check the time every 5 seconds or so and if the minute changes then I would tick the clock.  Every 5 minutes, I will tick the hour hand.  I also set the pin13 led to flash every second.  You will have to install the time library to run the pde code.  It is downloaded here http://www.arduino.cc/playground/Code/Time

Code (cut and paste) or download the PDE below:

/*
* gearclock.pde
*
* Brian Wagner
* LVL1 - Louisville's Hackerspace
* www.lvl1.org
* 9/10/11
* 9/18/11 reworked to use time_t
*/

#include <Stepper.h>
#include <Time.h>

#define STEPS 20 // The stepper has 20 steps per revolution
int ledPin = 13; // LED connected to digital pin 13
int LastMinute;
int ThisMinute;

int LastSecond;
int ThisSecond;

//for the 21-02485-03 stepper, the colors in order are yellow, red, black/white, blue

Stepper Hours(STEPS, 4, 5, 6, 7);
Stepper Minutes(STEPS, 8, 9, 10, 11);
int MinuteCount;
time_t t;

void setup()
{
pinMode(ledPin, OUTPUT);

setTime(1,1,1,1,1,1); //set the time to Jan 1, 2001
//It really does not matter what the time is set to,
//we are checking to see if a minute has passed.
t = now();
LastMinute = minute(t);
LastSecond = second(t);

//how fast is it gonna step
Minutes.setSpeed(5);
Hours.setSpeed(5);

//test the minutes and hours to make sur it is going in the correct direction
//Minutes.step(100);
//Hours.step(100);
Minutes.step(4);
Hours.step(4);

MinuteCount = 1;
}

void loop()
{

t = now();
ThisMinute = minute(t);
ThisSecond = second(t);

if ( ThisSecond != LastSecond ) {
digitalWrite(ledPin, HIGH); // set the LED on
delay(200); // wait for 500ms
digitalWrite(ledPin, LOW); // set the LED off
LastSecond = ThisSecond;
}


if ( ThisMinute != LastMinute ) {
Minutes.step(2);
MinuteCount++;
LastMinute = ThisMinute;
}

//tick the hour ring every 5 minutes
if (MinuteCount > 5) {
Hours.step(2);
MinuteCount = 1;
}

delay(200);
}

 

Step 7: Hook up a Chronodot.

Picture of Hook up a Chronodot.
DSC_6831.JPG
DSC_6837.JPG
Macetech has a really cool real time clock module for ~$15 that can keep perfect time!  It is called a Chronodot.  Check it out and order it here: http://macetech.com/store/index.php?main_page=product_info&cPath=5&products_id=8&zenid=3395f33814bb6d6d78fe449837b4305b

I found it really easy to program.  I just used the test program at the bottom of the documentation page as a basis. 

To hook up the chronodot, I made a couple of wires to connect to the 5v, gnd, scl and sda pins on the chronodot.  I hooked the power and gnd connectors on the chronodot to the 5V and gnd connectors on the Arduino.  The SDA pin connects to Analog pin 4 and the SCL pin goes to Analog pin 5.  Here is a resource for hooking up the Chronodot: http://www.codingcolor.com/microcontrollers/an-arduino-lcd-clock-using-a-chronodot-rtc/

Then I hacked the chronodot test code into my program and away it went!

Here is the code, or you can download below.

/*
* gearclock_Chronodot.pde
*
* Brian Wagner
* LVL1 - Louisville's Hackerspace
* www.lvl1.org
* 9/10/11
* 9/18/11 reworked to use time_t
* 9/19/11 Added Chronodot
*/

#include <Stepper.h>
#include <Wire.h>

#define STEPS 20 // The stepper has 20 steps per revolution
int ledPin = 13; // LED connected to digital pin 13
int LastMinute;
int ThisMinute;

int LastSecond;
int ThisSecond;

//for the 21-02485-03 stepper, the colors in order are yellow, red, black/white, blue

Stepper Hours(STEPS, 4, 5, 6, 7);
Stepper Minutes(STEPS, 8, 9, 10, 11);
int MinuteCount;

void setup()
{
pinMode(ledPin, OUTPUT);
//Serial.begin(9600);
Wire.begin();
// clear /EOSC bit
// Sometimes necessary to ensure that the clock
// keeps running on just battery power. Once set,
// it shouldn't need to be reset but it's a good
// idea to make sure.
Wire.beginTransmission(0x68); // address DS3231
Wire.send(0x0E); // select register
Wire.send(0b00011100); // write register bitmap, bit 7 is /EOSC
Wire.endTransmission();

LastMinute = 0;
LastSecond = 0;

//how fast is it gonna step
Minutes.setSpeed(5);
Hours.setSpeed(5);

//test the minutes and hours to make sur it is going in the correct direction
//Minutes.step(100);
//Hours.step(100);
Minutes.step(4);
Hours.step(4);

MinuteCount = 1;
}

void loop()
{
int seconds ;
int minutes ;
int hours ;

// send request to receive data starting at register 0
Wire.beginTransmission(0x68); // 0x68 is DS3231 device address
Wire.send(0); // start at register 0
Wire.endTransmission();
Wire.requestFrom(0x68, 3); // request three bytes (seconds, minutes, hours)

while(Wire.available())
{
seconds = Wire.receive(); // get seconds
minutes = Wire.receive(); // get minutes
hours = Wire.receive(); // get hours

seconds = (((seconds & 0b11110000)>>4)*10 + (seconds & 0b00001111)); // convert BCD to decimal
minutes = (((minutes & 0b11110000)>>4)*10 + (minutes & 0b00001111)); // convert BCD to decimal
hours = (((hours & 0b00110000)>>4)*10 + (hours & 0b00001111)); // convert BCD to decimal (assume 24 hour mode)

//Serial.print(hours); Serial.print(":"); Serial.print(minutes); Serial.print(":"); Serial.println(seconds);
}

ThisMinute = minutes;
ThisSecond = seconds;

if ( ThisSecond != LastSecond ) {
digitalWrite(ledPin, HIGH); // set the LED on
delay(200); // wait for 500ms
digitalWrite(ledPin, LOW); // set the LED off
LastSecond = ThisSecond;
}


if ( ThisMinute != LastMinute ) {
Minutes.step(2);
MinuteCount++;
LastMinute = ThisMinute;
}

//tick the hour ring every 5 minutes
if (MinuteCount > 5) {
Hours.step(2);
MinuteCount = 1;
}

delay(200);
}




Step 8: Conclusion and thoughts....

Picture of Conclusion and thoughts....
I may cut another hour ring that has numbers all the way around.  I have also toyed with making the number binary.  With this clock, there are many ways to make it neater.  Also, I wonder whether it is worth having the minute ring at all.  After all, I do not need to know exactly what time it is, close enough is good enough for me.  Please use this instructable as a basis for other clocks.  MASH IT UP! Enjoy and support your local Hackerspace!  If you are ever in Louisville be sure to visit LVL1!

Thank for reading and hack on!
Brian.
billgeo8 months ago

AWESOME PROJECT!!!

(and a very nice hackerspace)

I will try and make something similar to this with my CNC router.

Maybe make the rings from clear acrylic and light in on the edge somehow with RGB leds.

Maybe have the mcu control the color, say in relation to the time (blue backlight for daytime and yellow for nighttime)

But I guess that the first challenge will be to see if my router can cut nice gears...

bpwagner (author)  billgeo8 months ago

I like your idea of a color changing backlight. Thanks for the nice message. Brian

jlbrenner1 year ago
I have never worked with arduino before and this is my first project ( and I love it), but when I use your code I get errors like sketch_mar11a:27: error: 'time_t' does not name a type. Am I supposed to do anything to alter the code?
bpwagner (author)  jlbrenner1 year ago
I think you need to install the time library http://playground.arduino.cc/Code/Time Then the include Time.h will work and all will be defined. Here is a guide on installing libraries: http://arduino.cc/en/Guide/Libraries If you have trouble, let me know, I am happy to help. Good luck!
Opaler bpwagner11 months ago
Okay, So I'm basically remaking this project for a class, but incorporating different methods. I have the arduino uno board, and I have yet to purchase a stepper motor. The thing is that I don't need to make this clock accurate, but I do need to make the ring turn slowly. I've got the arduino library and program downloaded, is there any way I can just hook up the motor directly to the arduino? Also I keep getting errors about the 'void loop' and the 'void setup' is there a better way to go about this?
bpwagner (author) 1 year ago
if you get a time_t error then you need to download and install the Arduino time library here http://playground.arduino.cc/Code/Time
ok, i love this, in fact i have something similar but instead of a wood ring its a series of chains with numbers on them. my problem is i tried to use a cheapo clock movement from the hobby store to turn the chains, but there too heavy and it wont turn them. i then went to find a way to use stepper motors(i have a ton of them) but every circuit i find needs a dam ardunio and thats just not in the cards. now my question is; how can i build a cheap circiut to drive a stepper motor for use in a clock. it doesnt matter if is battery powered or run off the main. i have some circuitry skills so im good there. any help would be awsome, and then ill make an instructable on it cause i have looked everywhere and cant find anything.
bpwagner (author)  golddigger15592 years ago
You probably are not going to find a chip that just drives a stepper easily. Steppers take timing and sequencing that is really easy with a microprocessor but requires quite a bit of logic and a state machine if done in discrete components. Plus you would have to build a timing circuit to count minutes/seconds/ etc. By the time you have done all that, you may as well put a microprocessor in it. Arduinos are cheap, but you can go even cheaper. It is possible to drive a stepper with an ATtiny45 microprocessor and a couple components, but setting it up and programming that is much, much harder than an Arduino. My suggestion... get an Arduino or a clone and try playing with it. I think opening up the world of embedded programming is worth the price of the Arduino!

Good luck.
Brian
ok i guess ill look into an arduino. i guess ive been a little intimidated by the concept
There certainly USED to be single chip stepper drivers - the SAA1024 springs to mind AFAIR, but there don't seem to be many left these days.

Steve
jacob56802 years ago
Excellent!

The darken edges really add to the look. They define edges very well.

Love it. :)
rgeelen3 years ago
very nicely done but is it just me or is the laser just a bit too hot for the type of wood you are working with
if you use some thin ductape or plastic sheet to cover it maybe it would reduce the burning. but who am i to be talking ITS AWESOME
I think the burning gives it great character. Makes the clock have a rusty look to it or a bit of a Victorian look.
bpwagner (author)  Spiltmidi3 years ago
I would agree, I kind of like the old gradated burned look of the laser cutter on the wood. Working with the laser cutter takes some trial and error to find out what works well. If you have access to a laser cutter, try working with 1/8" plywood. You will find it works quite will.
maxjus3 years ago
Excellent! One tip I found to lessen the "ghosting" (where the wood turns darker around the cut) is to lower the power and increase number of passes. With birch plywood I usually use two passes at 45% power and 100% speed (30W Zing) if I'm trying to make it look good cosmetically.
pawelski3 years ago
Very nice. Great concept and great writeup. You got my vote! I can think of at least five cool ways to go from here. Can't wait till my new CNC router gets here. Mods of your clock are going to be some of the first things I do. I'm thinking acrylic cover on the outer ring with the numbers etched on the back side. Maybe an edge light at the top to make the number for the current hour glow.
mkanoap3 years ago
Great! Why is this not an entry in the clock challenge?
bpwagner (author)  mkanoap3 years ago
I am waiting for it to be approved. Please vote for it when it gets approved. Thanks!
Done!
mikeasaurus3 years ago
Comprehensive writeup, great documentation and code included! Awesome!