NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » Clock Display (RTC + LED Matrix)

September 21, 2010
by jbremnant
jbremnant's Avatar

My wife recently asked me if I can make a digital clock from all the microcontrollers and electronic parts I've been playing with. She wanted to teach our son how to read the clock, and so she goes, "if you can make something useful out of your hobby, I'll be pretty impressed". :-O them challenging words..

Ok, so I set out to create a digital clock with atmega168 and 32x8 led matrix from sure electronics I had laying around. The first things that came to my mind:

  • how do I display stuff onto led matrix?
  • do I use the internal oscillator or the external oscillator?
  • how accurate is each option?
  • should I just use RTC ICs that already compute time/date for you and just interface it via I2C bus?
  • timer will fire an interrupt. If this interrupt is being triggered from system clock, how will this interfere with synchronizing info to the display?
  • will my wife let me buy more stuff for this hobby if this is successful?

Long story short, I completed it, and here are the components that make up the completed clock_display:

  • atmega168 running with system clock at 8MHz

    • necessary fuse setting if you are using ISP
    • avrdude -F -p m168 -P usb -c avrispmkII -U lfuse:w:0xE2:m
  • RTC timer interrupt triggered via external crystal at 32.678kHz.

    • Timer2 with prescale value of 1024.
    • value comparison trigger at 31 - generates interrupt exactly at 1 sec intervals.
    • found the following post on atmega+32kHz
  • Led matrix interfaced via SPI-like protocol just using 3 pins.

    • There are tons of info online. i.e: my post
    • tried to optimize by writing the info to ram and then sync in one go.
    • displays hours:minutes and binary ticker at the right corner
  • 2 push buttons increment hour and minute counter

    • push buttons are on IO pin change interrupt
    • generates audible tick using piezo buzzer
  • Been running it for 2 days and so far it deviated about 1 sec.

    • this would equate to roughly 3 minutes per year. Not too bad, I think.
  • Enclosure made out of lego parts

    • yeah, my wife helped me out with this. The choice of colors wasn't mine. :-)
  • Used the following ISP to program the chip:

Here are the pictures front top back board

And the link to tar file containing code and Makefile.

download

Let me know if you are looking to implement something similar, I'll be happy to share what little I know. :-) And thanks for nerdkits staff for introducing me to this cool hobby.

September 22, 2010
by brian
brian's Avatar

Nice Job! By the way, you got noticed on hackaday!

Post a Reply

Please log in to post a reply.

Did you know that you can connect digital calipers to a microcontroller? Learn more...