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.
Trigonometry.
cameras make me shutter with fear, math just makes me shudder. Math, and illiteracy.
shutter with fear because of the math ?
this is the most basic of basic trigonometry.
A twelve year old can do this.
@david
Both, actually. Trig to get the angles for the hands and geometry to draw the shapes.
@bty
I think it was more about drawing the objects than determining the position of the hands.
Nevermind…I did something I rarely do and failed to read the content of the link, first. You both are correct!
Yeah, this isn’t very complex trig :/
Cant you just draw several thousand pictures in paint?
Math be hard!
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.
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.
trig… hard?…
I want to know advanced linear algebra!
Hey, that is awesome!
I have something similar, however my analog clock is actually hand drawn! :)
It is a cool effect, have a glance here: http://liqbase.net/20110323_002.jpg
More useful would be to implement proper vector/matrix math with the mcu. Then anything graphical would be much easier.