Tool for calculating coprime gear trains

Feel free to talk about anything and everything in this board.
Post Reply
lepp
Old Timer
Posts: 1
Joined: Fri Aug 04, 2017 2:06 am

Tool for calculating coprime gear trains

Post by lepp »

I've been working on a small program to search for coprime gear pairs.  This forum seems to be an ideal place to share.

The script is written in Python (version 2.7), and is available on GitHub: https://github.com/mjlepper/coprime-clock

The principal of operation is to systematically search through all coprime pairs within user-specified ranges to find combinations that will result in an exact overall gear ratio.

For example (from the README):

Code: Select all

$ ./coprime.py --ratio 12 --stages 2 --mn_max 200 --n_min 13 -d
# r_target=3.464102
# m=12: [2, 2, 3]
# n=1: [1]
# testing 4711 out of 6115 coprimes
# ./coprime.py --ratio 12 --stages 2 --mn_max 200 --n_min 13 -d
r_dev, m_dev, m1, n1, m2, n2
# Testing 11094405 combinations
1.000740, 9, 52, 15, 45, 13
1.001342, 22, 111, 32, 128, 37
1.004087, 14, 80, 23, 69, 20
1.004589, 17, 87, 25, 100, 29
...
I've only included the first four results here.  The first two numbers r_dev and m_dev are the greatest geometric error from the ideal ratio of sqrt(12), and the difference between max(mx+nx) and min(mx+nx) for all (m,n) pairs, which roughly represents the difference between the largest and smallest module required if the distance between shafts is constant.  The remaining numbers are the wheel and pinion tooth counts for each gear pair.

Looking at the first result:  The wheels are 52 and 45 teeth, and the pinons are 15 and 13 teeth.  52 is coprime with 15, and 45 is coprime with 13.  The overall ratio is 52 x 45 / (15 x 13) = 12.  The ideal reduction ratio of a 12:1 reduction in two stages is sqrt(12), or 3.464..., 52/15 = 3.4666..., and 45/13 = 3.4615..., so this is a very compact geartrain.

The user can look through all the results provided to find a set that best suits the application.  One set I found for a clock with seconds, minutes, and hours hands:

Code: Select all

60:1 Seconds:Minutes reduction:
130:23, 138:13

12:1 Minutes:Hours reduction:
112:41, 123:28
The sum of the tooth counts for all these gear pairs is either 153 or 151, so it might be practical to construct these using conventional cutters of a single module. &nbsp;Note that these don't create a particularly compact gear train. &nbsp;I'm still trying to calculate how long it would take this clock to return to its original configuration (where all the internal gears are in the same alignment); with moderate confidence, [s]I believe it's a little under 470 years[/s]. <edit>subsequent analysis has shown this period is no more than 182 days - I'm still trying to work out the math</edit>

The program can search for gear trains with more stages, but the nature of combinatorial searching will result in impractically large runtimes to search through all the possibilities. &nbsp;In these cases, it's best to consider the results returned within the first 10 minutes or so.

This can also be used as a tool to assist searching for gear trains for large astronomic or calendar ratios. &nbsp;For example, a 400-year Gregorian calendar has a period of 146097 days. &nbsp;Using coprime.py:

Code: Select all

$ ./coprime.py --ratio 146097 --stages 4 --mn_max 2000 --n_min 13 -d
# r_target=19.550611
# m=146097: [3, 3, 3, 7, 773]
# n=1: [1]
We could wait for results, but since there's a large prime factor involved, we can speed things up by calculating that a 773 tooth wheel paired with either a 39 or 40 tooth pinion should be used for one of the stages. &nbsp;Multiplying the ratio by either 39/773 or 40/773, and reducing the number of stages to 3 eliminates a lot of the searching:

Code: Select all

$ ./coprime.py --ratio 7560 --stages 3 --mn_max 400 --n_min 13 -d
# r_target=19.626398
# m=7560: [2, 2, 2, 3, 3, 3, 5, 7]
# n=1: [1]
# testing 21443 out of 24338 coprimes
# ./coprime.py --ratio 7560 --stages 3 --mn_max 400 --n_min 13 -d
r_dev, m_dev, m1, n1, m2, n2, m3, n3
# Testing 1643026710241 combinations
1.013041, 90, 255, 13, 252, 13, 338, 17
1.025030, 115, 255, 13, 364, 19, 342, 17
...
Very quickly finding the gear sets: (773,40) (255,13) (252,13) (338,17) to implement a 400-year Gregorian calendar.

Searching for "coprime horology" I found a couple of threads on the NAWCC forum where the subject has come up, but there didn't seem to be much interest. &nbsp;Since modern software like Gearotic and tools like 3-D printing, laser cutting, and 4-th axis machining make it easier to make gears of arbitrary module, we can consider new possibilities.

--
Matthew
Last edited by lepp on Sat Aug 05, 2017 2:56 pm, edited 1 time in total.
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4597
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Tool for calculating coprime gear trains

Post by ArtF »

Mathew:

&nbsp; Thank you, this IS an interesting topic. To be honest I hadnt considered coprimes when
I made the original gear train calculator, which is sped up by creating ratio lookup tables
on first run.&nbsp; Im not sure if that would help here or not.. but Ill tag it for future study when
I have available time.

Thx
Art
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests