Maker Pro
Maker Pro

Clock Question

G

Garrett Mace

Jan 1, 1970
0
Jim Thompson said:
Anyone have an idea how one might output their PC clock information
though the serial (or USB) port?

My PC clock is NIST-synchronized and it would be nice to have a wall
clock with that accuracy.


Get any quartz wall clock. You know, the ones that can be anything on the
outside, but all have the same square movement inside.

Now:

Choose a time in hours and minutes. The time cannot be 12:00 for reasons
obvious later.

Now drill six small holes in the face of the clock, two pairs positioned
where the hour and minute hands will be located at your chosen time. The
third pair is positioned at the 12:00 or zero position, where the second
hand will pass above it. Insert an infrared LED and a photo transistor in
each pair of holes.

Next step is to glue a small pulley, rubber band, and motor to the adjusting
wheel on the back of the the clock movement.

Also, remove the battery and provide a controllable 1.5V source for the
clock.

Wire the motor, power leads, and phototransistors to a microcontroller and
serial port.

The software: Two minutes before synchronization time, begin watching for
the second hand to come around to the zero position. As soon as it does,
remove power from the clock. Then engage the motor and slowly advance the
clock until the hour and minute hands are reported to be in position. Wait
until the very instant that the computer time reaches the synchronization
time, and then re-engage the clock power.

You now have a NIST-synchronized wall clock.
 
A

Active8

Jan 1, 1970
0
Jim,

It's easy to write a program that, receiving a message via the serial port,
gets the system time and sends it back. So you need to get (build) a clock
that is relatively accurate on its own and sends a message every now and
then, receives the system time of the computer and synchronises itself
accordingly. The message can be a byte (a special one like a question mark
or a random one) or even a pulse pulling a modem control line of the serial
port. I'd use a micro containing a UART (PIC or any brand you like) and
clock it with a clock x-tal from an old watch or something like that.

Citizen watch crystals are readily available for this. You use a
16-bit PIC timer to get a 1 sec interrupt.
 
A

Active8

Jan 1, 1970
0
I'm sure I could write you a program to do something like that pretty
quickly. The question is, what clock is going to read data from a serial
port?

I'm sure Jim can design a clock.
An even more important question is, isn't it going to drive you nuts
knowing that any clock you drive from the serial port is going to be
milliseconds (yes, milliseconds, and probably many of them!) off target?

If you know the latency and write the program so that it changes
the process priority to "real time", gets the time and sends the
data, and then returns to normal prioity, the clock PIC could
adjust for that. You'd also have to write the app to check the
processor speed, OS and anything that might change that latency,
calculate it in the app, and send that data to the PIC.
Just think about it. You'll end up sitting in your rocking chair, staring
at the clock, thinking, "Damn, that last tick should have happened
earlier... damn, that one too... damn, that one too... damn, that one
too..."

In the morning, your wife will find that you've spontaneously combusted,
and all that's left is your slippers, part of your robe, and what many
people will come to believe was simply an urban legend all along.

Damn. You've got him all but dribbling spit out the side of his
mouth.
"Jim Thompson? Hell, son, he's like Bob Widlar. He never really existed,
it's just a bunch of stories that got handed down through generations of
engineers."

Is that what you really want, Jim? Even your kids would begin to believe
the legend after a while. One day, your daughter would recount the story of
how you died: "Well, dad had bought this JATO rocket at the swap meet, and
he welded it to his old Impala one day... You can still see the hole in the
side of South Mountain where he augered in."

Trust me. What you want is a Westclox Big Ben. They're simple. They're
cheap. They're probably not made any more. But I'm sure you can find one on
Ebay. They need to be reset every week. But who cares? You'll never look at
one of them and say, "Damn, that last tick should have happened earlier..."

-- Mike --
But that confounded alarm might be the end of him.
 
A

Active8

Jan 1, 1970
0
Anyone have an idea how one might output their PC clock information
though the serial (or USB) port?

My PC clock is NIST-synchronized and it would be nice to have a wall
clock with that accuracy.

date > /dev/ttyS0[/QUOTE]

In Analog language this means what ???

...Jim Thompson
[/QUOTE]
Apart from those UNIX LINUX replies, it also is the DOS syntax to
redirect the output, but you'd want the time command, and the
device would be lpt1 for parallel port or *maybe* com1 for serial.
I just tried

time > c:\o1t.txt and got

The current time is: 1:15:26.35
Enter the new time:

in a text file.

you have to either send ctrl-c or hit return to exit without
entering a new time.

