Step 7: Hook up a Chronodot.

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);
// 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

LastMinute = 0;
LastSecond = 0;

//how fast is it gonna step

//test the minutes and hours to make sur it is going in the correct direction

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.requestFrom(0x68, 3); // request three bytes (seconds, minutes, hours)

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 ) {
LastMinute = ThisMinute;

//tick the hour ring every 5 minutes
if (MinuteCount > 5) {
MinuteCount = 1;


<p>AWESOME PROJECT!!!</p><p>(and a very nice hackerspace)</p><p>I will try and make something similar to this with my CNC router.</p><p>Maybe make the rings from clear acrylic and light in on the edge somehow with RGB leds.</p><p>Maybe have the mcu control the color, say in relation to the time (blue backlight for daytime and yellow for nighttime)</p><p>But I guess that the first challenge will be to see if my router can cut nice gears...</p>
<p>I like your idea of a color changing backlight. Thanks for the nice message. Brian</p>
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?
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! <br>
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?
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.
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!<br><br>Good luck.<br>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. <br><br>Steve
Excellent!<br><br>The darken edges really add to the look. They define edges very well.<br><br>Love it. :)
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<br>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.
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&quot; plywood. You will find it works quite will.<br>
Excellent! One tip I found to lessen the &quot;ghosting&quot; (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.
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.
Great! Why is this not an entry in the clock challenge?
I am waiting for it to be approved. Please vote for it when it gets approved. Thanks!
Comprehensive writeup, great documentation and code included! Awesome!

About This Instructable


190 favorites


Bio: I am a middle school computer teacher with an EE degree. I do programming to pay for my teaching habit. I am also one of ... More »
More by bpwagner: Laser cut gear clock - with ChronoDot! LED DNA Model American Girl Doll House
Add instructable to: