Beating a Pendulum Clock - Page 1
Forum section: electronics / projects

author: jpanhalt
author_rank: Super Contributor
timestamp: October 14, 2021, 05:03:25 pm
content: (show and tell)As I approach 80, my hearing is not what it used to be. I cannot hear the tick-tock of a small wall clock I built from a kit years ago (1975). With very little searching, I found a BOB based on the MAX9814 that includes an electret microphone. Quite cheap on eBay or Amazon (2 for $6.38 incl. tax and shipping). I used the version from Amazon. It is branded with the Adafruit logo. The Adafruit site gives a link to its schematic on GitHub. It easily picked up the beat of the wall clock and a Timex wrist watch, but the signal needed some cleaning up to get the beat right (i.e., the tick and tock periods are equal). Since the BOB operates from a single supply, the output has a positive offset by about 1.25V. Peak to peak voltage is only about 700 mV.In brief, the MAX9814 BOB output was used as input to an LM393 dual comparator with a single supply of 5V. Vref was set at about 1.5V to 1.7V (measured Vref = 1.72V). That gave multiple output pulses corresponding to the beat sounds; however the duration of the sound was much shorter than the period of the beats, which was about 1 second. A CD14538B dual precision monostable mulitvibrator was used in non-retriggerable mode with a pulse width of about 100ms to suppress the additional beats.An image from my oscilloscope is shown below (attached):Yellow = Output from the CD14538Blue = Output from the LM393Magenta = Output from the MAX9814 BOBA schematic is also attached. I have included connections for the unused sections of the dual devices. Uncoupling capacitors across VDD and VSS were used with each IC, but are not shown.Next step now that it is getting cold is to do the whole thing, except the BOB, on a small PIC12F1840 or similar.

author: Manul
author_rank: Super Contributor
timestamp: October 14, 2021, 08:31:37 pm
content: That's an interesting project, good job! My comment is that it might be worth to try contact microphone, like a piezo plate. It might give much cleaner sound and better ambient noise rejection (in other words, better SNR). Also, if it is a pendulum clock, maybe IR optical sensors are an option, that would be a rock solid solution, but not very universal and possibly requires too much intervention into clock.

author: jpanhalt
author_rank: Super Contributor
timestamp: October 14, 2021, 08:48:49 pm
content: Thanks for the interest.There are lots of ways ways to do it, including a piece of paper with marks. It all comes down to equal swings, like we did in analytical chemistry 60 years ago.Actually, the next step will give a digital output. I put this project up here because of another thread on "drip detection." Lots of ways to do that too, but the author of that thread mentioned a data logger, and the little BOB I used might be of interest to him/her.

author: GigaJoe
author_rank: Frequent Contributor
timestamp: October 14, 2021, 10:08:01 pm
content: then OCXO, MCU, display and it would be device to calibrate mechanical pendulum clocks quite easily. too bad didnt know any watch maker ..

author: harerod
author_rank: Frequent Contributor
timestamp: October 14, 2021, 10:34:53 pm
content: I come from a family of watchmakers. The person who supplied preschool-me with clockworks to take apart, was my grandmother's uncle, the last master watchmaker in the family. That uncle, who had learned the trade from his father (my grandmother's grandfather), kept a watchmaker's shop on the side, while teaching electronics as a day job. I wanted to learn the trade, but at that time digital watches were considered a pretty neat idea. So I ended up in electronics.jpanalt, when I read your project description, I was reminded of a tool to adjust wristwatches. A small velvet cushion on top of a cigarbox-sized metal case hid a microphone. When a watch was placed on that cushion, the microphone would pick up the Unruh's (balance wheel) sound and compare it to an internal electronic oscillator. The drift in phase difference between that tick, which for small watches would be a multiple of 1Hz, and the internal clock, would cause the hand of a small Drehspulinstrument (moving coil instrument) to move left or right from its zero center position. The tension on the timing spring would then be adjusted as required.Thinking about that, this tool might have been the reason why I never had trouble understanding PLLs.

