To implement a software clock is a task that is often given to students in an informatics lesson. So the teacher is convinced that the student knows well not only the programming language being studied, but also trigonometry. But the computer on which the student solves this problem is too powerful for it, even if it is the ancient 386th, not to mention modern ones. With all the math involved there, and Arduino - so decided the author of Instructables under the nickname thescientistformerlyknownasNaegeli. Here he takes the 3.3 V Arduino Pro Mini, a single-bit display for the Nokia 5110 phone, a real-time clock module on the DS3231 chip, a battery and a charge controller, various accessories:
He collects all this according to this scheme:
And here is what he does:
But in the assembly there is nothing complicated. The most interesting thing is mathematics, for which the master takes it. Then it shows the direction of coordinates on the display:
Complicating the task for himself, the master implements arrows that are more complex than line segments, schoolchildren at computer science lessons rarely reach such complications, and then, when they grow up, they make up.
The wizard dwells on the most complex version, where the arrow consists of four points, and shows the formulas for calculating the coordinates of these points using two times as an example: 9:25 and 2:05.
The angle of inclination of the minute hand in degrees is easy to calculate: just multiply the number of minutes by 6. Only postpone the angle itself clockwise, and not against, as is usually done. For the clockwise direction, the angle is more difficult to calculate, given that it does not jump from division to division, but moves between them smoothly:
angle = (hours x 30 °) + (minutes x 0.5 °)
Well, the direction of the coordinates on the display also needs to be taken into account, by the way, in school DOS BASIC it also differs from that used by mathematicians. But since the arrows will be four-point, then the mathematics is floated somewhat more complicated.
Professional deformation of a programmer is a powerful thing, it can even make a person program on the beach instead of relaxing:
But now the sketch is ready, the master puts it here. After downloading, you need to change the file extension from unknown to ino.
Well, since when repeating the construction you are unlikely to work through all the math again, it would be nice to make do it yourself, with its own mathematics (taking into account wall thickness, and so on), at least the case, for example, from plywood or plexiglass, and not take ready-made or 3D-printed.
Clock repeated by Instructables rescueseven: