The Classic Jameco Clock Kit

Redesigning and Resurrecting

By Ryan Winters
Product Manager

What time is it? It's time for a new kit. Jameco Electronics is celebrating its 40th year in the business and since we're on the topic of time, we're designing a clock kit. The inspiration came from browsing a few of Jameco's older catalogs from the archives.

I came across a clock kit created about 20 years ago that we haven't sold in about 10 years because, as time passed, some of the components have become obsolete. Not only did this seem like the perfect kit for a redesign, but I thought this was a good opportunity to get some feature ideas from our readers and make it an open-source collaboration.

The base design of the clock is going to display the time and date. I'd like to know what other timing functions or clock features you would find useful. You can email me your suggestions at [email protected] with the subject line Clock Kit.

Some ideas that have already trickled in are a stop watch, count-down timer and ambient temperature display. When the kit is ready for sale, other customers will be able to download and incorporate other segments of code to enhance their clock. Of course, if the added feature requires additional components, we'll make sure you know what you need.

Base Circuit Schematic Base Circuit Schematic (Click to enlarge)

The project will use an Arduino or compatible circuit, the DS1307 RTC, 7-segment displays and a MAX7219 LED driver IC to drive the 7-segment displays. It's going to include at least two pushbutton switches hooked up to the two interrupts of the Arduino for changing through display options or program features. It will also include prototyping space and easy access to the remaining I/Os when future owners want to add more capabilities.

Clock chips have evolved over the years but keeping time is their claim to fame. The Real-Time Clock (RTC) counts hours, minutes, seconds, day of the month, day of the week, month and year, and has leap-year compensation. The DS1307 in particular is valid up to year 2100, so you probably won't have to worry about Y2.1K in your lifetime. The clock can be operated in a 24-hour or 12-hour format and can automatically switch to the backup battery when it detects main power has been lost.

Arduino has created some Time Libraries that can keep track of time with or without the need of additional hardware. The Arduino can grab time data from National Time Servers, GPS data, radio signal and serial data from your computer. Ideally this clock will be standalone, so that's where the DS1307 comes into play.

There are other variations of the Real-Time Clock chip, such as the DS3231, that feature a temperature-compensated crystal oscillator for even more timing accuracy. Our circuit will include a header with redundant traces to the SDA and SCL pins if you wanted to upgrade your RTC to the Chronodot, which uses the DS3231.

Arduino Code

#include "LedControl.h"
#include <Wire.h>
#include <Time.h>
#include <DS1307RTC.h>
#define LED 13

/*
 Now we need a LedControl to work with.
 pin 12 is connected to the DataIn (pin 1)
 pin 11 is connected to the CLK (pin 13)
 pin 10 is connected to LOAD (pin 12)
 We have only a single MAX7219.
 */
LedControl lc = LedControl(12, 11, 10, 1);  //establish the display chip
unsigned long delaytime = 250;  //brief pause after initializing the display
volatile int state = 0;  //keeps track of button press
volatile int sequences = 4;  //total display sequences in switch case, change as needed


void setup() {
  Serial.begin(9600);  //enabled for serial output monitoring
  pinMode(LED, OUTPUT);  //used for flashing seconds indicator
  attachInterrupt(0, buttonPress, CHANGE);  //button on pin 2 for mode change
  //attachInterrupt(1, functionName, CHANGE); // button on pin 3 for future functions
(uncomment to use) lc.shutdown(0, false); /*MAX7219 is in power-save mode, wake it up */ lc.setIntensity(0, 12); /* Set the brightness to a medium value (range is from 0-15) */ lc.clearDisplay(0); /* clear the display */ setSyncProvider(RTC.get); // the function to get the time from the RTC } void loop() { /* main program loop */ delay(500); /* slows down the time reporting to twice per second */ switch (state) { /* button press determines which mode is displayed */ case 0: /* default button state is 0, display time in 12 hour format with seconds */ Time12(); break; case 1: /* button state 1, display time in 24 hour format with seconds */ Time24(); break; case 2: /* button state 2, display 12 hour time without seconds, adds A(AM) or P(PM) */ Time12AMPM(); break; case 3: /* button state 3, display the date */ DisplayDate(); break; default: /* any other button presses returns state back to default (0) */ state = 0; } // blink the colon, every other second if (second() % 2 == 0) { digitalWrite(LED, HIGH); } else { digitalWrite(LED, LOW); } } /* ///////////////////////////////////////////////////////////////////// //// when button on pin2 is pressed, state is incremented and the display is changed */ void buttonPress() { static unsigned long last_interrupt_time = 0; unsigned long interrupt_time = millis(); // If interrupts come faster than 200ms, assume it's a bounce and ignore it if (interrupt_time - last_interrupt_time > 200) { for (int i = 0; i < sequences; i++); { state = state++; lc.clearDisplay(0); } sequences = 0; last_interrupt_time = interrupt_time; } }
Take a look at our design and email [email protected] to let us know what you'd want on your clock!
Ryan Winters is a Product Manager at Jameco Electronics and a Bay Area, California native. He is mostly self-taught and his hobbies include working on cars and computers, fiddling with electronic gadgets and experimenting with robotics.