WatchUSeek Watch Forums banner

Open source timing software.

280229 Views 604 Replies 139 Participants Last post by  tpiepho

Hi guys,

I have a more or less usable version of my timing program that is ready
for initial testing, if anyone is interested.

First the goodies. Here are Windows binaries
http://ciovil.li/tg.zip
and here is the full source code
https://github.com/vacaboja/tg

Now some info on the program. This program is released under the GNU GPL
license, version 2 -- basically you can do what you want with it, free of
charge, no warranty, if you redistribute a (modified) version, you must
distribute also the source code. If you want to build from source, you
need gtk+ (I'm using v. 2.24), portaudio2, and fftw3, plus a C99 compiler
clearly. If you want to run the Windows version, just download the zip
archive, unzip, double click.

This program tries to pick up audio from the default audio input of your
computer, which should be the same that Audacity defaults to, so you can
test the audio setup with Audacity. It does not fiddle with the volume:
just check that it is set to a reasonable level. Of course the rate that
you get from this program, for any watch, is affected by the rate of the
clock of your sound card: the same holds for all timing programs and there
is no escape (except calibrating the card against a reliable time source).

The algorithm I decided to use is quite hungry of computing power, so I
made two versions: "tg" is the full version, "tg-lt" is a lighter version.
The light version sacrifices some accuracy and noise resilience for speed.

My intended audience is amateurs and tinkerers. This program has not been
written for professionals, neither do I want to compete with
professionally built hardware or software, nor with those that can write
better software on their own. In particular I have set to myself the
following three goals.

One. Try a less conventional algorithm to deal with bad audio, at the
expense of lots of number crunching (all other programs for which I did
find information online use possibly some band pass filter and a threshold
trigger, we do it differently). I can currently obtain satisfactory
results from the internal mic of my ThinkPad and a few other lower quality
mics. I don't know how it will perform with a good piezo, but I am
interested (probably, for clean audio, mine is not the best approach).
Your mileage may vary.

Two. To avoid complaints like this one
Review: TickoPrint Android App | Watch Guy
the entire operation of the algorithm is designed to be double-checkable.
In particular, the waveforms that the program associates to the tics and
tocs of the watch are shown in real time, so one can check that they are
properly recognized and properly aligned. The slope representing the
currently detected instantaneous rate is drawn (the blue lines) on the
timing-machine-like graph, etc. See also the discussion here for some
example of such double checking
https://www.watchuseek.com/f6/definition-beat-error-2394130.html

Three. Make it open source, so other people can tinker with the source
code (well, this one was the easy part).

Usage should be quite intuitive for those that know how an escapement
works. See also the thread referenced above for more info.

That's all for now. Any feedback is appreciated.
See less See more
  • Like
Reactions: 5
321 - 340 of 605 Posts
About calibration: Would it be possible to use the internet SNTP Client?
Hi!

Unfortunately not. There are several sources of timing inside a personal computer, for instance the real time clock, the clock of the audio card, the internet (via time servers). Trouble is that computers are not very good at synchronizing between them, even more if you want to do it in a cross-platform way.
We may try. Can you send me some recordings of your stopwatches? (I will be on vacations until September, but then I will have time to look into it...)
OK! I can do that. I will also be away a lot this month (and early next month), so may have to wait until September, anyhow. I have two different 360000bph stopwatches, so I guess I'll record both. One of them is one revolution per second for the main sweep hand, while the other is once per 3 seconds.
contrate_wheel,

I just wanted to thank you (and all the other contributors) for your work, I've messed with regulating my 7S26 movements in the past by measuring the time difference after a day or two, but this piece of software works great. I am using a cheap microsoft USB webcam with built in microphone (had it laying around), and it works great. I haven't tried calibrating yet as I don't have any working Quartz analog watches (all the batteries have died and I haven't bothered replacing them!).

Thanks again,
Ed
  • Like
Reactions: 1
A quick question from a newcomer yet to evaluate the tg program.
How long does it take to calibrate tg?
What does the calibration length depend on?