author: ivaylo
author_rank: Frequent Contributor
timestamp: October 17, 2021, 04:04:28 am
content: Nice project! A couple of years ago I played with timing an old pendulum clock I have. My sensor was a photo interrupter (first photo - a piece of foil attached to tip of pendulum going through the interrupter). I measured the pendulum period with a OCXO HP 53131A which I read every minute with a Python script. I was prepared to see the 24h oscillation due to the nightly temperature change, but not for the one with ~1h period (second picture). Turns out the third (or fourth? don't remember at this point) wheel/pivot was bent. Would have never seen it without this...

author: Zero999
author_rank: Super Contributor
timestamp: October 17, 2021, 10:02:39 am
content: You could have used the other half of the LM393 as a monostable, rather than the CD14538B.The calculator on the website linked below, can be used to give standard resistor values, for the potential divider, removing the need to connect two resistors in parallel, to get an odd value.https://www.random-science-tools.com/electronics/divider.htmIt's definitely a good idea to replace the comparator and monostable, with a microcontroller.

author: Terry Bites
author_rank: Super Contributor
timestamp: October 17, 2021, 11:08:35 am
content: The mic could pick up extraneous sound. But if it works it works. An inductive sensor is ideal but you could also consider / infrared photo reflective/ capacitive /proximity sensorsIf you want to get into some detection perfection, check out the LX3301/2 from Microchip. Yummy!

author: jpanhalt
author_rank: Super Contributor
timestamp: October 17, 2021, 11:24:52 am
content: @Guga JoeThe oscilloscope did decent timing -- maybe as good as Vladimir Horowitz could do by ear.The MCU version is well on its way. The discrete version has now been duplicated on a PIC 12F1840. (That was done to troubleshoot as I cannot simulate the comparator function.) Today's work will be to set up capture using a 32.768 kHz clock crystal on TMR1 and do some calculations. I may need to add a few pins and switch to something like the 16F1829. That will allow additional "debugging" outputs.@harerod"I come from a family of watchmakers. The person who supplied preschool-me with clockworks to take apart, was my grandmother's uncle, the last master watchmaker in the family. "My experience was similar. One of my uncles (born 1900) did watch repairing ("picking ticks") and jewelry. I spent many of weekends in the 1950's with him doing as you did, disassembling a small stack of watches, cleaning and reassembling them. Of course, they were not the finest watches. My errors were what I learned from, including how to remove a broken screw (left-hand screw on the mainspring), make pinions and stems, replace jewels, and use shellac as an adhesive. His lathe was the older type without a compound rest. One held the triangular tool between your fingers.@ivayloThank you for the compliment. The clock was an Emperor Clock kit and has a Jauch 77 spring-powered movement. The verge/pallet was way out of alignment so it wouldn't run unless the clock was about 6° out of vertical. It would have been easy to make that easily adjustable, Instead, it i just guess work.@Zero999Hello. Long time since we shared experiences on ETO with your former alias. Yes, there are ways to use the other half of the LM393, but in this approach, it was critical to have a non-retriggerable one-shot. The MAX9814 offsets its output about 1.25V to avoid needing a dual supply. The output voltage oscillates around that offset, and I wanted to time from the first rising edge. That still created an uncertainty, but it is relatively small compared to the period of 1 second.

author: jpanhalt
author_rank: Super Contributor
timestamp: October 17, 2021, 11:30:14 am
content: @Terry BitesI wanted something that required no modification whatsoever, including opening the case. The microphone works as well with my Timex wristwatch as with the pendulum clock. Ambient sounds are a problem. Fortunately, I live in the middle of a forest, and it is quiet, except for an occasional woodpecker. I am sure it will detect them too.

author: Zero999
author_rank: Super Contributor
timestamp: October 19, 2021, 04:13:33 pm
content: Quote from: jpanhalt on October 17, 2021, 11:24:52 amYes, I remember you. I was banned from there around 12 years ago, along with many others who fell out with the administrator. The problem was the forum got trolled by lazy students asking for complete assignments. Myself and many others told them to bugger off, which was interpreted as bullying by some of the overly PC ETO staff and we faced disciplinary action. How's ETO nowadays?QuoteI was thinking about something like this. The time delay is equal to R1*C1. In the stable state, the output is low and C1 is uncharged. When U2's inverting input is taken below 37% of the supply voltage, its output pulls one side of C2 to 0V, taking U1's -input below 0V, by 0.7V, as it's clamped by the PNP transistor in the input stage. U1's output will go high, charging C1 via R1 and R4, causing the +input to be higher than the -input. When C1 charges by one RC time constant, i.e. 63% of the supply voltage, the voltage across R1 will drop below 37% of the supply, U1's output will fall to 0V and discharge the rest of the voltage on C1, via D1. You could probably omit D1 but it's a good idea to include it, as there's a risk the current through the PNP input stage could be too high.The circuit is non- retriggerable and is edge triggered. R7 is such a high value, the voltage on U1's -input barely changes, when U2 goes high and discharges C2. Any further pulses, whilst the output is high are ignored, because U1's -input will be lower than its +input, whist C1 is charging. If the trigger pulse is longer than the delay, the output will still go low, at the end of the time delay.The trigger threshold will be about 1.85V, when operated off a 5V supply, a little higher than 1.7V, but probably acceptable.R2 & R3 will alter the trigger threshold, but also the delay, so it's no longer = RC. Another potential divider could be connected to the +input to U2, to set the trigger threshold independently.

author: jpanhalt
author_rank: Super Contributor
timestamp: October 25, 2021, 04:01:51 pm
content: UPDATEI have been playing with this project a little in between my other chores to get ready for Winter. It seemed obvious that "capture mode" would be the way to go. That does work well on a 16F1829. One needs to shut off the comparator/capture after the first rising edge or capture is exercised several times for each beat. However, I was committed to using that chip's little sister, the 12F1840. Unfortunately CCP and C1OUT share the same pin. I could not get it to work. Moreover, there weren't enough appropriate pins for that plus serial out,oscilloscope out, and the comparator input. So, I went with a simple stop TMR1, read, start routine. That adds very little error. Attached is the "final" schematic and code for the 12F1840.While the numeric display is interesting, I found it not as helpful as the graphical display on the oscilloscope. The clock works are open and small movements and breezes affect the pendulum. The graphic display allows one to identify easily those disturbed ticks and tocks. A clock mechanism in its case might not show such variations. I decided not to mess any further with the numeric display/math. The code as posted simply reports the 16-bit TMR1 counts in hexadecimal.