Learn The Geometry To Draw An Analog Clock On A Graphic LCD Screen

Does the image of the clock above make you shutter with fear because of the math you’d need to use to recreate your own version of the project? We certainly understand that High School geometry is becoming a very distant memory, but it’s really not as hard as you think. [Janw] built this analog clock using a graphic LCD and he’s done a great job of explaining the concepts behind it.

The hardware he’s using is pretty standard for an electronic hobby clock; an ATmega16, graphic LCD, DS1307 real-time clock, and supporting hardware like a potentiometer, resistors, and buttons. The code is written in Bascom, but like we said, [Janw] explains the concepts behind drawing the hands on the clock so you can recreate this with any microcontroller or software language you prefer. We  recommend grabbing a calculator and some blank paper. It took us a few tries to brush the cobwebs out and really grasp what he’s doing with each equation.

13 thoughts on “Learn The Geometry To Draw An Analog Clock On A Graphic LCD Screen

  1. Drawing the objects is simple

    Consider that you have two points A and B. The equation that gives you the funtion of a straight line between these points is

    y = Ay + (By – Ay) / (Bx – Ax) * (x – Ax)

    It isn’t any more complicated than that when you cut off the handwaving.

  2. Agreed… sad day when basic trig is considered a hack.

    But – I’ve been using BASCOM AVR for years, it’s freakin awesome. As it creates compiled code, it’s no slouch and the cases I feel compelled to code in C are far and few between.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.