Picture of Analog clock for graphic LCD
Writing a code for an analoge clock may seem a bit of a daunting task. Especially the calculations for the positions of the hands, but it isn't really that hard at all.

In this instructable I will talk a little bit about the theory and then we'll move on to the actual code itself. This was just a project build on the breadboard, while building my wifi radio. It started life as the script for a grafical volume button and ended up as a clock that never made it in the final project but it might come in handy for one of you out there.

My code will be written in Bascom but it will be very easy to translate it into your favorite language once you understand the theory.
Remove these adsRemove these ads by Signing Up

Step 1: What do we need?

For this instructable, you'll need:

A breadboard
An Atmega16
A grapic LCD (240*128)
A DS1307 Realtime Clock
A 32.768kHz quartz crystal
A 3V battery + holder
Two 4K7 resistors
Two 1K5 resistors
Two pushbuttons
A 10K potentiometer
Your favorite programmer

akarimnasab10 months ago


thanks i have an old TFT can this work on it
janw (author)  ramjisamrat1 year ago
Sure, you'll only need to find a way to drive your TFT.
ACASSIS4 years ago
Hi janw,

Nice DIY, congratulations.

My suggestion to improvement:
Each 12 minutes you need to increase the hour pointer.

I did an analog clock fews year ago (~ 12 years), but I didn't improve its visual:


janw (author)  ACASSIS4 years ago
good idea indeed.

I will work on it