Laser cut gear clock - with ChronoDot!

FeaturedContest Winner

Step 7: Hook up a Chronodot.

Picture of 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:

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:

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
* 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;


Remove these adsRemove these ads by Signing Up

Get More Out of Instructables

Already have an Account?


PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!