time > com1 gave me the blank stare also, so I hit return and got
the command prompt back. I can only assume the ascii time string
went to my serial port, but I have no way to check it right now.

You can use the winders api function ShellExec or whatever (i
always have to look it up) to execute these command lines. A batch
file would do it also. You could run the batch file from your task
scheduler.
 
A

Active8

Jan 1, 1970
0
You could write a VB script to poll the Datepart: Time(), or Now(). Send it
to the serial port though MSComm, as a byte or a sync pulse.
Yeah, but it would be a VBA. VB script runs in ASP. A VBA could be
run as a service under NT and later. Alternately, you could put it
in the Start Up Programs "folder" or task schedule it.

MSComm is the control to use in VBA as you said.

BTW. VB sucks. C++ rules. MSComm can be accessed from a winders app
in C++.
 
S

Stephen J. Rush

Jan 1, 1970
0
Trust me. What you want is a Westclox Big Ben. They're simple. They're
cheap. They're probably not made any more. But I'm sure you can find one on
Ebay. They need to be reset every week. But who cares? You'll never look at
one of them and say, "Damn, that last tick should have happened earlier..."

You left out the major advantage of the Big Ben alarm clock: It will
still wake you up during a power failure, without the expense of a
UPS.
 
R

Richard Crowley

Jan 1, 1970
0
"Stephen J. Rush" wrote ...
You left out the major advantage of the Big Ben alarm clock: It will
still wake you up during a power failure, without the expense of a
UPS.

Wow! How do those things keep time with NO power? :)

(OTOH, more of what we consider "electronic" devices are being
run by essentially clock-spring (or manual crank) "power".
 
S

Stephen J. Rush

Jan 1, 1970
0
"Stephen J. Rush" wrote ...

Wow! How do those things keep time with NO power? :)