I plan to calibrate tg by the RWM station (at 4996 kHz which I receive clear and loud) 1 Hz pulses - fed directly from my SW receiver to my laptop by an audio cable (no speakers and microphones involved).
The only thing: RWM sends 1 Hz pulses for 9 minutes and 55 seconds, and I read (here, in the Forum) that tg may take as long as ~15 minutes to calibrate, so the signal may end up earlier (than those 15 minutes).

Please comment.
Thank you in advance.

Warm regards,
Tony
See less See more
mr. tony:

i used guidance from this post (as recommended by Tg's author):

https://www.watchuseek.com/f6/open-source-timing-software-2542874-17.html#post29970370

i calibrate tg (for different USB dongle audio inputs) using an older quartz watch, and the process takes only a few minutes (on a Macbook Air or a Raspberry Pi 3B)

regards,

willie
on the cooling Gulf of Mexico
See less See more
linux.author, thanks for the help.
It turned out that the RWM's signal contains some extra pulses, which are easily recognised to be ignore by a human but affect the calibration process.
I'll experiment with a 1PPS output of a GPS receiver.

As a side question:
  • if I see the positive s/d value (+) this meant the watch gains time (i.e. is fast), it the s/d value is negative (-) this means the watch is slow. Right?
linux.author, thanks for the help.
It turned out that the RWM's signal contains some extra pulses, which are easily recognised to be ignore by a human but affect the calibration process.
I'll experiment with a 1PPS output of a GPS receiver.

As a side question:
  • if I see the positive s/d value (+) this meant the watch gains time (i.e. is fast), it the s/d value is negative (-) this means the watch is slow. Right?
linux.author, thanks for the help.
It turned out that the RWM's signal contains some extra pulses, which are easily recognised to be ignored by a human but affect the calibration process.
I'll experiment with a 1PPS output of a GPS receiver.

As a side question:
  • if I see the positive s/d value (+) this means the watch gains time (i.e. is fast), it the s/d value is negative (-) this means the watch is slow. Right?
I tried the software and I like it, since I do not have a timegrapher - still a beginner in this field. I managed to calibrate the software, and to test accuracy of the watch I wear right now. However, I do have problems with the microphone. I think it is very weak, since it is sometimes very hard to pick up the watch beat.

What kind of microphone do you recommend? Should I always open the watch and put the microphone as close as possible to the movement? Should I put some kind of bowl above the microphone and watch, to keep it isolated from the surrounding noise?
I'll experiment with a 1PPS output of a GPS receiver.
In my experiments, the PPS signal was too hot for the mic (and possibly line) input. I rigged up a resistive voltage divider to knock the level down. I tried a few values before I found a combo that works, and I forget what values I used in the end, but 80K/4k ohm is a good place to start. I'm not even gonna try ascii art, but connect the 80k & 4k in series, then connect the PPS signal across both resistors, and the input to you soundcard across the 4k resistor. If you're not comfortable soldering, this would be easy to do on one of those friction-fit breadboards (like https://www.adafruit.com/product/65 , but they come in many other sizes), with some wire jumpers.

Or, if you can find some way to get an audible click out of the GPS for the PPS signal, just hold the mic up to it :)
  • Like
Reactions: 1
Sorry for my slow responses...

@jisham Fabulous, thanks a lot for sharing this!

@booBot To shorten the calibration period, which makes sense if you have a very clean signal to calibrate with, assuming that you can compile tg form the source code, it suffices to change this line in the file src/tg.h
Code:
#define CAL_DATA_SIZE 900
The number 900 represents roughly the number of seconds of signal needed for the calibration, so with 900 it will take about 15 minutes. If you need it and you are unable to do the compilation, just drop me a PM and I will see what I can do for you...

edit: @blackarrow Ambient noise should not be a major issue, as long as you are in a relatively quiet environment. If you can, I would suggest to keep the watch in contact with the microphone, and otherwise as close as possible. Always keep in mind that mechanical watches are sensitive to magnetism, this is not a problem with piezo or capsule (electret) microphones, but magnets are used to keep the lid of certain laptops closed, so, if you are using a laptop, check first (just see if it attracts a paper clip or a needle).
See less See more
@blackarrow Ambient noise should not be a major issue, as long as you are in a relatively quiet environment. If you can, I would suggest to keep the watch in contact with the microphone, and otherwise as close as possible. Always keep in mind that mechanical watches are sensitive to magnetism, this is not a problem with piezo or capsule (electret) microphones, but magnets are used to keep the lid of certain laptops closed, so, if you are using a laptop, check first (just see if it attracts a paper clip or a needle).
Well, I do have some older pair of earphones which has integrated microphone in it. This way I could place the microphone with the watch at least 30 cm away from my laptop (if there are some magnets there). I am waiting for my demagnetizer to arrive, so I will demagnetize all of the watches and try again.
contrate_wheel, thank you for the excellent program! And for the help offer - I'll try to stay away from any acoustic channels during the calibration process, the all-electric 1PPS connection is (relatively) easy for me. It was just a haste/laziness when I tried the RWM timing reference signal. That was plain wrong way.
With the 1PPS I will not be time-restricted, so let the tg take as long to calibrate as it needs to do it properly.
Thanks again!
contrate_wheel, thank you for the excellent program! And for the help offer - I'll try to stay away from any acoustic channels during the calibration process, the all-electric 1PPS connection is (relatively) easy for me. It was just a haste/laziness when I tried the RWM timing reference signal. That was plain wrong way.
With the 1PPS I will not be time-restricted, so let the tg take as long to calibrate as it needs to do it properly.
Thanks again!
Well, I do have some older pair of earphones which has integrated microphone in it. This way I could place the microphone with the watch at least 30 cm away from my laptop (if there are some magnets there). I am waiting for my demagnetizer to arrive, so I will demagnetize all of the watches and try again.
If you have a smartphone with a magnetometer (pretty common this days) or a small compass, you can easily check if any of the watches got magnetized. For those that happen to be running Android, I recommend the Gauss Meter app. Either of these are also a good way to check if there are any potentially disturbing magnetic fields in your environment beforehand.
contrate_wheel

Thank you so much for two years of timegrapher


HAPPY 2nd ANNIVERSARY
  • Like
Reactions: 2
So I managed to lose my Korg piezo mic in a move, but wanted to report that it started to work decently well when I shaved away some of the rubber/plastic insulation material. Nevertheless, I've gone ahead and ordered the Cherub mic from Amazon and will report back this weekend after it arrives.
Hi, yes, I would like to converse further about preamp and piezo.
I think contrate_wheel would have something interesting to tell us about frequency range needed for TG.
We all know that piezo has high impedance, so preamp should be adjusted according to that.
Indeed. Apologies for being out of pocket for so long. I'm going to try the preamp/filter circuit with a number of types of watches and report back.

The circuit implements a band pass with gain. It looks like I'll want to experiment with the cutoff frequencies a little, maybe.

But so far it's worked pretty well with two (very loud) pocket watches, thanks to your fantastic algorithm. The amount of noise reduction is impressive (since my circuit isn't reducing noise quite enough for watch-o-scope to handle well)

End goal is a circuit board (either DIY or SMT, depending on if there's interest for one or the other), that fits inside a common enclosure.

In next days I will try to get some guitar pickup with EQ and give it a try with TG.
Sorry if I missed the updated, but did you have a chance to try this?
I'm new to this and I'm looking for a timegrapher relatively cheap, even compared to some of them from China for $120-150.
What microphone and amplifier would you recommend?

Thanks a lot!
Hi everyone,
And thank you @Contrate_wheel for this software. I've been using it from day 1, and it has been evolving very well since then !

A QUESTION: My old laptop broke and I had to replace it. Now I don't have two separate jack inputs for mic and earphones but only one, which
doesn't fit my mono mic :( I bought a couple of cheap USB audiocards on eBay but I cannot get the mic to work with them. Any experience with
this issue ?!?! THANKS !
321 - 340 of 605 Posts
Top