Badcaps.net Forum
Go Back   Badcaps Forums > Troubleshooting Hardware & Devices and Electronics Theory > General Electronics Technical Discussion
Register FAQ Calendar Search Today's Posts Mark Forums Read

 
Thread Tools Display Modes
Old 10-26-2019, 10:00 AM   #1
Dannyx
CertifiedAxhole
 
Dannyx's Avatar
 
Join Date: Aug 2016
City & State: Constanta
My Country: Romania
Line Voltage: 230VAC 50Hz
I'm a: Hardcore Geek
Posts: 2,642
Talking 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...
Dannyx is offline   Reply With Quote
Old 10-26-2019, 11:24 AM   #2
R_J
Badcaps Veteran
 
Join Date: Jun 2012
City & State: ☻
My Country: Canada
I'm a: Professional Tech
Posts: 4,875
Default 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 at 11:27 AM..
R_J is offline   Reply With Quote
Old 10-26-2019, 11:45 AM   #3
Dannyx
CertifiedAxhole
 
Dannyx's Avatar
 
Join Date: Aug 2016
City & State: Constanta
My Country: Romania
Line Voltage: 230VAC 50Hz
I'm a: Hardcore Geek
Posts: 2,642
Default 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.
Dannyx is offline   Reply With Quote
Old 10-26-2019, 12:33 PM   #4
eccerr0r
Solder Sloth
 
eccerr0r's Avatar
 
Join Date: Nov 2012
City & State: CO
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hobbyist Tech
Posts: 4,422
Default 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.
eccerr0r is online now   Reply With Quote
Old 10-26-2019, 02:43 PM   #5
redwire
Badcaps Veteran
 
Join Date: Dec 2010
City & State: Alberta
My Country: Canada
Posts: 1,517
Default 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 25C but at 20C or 30C it goes a many seconds/week off. It's very hard to correct for temperature.
redwire is offline   Reply With Quote
Old 10-26-2019, 02:52 PM   #6
eccerr0r
Solder Sloth
 
eccerr0r's Avatar
 
Join Date: Nov 2012
City & State: CO
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hobbyist Tech
Posts: 4,422
Default Re: Improving a slow/fast digital clock

TCXO oven
eccerr0r is online now   Reply With Quote
Old 10-26-2019, 04:11 PM   #7
redwire
Badcaps Veteran
 
Join Date: Dec 2010
City & State: Alberta
My Country: Canada
Posts: 1,517
Default 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 Images
File Type: png xtal_+drift.PNG (84.1 KB, 5 views)

Last edited by redwire; 10-26-2019 at 04:13 PM..
redwire is offline   Reply With Quote
Old 10-26-2019, 04:24 PM   #8
Curious.George
Badcaps Veteran
 
Join Date: Nov 2011
Posts: 1,595
Default Re: Improving a slow/fast digital clock

Quote:
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
File Type: pdf 2895.pdf (2.85 MB, 3 views)
Curious.George is offline   Reply With Quote
Old 10-26-2019, 04:37 PM   #9
redwire
Badcaps Veteran
 
Join Date: Dec 2010
City & State: Alberta
My Country: Canada
Posts: 1,517
Default 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.
redwire is offline   Reply With Quote
Old 10-26-2019, 04:58 PM   #10
stj
Great Sage 齊天大聖
 
stj's Avatar
 
Join Date: Dec 2009
City & State: Europe
My Country: some shithole run by Israeli agents
I'm a: Professional Tech
Posts: 21,570
Default Re: Improving a slow/fast digital clock

i bet it's not using mains.
post photo's
stj is offline   Reply With Quote
Old 10-26-2019, 05:22 PM   #11
Curious.George
Badcaps Veteran
 
Join Date: Nov 2011
Posts: 1,595
Default Re: Improving a slow/fast digital clock

Quote:
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)
Curious.George is offline   Reply With Quote
Old 10-26-2019, 05:25 PM   #12
petehall347
Badcaps Veteran
 
Join Date: Jan 2015
City & State: worcester
My Country: United Kingdom
I'm a: Knowledge Seeker
Posts: 1,927
Default Re: Improving a slow/fast digital clock

does the timer involve mechanical parts ?
petehall347 is offline   Reply With Quote
Old 10-27-2019, 04:40 AM   #13
Dannyx
CertifiedAxhole
 
Dannyx's Avatar
 
Join Date: Aug 2016
City & State: Constanta
My Country: Romania
Line Voltage: 230VAC 50Hz
I'm a: Hardcore Geek
Posts: 2,642
Default Re: Improving a slow/fast digital clock

Quote:
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 Images
File Type: jpg 20191027_112815.jpg (407.2 KB, 8 views)
File Type: jpg 20191027_112829.jpg (444.9 KB, 12 views)
File Type: jpg 20191027_112930.jpg (571.9 KB, 12 views)
Dannyx is offline   Reply With Quote
Old 10-27-2019, 12:05 PM   #14
eccerr0r
Solder Sloth
 
eccerr0r's Avatar
 
Join Date: Nov 2012
City & State: CO
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hobbyist Tech
Posts: 4,422
Default 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?)
eccerr0r is online now   Reply With Quote
Old 10-27-2019, 12:13 PM   #15
Dannyx
CertifiedAxhole
 
Dannyx's Avatar
 
Join Date: Aug 2016
City & State: Constanta
My Country: Romania
Line Voltage: 230VAC 50Hz
I'm a: Hardcore Geek
Posts: 2,642
Default Re: Improving a slow/fast digital clock

Quote:
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.
Dannyx is offline   Reply With Quote
Old 10-27-2019, 12:26 PM   #16
eccerr0r
Solder Sloth
 
eccerr0r's Avatar
 
Join Date: Nov 2012
City & State: CO
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hobbyist Tech
Posts: 4,422
Default 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...
eccerr0r is online now   Reply With Quote
Old 10-27-2019, 02:09 PM   #17
redwire
Badcaps Veteran
 
Join Date: Dec 2010
City & State: Alberta
My Country: Canada
Posts: 1,517
Default 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.
redwire is offline   Reply With Quote
Old 10-27-2019, 03:50 PM   #18
eccerr0r
Solder Sloth
 
eccerr0r's Avatar
 
Join Date: Nov 2012
City & State: CO
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hobbyist Tech
Posts: 4,422
Default 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...
eccerr0r is online now   Reply With Quote
Old 10-27-2019, 03:58 PM   #19
Dannyx
CertifiedAxhole
 
Dannyx's Avatar
 
Join Date: Aug 2016
City & State: Constanta
My Country: Romania
Line Voltage: 230VAC 50Hz
I'm a: Hardcore Geek
Posts: 2,642
Default Re: Improving a slow/fast digital clock

Quote:
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
Dannyx is offline   Reply With Quote
Old 10-27-2019, 07:27 PM   #20
eccerr0r
Solder Sloth
 
eccerr0r's Avatar
 
Join Date: Nov 2012
City & State: CO
My Country: USA
Line Voltage: 120VAC 60Hz
I'm a: Hobbyist Tech
Posts: 4,422
Default 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 at 07:30 PM..
eccerr0r is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Badcaps.net Technical Forums 2003 - 2019
Powered by vBulletin ®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
All times are GMT -6. The time now is 08:18 PM.
Did you find this forum helpful?