(OTOH, more of what we consider "electronic" devices are being
run by essentially clock-spring (or manual crank) "power".

Why the quotes? Power is energy / time, whether electrical,
mechanical or neutrino flux.
 
T

Tom Gross

Jan 1, 1970
0
Jim Thompson said:
Anyone have an idea how one might output their PC clock information
though the serial (or USB) port?

My PC clock is NIST-synchronized and it would be nice to have a wall
clock with that accuracy.

I found this thread because I am relying on a network of XP machines
to be synchronized to the second for an application I am building.
Much to my surprise, the two XP machines at my desk get out of sync
very quickly. Within a couple of hours of synching to
time.windows.com one machine is about 45 faster than the other.

So, even if you find out how to drive a clock from a PC, I wouldn't
expect it to necessarily be particularly accurate. You could in
anycase merely dedicate a computer to displaying the "correct" time
anyway.

I have a CASIO Waveceptor Watch that attempts to get synched up with
WWV in Fort Collins every night. That might be your cheapest
solution.
 
J

Jim Thompson

Jan 1, 1970
0
I found this thread because I am relying on a network of XP machines
to be synchronized to the second for an application I am building.
Much to my surprise, the two XP machines at my desk get out of sync
very quickly. Within a couple of hours of synching to
time.windows.com one machine is about 45 faster than the other.

So, even if you find out how to drive a clock from a PC, I wouldn't
expect it to necessarily be particularly accurate. You could in
anycase merely dedicate a computer to displaying the "correct" time
anyway.

I have a CASIO Waveceptor Watch that attempts to get synched up with
WWV in Fort Collins every night. That might be your cheapest
solution.

I use Socketwatch, setup for synchronization once an hour (always
connected cable high-speed Internet). It is rare when I am off by
more than 25ms.

...Jim Thompson
 
S

Sir Charles W. Shults III

Jan 1, 1970
0
Download any of the free NIST utilities and set it to run every 5
minutes or so.

Cheers!

Chip Shults
 
C

Chris Hodges

Jan 1, 1970
0
Active8 said:
Apart from those UNIX LINUX replies, it also is the DOS syntax to
redirect the output, but you'd want the time command, and the
device would be lpt1 for parallel port or *maybe* com1 for serial.
I just tried

time > c:\o1t.txt and got

The current time is: 1:15:26.35
Enter the new time:

in a text file.

you have to either send ctrl-c or hit return to exit without
entering a new time.

time > com1 gave me the blank stare also, so I hit return and got
the command prompt back. I can only assume the ascii time string
went to my serial port, but I have no way to check it right now.

if you create a text file containing just a carriage return (test.txt in
my example) then at the dos prompt:
time < test.txt > test2.txt
puts:
Current time is 7:23:20.08p
Enter new time:
into test2.txt, so time < test.txt >com1 should output the time as ascii
to the serial port.

If I have time later I might test with 2 pcs, a cable and hyperterminal.
 
P

petrus bitbyter

Jan 1, 1970
0
Chris Hodges said:
if you create a text file containing just a carriage return (test.txt in
my example) then at the dos prompt:
time < test.txt > test2.txt
puts:
Current time is 7:23:20.08p
Enter new time:
into test2.txt, so time < test.txt >com1 should output the time as ascii
to the serial port.

If I have time later I might test with 2 pcs, a cable and hyperterminal.

Chris,

Writing the time to the serial port is not the problem. You need some kind
of scheduling unless you want to synchronise your clock manualy every time.
Running Linux it's easy. Can be done by a three or four line script starting
a background process. Windows has its own scheduler(s) although I can't
imagine a simple script to run it a the moment. As DOS lacks multi tasking,
writing a scheduler is not that easy. It nervertheless can be done if you
make it a device driver or another resident program. Unless you're running
Linux it's much easier to do the scheduling by the clock itself. Make it
send a kind of a signal to the computer using the serial port. This signal
activates an interrupt routine that replies by sending the system time.

petrus
 
R

Russell Shaw

Jan 1, 1970
0
petrus said:
....

Chris,

Writing the time to the serial port is not the problem. You need some kind
of scheduling unless you want to synchronise your clock manualy every time.
Running Linux it's easy. Can be done by a three or four line script starting
a background process. Windows has its own scheduler(s) although I can't
imagine a simple script to run it a the moment. As DOS lacks multi tasking,
writing a scheduler is not that easy. It nervertheless can be done if you
make it a device driver or another resident program. Unless you're running
Linux it's much easier to do the scheduling by the clock itself. Make it
send a kind of a signal to the computer using the serial port. This signal
activates an interrupt routine that replies by sending the system time.

Make a cron job that outputs the time 12.00pm (midnight) every sunday:

crontab -e

* * * * 0 date > /dev/ttyS0

"date" can put out many formats, so you can suit it to
the format parser in the clock.
 
Q

qrk

Jan 1, 1970
0
Anyone have an idea how one might output their PC clock information
though the serial (or USB) port?

My PC clock is NIST-synchronized and it would be nice to have a wall
clock with that accuracy.

...Jim Thompson

Get a WWVB clock. Radio Shack, among many, sell them. You can get them
for $25 to $80 depending on options. The WWVB clock probably has
better accuracy than SNTP, especially if your using XP (XP has big
problems with SNTP).
http://www.boulder.nist.gov/timefreq/stations/radioclocks.htm

If you really want to get silly, you can find these GPS synchronized
HP boxes (e.g. model Z3801)on Ebay. They provide an accurate 10 MHz
reference (less than a ppb) and very accurate time. Require a few days
to settle in.
http://www.realhamradio.com/GPS_Frequency_Standard.htm

Mark
 
R

Richard Crowley

Jan 1, 1970
0
I found this thread because I am relying on a network of XP machines
to be synchronized to the second for an application I am building.
Much to my surprise, the two XP machines at my desk get out of sync
very quickly. Within a couple of hours of synching to
time.windows.com one machine is about 45 faster than the other.

Use NTP to sync them together. Free, simple, built into the OS.
So, even if you find out how to drive a clock from a PC, I wouldn't
expect it to necessarily be particularly accurate. You could in
anycase merely dedicate a computer to displaying the "correct" time
anyway.

Set up one of the machines as the NTP master. Use one of the
several available utilities to sync it to WWV via RF, dialup,
or internet. Still free (assuming internet connectivity.)
 
A

Active8

Jan 1, 1970
0
Apart from those UNIX LINUX replies, it also is the DOS syntax to
redirect the output, but you'd want the time command, and the
device would be lpt1 for parallel port or *maybe* com1 for serial.
I just tried

time > c:\o1t.txt and got

The current time is: 1:15:26.35
Enter the new time:

in a text file.

you have to either send ctrl-c or hit return to exit without
entering a new time.

time > com1 gave me the blank stare also, so I hit return and got
the command prompt back. I can only assume the ascii time string
went to my serial port, but I have no way to check it right now.

if you create a text file containing just a carriage return (test.txt in
my example) then at the dos prompt:
time < test.txt > test2.txt
puts:
Current time is 7:23:20.08p
Enter new time:
into test2.txt, so time < test.txt >com1 should output the time as ascii
to the serial port.

If I have time later I might test with 2 pcs, a cable and hyperterminal.
[/QUOTE]
Good idea. I strongly think it will work.
 
Top