Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Apple II clock using interrupts from physical pendulum clock (github.com/wkjagt)
157 points by wkjagt 8 months ago | hide | past | favorite | 29 comments
A clock app for my Apple ][ clone in 6502 assembly, using interrupts generated by an inductive proximity sensor and a physical pendulum clock. I wanted to polish the code a bit more before sharing (I especially dislike the self modifying code part), but the computer seems to have developed a hardware problem lately and it keeps crashing (bad RAM chip most likely), so I am sharing as is.



Interesting idea to use an inductive sensor. I personally would have suggested a hall sensor (though that would involve fixing a tiny magnet to the pendulum) as the cheapest solution. But of course there are many ways to solve the same problem. Neat project, thanks for sharing!


The canonical way of using pendulums as time reference in electronic circuits, is to use magnetic pendulum coupled a special circuit (a bjt and an inductor) that would not only sense the pendulum but also reenergize it.

example: https://electronics.stackexchange.com/questions/685779/elect...


Oh cool I didn't know that existed. In my case I don't have to re-energize it because I use an existing mechanical clock.


If you are curious about this sort of thing, look up master pendulum clocks. They were precision clocks that provided electric timing pulses to network of slave clocks or other uses. Afaik they were common in mid-20th century


Here I was imagining you had to wind your computer with a key every morning.


I also got a rotary encoder with the plan to use it with a wind up clock. So maybe one day!


My mind went to an optical sensor. Either interrupt a beam with the pendulum or attach a small reflector to the arm.


Optical sensor would be the best option - both induction and hall effect will add a very tiny eddy current brake effect that will slow down the pendulum. Probably imperceptively, but it'll be there and will affect time keeping eventually.


Thanks! I liked the inductive sensor, because it meant I didn't have to change the physical clock in any way. And they were only like 5 CAD each.



Oh wow, he uses the 60hz signal from the video circuitry. That's way more convenient than a big wall clock ;) And he even uses the same interrupt gating idea for the interrupts by using the game port.


He is me :-) And yes, that's exactly right.


Ha, even cooler! Very nice to see :-)


Wow, people are still working on the problem of the Apple II not having an RTC, in some shape? :)

Say, weren't there some issues with interrupts on the Apple II, due to both the 6502 as well as buggy ROMs? Basically, none of the I/O in the stock system with Apple parts used interrupts whatsoever. Not disks, not serial communication.


The problem with the original firmware was that its interrupt handler used a zero-page location to store the accumulator. AppleSoft BASIC uses the same zero-page location for its own use, which makes BASIC incompatible with interrupts.

Another problem was with in the original Apple IIe. Its firmware interrupt handler was not updated to handle the new auxiliary memory and 80-column video configurations.

ProDOS provided proper support for interrupts, even on older Apple IIs (needed for mouse-based GUI apps and realtime clocks), and the firmware was eventually updated in the IIc and Enhanced IIe.


Yeah I think nothing actually uses interrupts by default. But they're accessible through the expansion ports. Not sure what the problem would be though.


Serial interfaces could use interrupts, and it was necessary at higher baud rates.


Yes, I remember writing a print spooler using interrupts as part of my first job.


This is quite interesting; I've been reading up on PLL and chip design lately, as well as VCOs, TCXOs, etc.

And now I'm wondering how accurate someone could make a reference signal from a physical pendulum like this—or what strange quirks you could introduce into a system using such a 'weighty' clock source!


Many pendulum clocks are capable of well under 1 ppm accuracy, which is better than many quartz oscillators. Here is a tour of clock precision by orders of magnitude:

http://leapsecond.com/ten/

Here is a world record setting pendulum clock from a few years ago:

http://leapsecond.com/pend/clockb/

Precision pendulum clocks are a very deep rabbit hole.


See also https://en.wikipedia.org/wiki/Shortt%E2%80%93Synchronome_clo...

> The Shortt was the first clock to be a more accurate timekeeper than the Earth itself; it was used in 1926 to detect tiny seasonal changes in the Earth's rotation rate. Shortt clocks achieved accuracy of around a second per year

If my math is right, thats about 30ppb


Really love this idea and execution. Truly fantastic!


Thanks :D


Neat project. But I want more pictures of the mechanical clock too. All I can see are the pendulum, weights and chain. I'm going to guess it is a German Hermle movement? Is that a custom made clock case?


Oh good point, I hadn't even considered posting a photo of the clock itself. I'll add a picture of it to the post later. But to answer you question: no custom made clock case. The wood you're seeing is the wall. And the clock is a Junghans (so indeed German), I would say midcentury modern? Almost identical to this model (found through Google Images) : https://a.1stdibscdn.com/archivesE/upload/1121189/f_13997072...


The high pitch from the CRT in the video (on GitHub) has my 40 year old ears feeling pretty happy about themselves!


I am 46 and I don't hear it, not even when I am sitting right next to it. But others who I've show the computer to have noticed the noise as well, so I know it's there. I'm actually kinda happy about not hearing it myself :D


This is awesome!

Also, a heads-up to OP: the personal website linked from your GitHub account appears to be down.


Thanks! And I forgot I still had that site linked there. I'll remove it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: