[HN Gopher] Show HN: Apple II clock using interrupts from physic...
       ___________________________________________________________________
        
       Show HN: Apple II clock using interrupts from physical pendulum
       clock
        
       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.
        
       Author : wkjagt
       Score  : 98 points
       Date   : 2024-01-28 15:55 UTC (7 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | mungoman2 wrote:
       | Really love this idea and execution. Truly fantastic!
        
         | wkjagt wrote:
         | Thanks :D
        
       | guytv wrote:
       | This is awesome!
       | 
       | Also, a heads-up to OP: the personal website linked from your
       | GitHub account appears to be down.
        
         | wkjagt wrote:
         | Thanks! And I forgot I still had that site linked there. I'll
         | remove it.
        
       | em3rgent0rdr wrote:
       | 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!
        
         | joezydeco wrote:
         | My mind went to an optical sensor. Either interrupt a beam with
         | the pendulum or attach a small reflector to the arm.
        
         | SomeoneFromCA wrote:
         | 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...
        
           | wkjagt wrote:
           | 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.
        
             | zokier wrote:
             | 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
        
         | wkjagt wrote:
         | 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.
        
       | geerlingguy wrote:
       | 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!
        
         | tvb wrote:
         | 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.
        
           | zokier wrote:
           | See also https://en.wikipedia.org/wiki/Shortt%E2%80%93Synchro
           | nome_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
        
       | kazinator wrote:
       | 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.
        
         | wkjagt wrote:
         | 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.
        
         | noxon wrote:
         | Serial interfaces could use interrupts, and it was necessary at
         | higher baud rates.
        
           | tonyedgecombe wrote:
           | Yes, I remember writing a print spooler using interrupts as
           | part of my first job.
        
         | thought_alarm wrote:
         | 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.
        
       | lisper wrote:
       | Related from 1981: https://news.ycombinator.com/item?id=20013486
        
         | wkjagt wrote:
         | 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.
        
           | lisper wrote:
           | He is me :-) And yes, that's exactly right.
        
             | wkjagt wrote:
             | Ha, even cooler! Very nice to see :-)
        
       | technothrasher wrote:
       | 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?
        
         | wkjagt wrote:
         | 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...
        
       | jamesbfb wrote:
       | The high pitch from the CRT in the video (on GitHub) has my 40
       | year old ears feeling pretty happy about themselves!
        
         | wkjagt wrote:
         | 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
        
       ___________________________________________________________________
       (page generated 2024-01-28 23:00 UTC)