Announcement

Collapse
No announcement yet.

Improving a slow/fast digital clock

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Improving a slow/fast digital clock

    Good day folks. This is one of those things that just popped in my brain and doesn't serve much purpose other than to maybe learn something and get a good laugh out of it, so: I'm using a plug-in timer outlet to turn on some RGB LEDs at a specific hour. It's a cheap nasty thing, so the clock on this thing tends to run fast, that is, it's off by up to 5 minutes after around 2-3 months, so I have to go in there and turn it back again...not a big deal, since we're not talking atomic precision here, but still a chore. That got me thinking if I could do something about it.

    I learned that AC-powered clocks usually get their sync pulse from the 50Hz frequency of the mains...to begin with, is this even true ? If so, I imagine the frequency of the outlet is not perfect at all times, of course, which causes the little clock to run fast. Makes me wonder why it's just this one though - I have like 6 other clock devices in my house which remain perfectly stable and never seem to go off...they probably have a clock chip or some dedicated oscillator (?) ? This got me thinking if I could somehow feed the timer with a stable frequency as well, instead of relying on the mains frequency....just a silly little project, since I KNOW there probably exist better quality outlets for this job, or even the DIY route of building my own using a micro, which I DID think of, but consider to be way overkill for this...or maybe not - actually, let's discuss that as well
    Wattevah...

    #2
    Re: Improving a slow/fast digital clock

    The 50hz is very accurate, and clocks DO use it for timing (almost all appliances that have a clock use this) But if the sync circuit is defective (bad cap) or is a poor design, spikes on the line can effect it. some light dimmers would effect some of the older clock circuits.
    If the 50Hz is even out of phase the power grid will likely shut down.
    Open the clock and you might see a problem
    Last edited by R_J; 10-26-2019, 10:27 AM.

    Comment


      #3
      Re: Improving a slow/fast digital clock

      I opened the timer in question a couple of times and as expected it uses a capacitor dropper to step down the mains voltage into something more usable. It even has a built-in NiMh battery so it keeps its settings when you unplug it. I think it has an epoxy blob chip to do the job, instead of an actual IC...can't remember right now. I might open it up again for fun.
      Wattevah...

      Comment


        #4
        Re: Improving a slow/fast digital clock

        should look at the board to see what design it uses.

        Some newer AC powered clocks use crystals and those can be notoriously inaccurate after time. Others are pretty good.

        I've heard that line frequency around the world is thinking about devolving from PPM accuracy to save generation money, which would cause serious inaccuracy to clocks depending on line frequency as a timebase. Don't know which locales have switched or never cared to begin with, but it's something to keep in mind.

        Comment


          #5
          Re: Improving a slow/fast digital clock

          Mains frequency moves up and down but is still pretty accurate over the long term. It's better for timekeeping than a cheap quartz crystal oscillator- because they change frequency based on temperature and supply voltage and aging. So they drift around and do poorly unless the circuit has the right tuning and temperature compensation and regulated VCC. Nobody uses trimmer capacitors like they used to. So those cheap chinese digital clock kits have terrible drift.

          All the older LSI clock IC's used mains for the timekeeping reference signal and it works great until there is a power failure. Mine 1970's with MM5316/LM8361/MM5387 IC has an RC oscillator to keep timekeeping off the 9V battery and it does OK.

          A modern RTC like DS3231 has built-in crystal oscillator and tuning etc. and is very good I set mine maybe once a year.

          I also have a MM5369 using 3.579545MHz crystal (divided to give 50/60Hz) and it is perfect at 25°C but at 20°C or 30°C it goes a many seconds/week off. It's very hard to correct for temperature.

          Comment


            #6
            Re: Improving a slow/fast digital clock

            TCXO oven

            Comment


              #7
              Re: Improving a slow/fast digital clock

              I can't afford the heating bill, lol. It has to be hotter than the highest ambient temp, say 35C and only HAM gear has it.

              I tried to calibrate a Casio watch, but it's cold sitting on the dresser and warm when you are wearing it, so I gave up.

              Found measurements of 50Hz mains frequency: https://wwwhome.ewi.utwente.nl/~ptde...isc/mains.html
              Attached Files
              Last edited by redwire; 10-26-2019, 03:13 PM.

              Comment


                #8
                Re: Improving a slow/fast digital clock

                Originally posted by redwire View Post
                Mains frequency moves up and down but is still pretty accurate over the long term.

                [snip]

                All the older LSI clock IC's used mains for the timekeeping reference signal and it works great until there is a power failure. Mine 1970's with MM5316/LM8361/MM5387 IC has an RC oscillator to keep timekeeping off the 9V battery and it does OK.
                This USED to be mandated (USA) by regulation (WEQ-006). Cumulative errors of +- 600 cycles (10 seconds) used to initiate a frequency adjustment to bring the average frequency back to 60Hz (slewing about 1 second per hour). That requirement was dropped 3 or 4 years ago. As such, clocks based on synchronous motors or LFC will now drift, over time.

                This is unfortunate as I had developed a very nice clock algorithm that used the LFC as a LONG TERM timebase for a short term PLL that tweeked the local CPU oscillator to obtain precise time even while the LFC was drifting! (i.e., use the local oscillator for timekeeping in the short run -- cuz the LFC varies up to 10 seconds at a time -- and calibrate it against the LFC in the long run -- cuz the XTAL is "low quality"/uncalibrated)

                Technical read, attached.
                Attached Files

                Comment


                  #9
                  Re: Improving a slow/fast digital clock

                  I worked in power generation, multiple 400MW coal-fired plants and they did have few hour shifts to correct (long term) frequency. If you throttle down the turbine (lower steam pressure), power output is lower but the grid frequency is just "pushed" less, so it would drop. It was usually at night when grid load is less.

                  I still find mains clocks beating cheap quartz crystals for drift.

                  Comment


                    #10
                    Re: Improving a slow/fast digital clock

                    i bet it's not using mains.
                    post photo's

                    Comment


                      #11
                      Re: Improving a slow/fast digital clock

                      Originally posted by redwire View Post
                      I still find mains clocks beating cheap quartz crystals for drift.
                      That depends on the environment and application. E.g., an XTAL deployed in an environment where there are few temperature variations is relatively stable (like a wristwatch that is ALWAYS worn).

                      I have used an LFC in virtually all of my designs (medical instruments, process control systems, etc.) going back to the early 80's as an accurate (stability != accuracy) and (long term) stable time/frequency base. There's very little cost/space to implementing it. It also gives you an early warning indicator for power failure and, for battery-backed devices, lets you know when you're operating off that battery (without requiring a separate signal from the charger)!

                      I knew that I could accurately measure time intervals with it (using the local oscillator as described above for fine granularity and to eliminate short term drift) and base measurements/controls on those observations -- without the cost/space that a TCXO would require.

                      [TCXOs primarily find use in my maritime products -- huge temperature extremes, poor power quality, absence of local technical support]

                      Knowing the utilities were required to provide this level of service made it a safe design bet.

                      Now, the LFC only has value in frequency locking to the instantaneous mains frequency (to improve SNR, reduce display beating, etc.) -- i.e., I want to SEE the actual variations in line frequency and exploit them!

                      Thankfully, there are other inexpensive sources of time (inverse frequency) information that are now available for many applications (e.g., NTP and PTP for network-connected devices) so you can still avoid the need for a LOCAL precision timebase. (I use a bastardized PTP here to ensure the clocks in my devices track to within a fraction of a microsecond across scores of nodes)

                      Comment


                        #12
                        Re: Improving a slow/fast digital clock

                        does the timer involve mechanical parts ?

                        Comment


                          #13
                          Re: Improving a slow/fast digital clock

                          Originally posted by petehall347 View Post
                          does the timer involve mechanical parts ?
                          No, it doesn't. In fact, here's some pictures of it...not much going on inside. There's a cap dropper, a relay and a couple of capacitors as far as the power side is concerned, so I reckon the brain of it all is on the board on the left where the buttons and display are. The flex cable going between the boards has its pins labeled "VDD, GND, J and PWR". Three of those make sense right away: VDD power for the chip, GND and I would surmise PWR stands for the signal going to the relay trigger circuit. That J is a bit of a mystery and although I haven't taken the board out to see where it leads, I think it might be where it's grabbing the 50Hz sync pulse for the clock ?

                          This particular one is not the one currently in service, but an identical one I had laying around for some unknown reason (I actually had no idea I bought TWO ), so I'll pop this one in to see if it drifts as well over, say, one month's time.
                          Attached Files
                          Wattevah...

                          Comment


                            #14
                            Re: Improving a slow/fast digital clock

                            One thing that's weird is that the battery is on the power board, does the controller know whether or not AC is applied (when you unplug it, does the LCD go blank?)

                            Comment


                              #15
                              Re: Improving a slow/fast digital clock

                              Originally posted by eccerr0r View Post
                              One thing that's weird is that the battery is on the power board, does the controller know whether or not AC is applied (when you unplug it, does the LCD go blank?)
                              No, it doesn't go blank when you unplug it, so it's a backup battery to save the clock and settings. However, when the battery finally dies out, like this one has after it's sat in a drawer for so long, the next time you plug it in, the display doesn't come on right away like you'd expect, so when I first bought it and brought it home I thought it was defective, but it turns out that battery must reach a minimum lever first before the thing can run, so maybe the capacitor dropper is only charging the battery and the IC runs ON the battery itself rather than on mains...I'll have to do a bit of a dig to find out how the traces are connected to find out for sure.
                              Wattevah...

                              Comment


                                #16
                                Re: Improving a slow/fast digital clock

                                Ah okay, so it charges the battery and powers to the microcontroller, so that J wire remains a mystery that could be some sort of sync pulse. Need photos of the bottom side of the board, and/or see if there's a crystal on the LCD board...

                                Comment


                                  #17
                                  Re: Improving a slow/fast digital clock

                                  It would need to use a crystal for timekeeping from the battery. This unit looks like good quality.
                                  I think there is no voltage regulator (maybe just zener Z2) and they wear out the NiMh battery because it's always charging. J might be the battery. It's big at 80mAh for some reason.

                                  It could be the crystal needs tuning or that VCC moves up when the relay is off.

                                  Comment


                                    #18
                                    Re: Improving a slow/fast digital clock

                                    Well, not necessarily, those old alarm clocks used RC oscillators to "keep" time when the power is out...they are HORRIBLE in accuracy when power is out, but better than if it didn't have an RC oscillator. It'd have a clock error equal to at least the amount of time the power has been out...

                                    Comment


                                      #19
                                      Re: Improving a slow/fast digital clock

                                      Originally posted by eccerr0r View Post
                                      Well, not necessarily, those old alarm clocks used RC oscillators to "keep" time when the power is out...they are HORRIBLE in accuracy when power is out, but better than if it didn't have an RC oscillator. It'd have a clock error equal to at least the amount of time the power has been out...
                                      Yes, I can fully confirm this with two alarm clock radios I've got which have a 9v backup battery and "keep" the time when their power is cut, though like you said the accuracy is terrible over anything more than a few minutes at best
                                      Wattevah...

                                      Comment


                                        #20
                                        Re: Improving a slow/fast digital clock

                                        I didn't know until fairly recently that crystal controlled (but not TCXO) clocks are fairly common nowadays. I have a few now. I haven't kept track of their drift.

                                        And of course the WWVB clocks... I have one that drifts really badly when it can't pick up WWVB.

                                        On another note, don't forget about all those analog clocks that are "quartz crystal" ... these too are of course use crystals. Don't need to wind them, but are they more accurate than mechanical detent clocks?
                                        Last edited by eccerr0r; 10-27-2019, 06:30 PM.

                                        Comment

                                        Working...
                                        X