Shop OBEX P1 Docs P2 Docs Learn Events
Puzzle: Gears and Gray codes — Parallax Forums

Puzzle: Gears and Gray codes

Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
edited 2011-07-27 09:09 in General Discussion
Here's a mathematical puzzle which, without giving much thought to it, I'm not sure has a solution. My mountain bike has 21 nominal speeds. The front cluster has three sprockets with the following gear numbers and tooth counts:
1: 22, 2: 32, 3: 42

The rear gear numbers and tooth counts are:
1: 28, 2: 24, 3: 21, 4: 18, 5: 15, 6: 13, 7:11

This results in the following gear ratios and the gear numbers (front:rear) that create them, in order from low to high:
0.786 1:1
0.917 1:2
1.048 1:3
1.143 2:1
1.222 1:4
1.333 2:2
1.467 1:5
1.500 3:1 Not allowed
1.524 2:3
1.692 1:6
1.750 3:2
1.778 2:4
2.000 3:3
2.133 2:5
2.333 3:4
2.462 2:6
2.800 3:5
2.909 2:7
3.231 3:6
3.818 3:7

As you can see, shifting from one ratio to the next can involve shifting more than one derailleur at at a time, sometimes over a very large range.

So here's the puzzle: Ignoring mechanical practicality, is it possible to come up with a selection of tooth counts that permit shifting incrementally through an entire range of gear ratios by shifting only one derailleur at a time? (This is where the Gray code reference in the title comes from.) If not (and I suspect not) can it be done by occasionally shifting both at once but only by a single step?

-Phil

Comments

  • Spiral_72Spiral_72 Posts: 791
    edited 2011-07-25 13:31
    I think the (or one of the) answers you are looking for would be to use 21 different sized sprockets rigid mounted to the rear wheel. The front sprocket would be the same DIA as the smallest rear sprocket, 1:1, and mounted on a greased spline and support bearing so that it may travel outward away from the bike.

    You gear change would pull a fork on the rear to push the chain and push the front sprocket outward as well.

    It'd work, but your pedals would move when you change gears! Har, Har :)


    It's interesting how you describe the mechanism. My old 21sp bike had two gear shift collars.... One was operated the front sprocket, 1...3 while the other operated the rear sprocket, 1....7. Maybe I'm reading your post wrong however.
  • ercoerco Posts: 20,259
    edited 2011-07-25 13:34
    NOW you're talking my language, PhiPi! Bike gears & efficiency are what mechanical engineers are all about. You pitch a good question and I can't answer it right away, but I'll give you something to ponder in return.

    I've been known to get on a bike for 30+ hours straight and not stop for 500+ miles over terrain that has some extreme uphills & down. Bike changes are allowed, so I have a special bike just for the 50+ mph downhill run into Death Valley at night. Have a look at my custom-CNC'ed 90-tooth chainring:

    http://www.the508.com/2003web/stories/s01.html

    I suspect that the answer to your question might involve bigger gears front and rear in order to avoid overlap. In the rear, the current state of the art bikes have an 11 cog smallest (or 9-tooth if you use the Shimano small-wheels Capreo groupo). Just shifting from 11 to 12 creates a big 9% jump in cadence, so for your solution you would have to make your smallest cluster gears larger to reduce that jump and result in usable gears. Then you would have to increase your chainring sizes to compensate. As such, your bike would weigh more just in pounds of gears, and you'd be at the point of diminishing returns.

    But then, you can get into the wacky world of internally-shifting hubs, which are up to 8 speeds or more by now... a whole other can of worms. But those have their own inefficiencies, which I will not get into here.

    For now.
  • mindrobotsmindrobots Posts: 6,506
    edited 2011-07-25 13:38
    :lol: I used to bicycle seriously, but not INSANELY so I'm asking this with tongue well in cheek! :smile:

    Could you please post a video of you changing bikes during a 30 hour straight, 500 mile non-stop ride? :innocent: That's like leaping from one moving bike to another rmoving bike! Tres Impressive!!!!
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-07-25 13:56
    Spiral_72 wrote:
    My old 21sp bike had two gear shift collars.... One was operated the front sprocket, 1...3 while the other operated the rear sprocket, 1....7. Maybe I'm reading your post wrong however.
    That's exactly the way mine works. The "collars" next to the hand grips operate the front and rear derailleurs.
    erco wrote:
    Have a look at my custom-CNC'ed 90-tooth chainring
    OMG! Can you even pedal that thing unless you're going downhill? At 50 mph on the downhill, do you ever experience steering jitter or other instabilities?
    _____________________________________________

    Reiterating the conditions of the puzzle, mechanical practicality is not a concern for now, just the numbers. Further constraints in light of Spiral_72's "solution", though: the front and rear clusters have to have at least three sprockets each and there have to be at least 21 speeds total, all distinct. Ideally, the ratios of adjacent speeds would be fairly constant, but it's not a requirement of the puzzle.

    -Phil
  • ercoerco Posts: 20,259
    edited 2011-07-25 14:12
    A rear cog having gears 13-14-15-16-17-18-19 and front chainrings of 22, 33, and 49 yields these ratio ranges with no overlap:

    22 chainring: 1.16-1.69
    33 chainring: 1.74-2.53
    49 chainring: 2.58-3.76

    Not terribly practical, usable, or user-friendly, but possible.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-07-25 14:19
    Interesting, erco, but it doesn't solve the puzzle. There's a big shifting transition from 1:7 to 2:1, and another from 2:7 to 3:1.

    I should add one more proviso for the sake of the puzzle: The sprocket sequence in each cluster does not necessarily have to progress in order from smallest to biggest.

    -Phil
  • schillschill Posts: 741
    edited 2011-07-25 14:24
    erco:

    I haven't been keeping up to date on such things, but are issues of the chain crossing too far (in/out) between gears still important or are they going away due to better design, materials, etc?

    I'm thinking along the lines of only using the front inner gear with the three inner gears in back (out of 7), the front middle with the rear middle three, and the front outer with the rear outer three to reduce wear on the chain and gears.

    This doesn't contribute to the puzzle much, but it does remind me that I really need to dust off my bikes.
  • ercoerco Posts: 20,259
    edited 2011-07-25 15:53
    @PhiPi: Ah-so. The plot thickens. Now I see what you're after. You never make things easy. Vexing, not easy.

    @schill: You are correct, sir. A straight chainline is very important to mechanical efficiency, perhaps even moreso with Campy's new 11-speed rear cluster (WOW!). I went by PhiPi's suggestion about "ignoring mechanical practicality". As I am wont to do...
  • LawsonLawson Posts: 870
    edited 2011-07-25 21:44
    You could try a variation on the solution my bike uses. 26:39:42 up front and a 9-speed 11,13,15,17,20,23,26,30,34 on the back. The 3 tooth jump from the 39 to the 42 is almost exactly half the spacing between gears on the rear cluster. This gives me 18-gears in a "half-step" pattern over the top 3.3x of the range. (Of which 4-5 are hardly used as I usually only bother to half step in the top half of the rear cluster) The 26 on the front then gives me 3 extra granny gears for when the hills get steep for a total range of 5x.

    You could go for the logical extension and run something like 38:40:42 up front, but you'd occasionally need to shift two gears at once up front. Unfortunately the rear cluster has enough variation in spacing that some gears are likely to overlap.

    Lawson
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2011-07-25 23:54
    Either you need bigger mashers, or a better spinning.

    ---Since you didn't specify perfect conditions---Shifting the ring gear up from 1 -> 2, or 2 -> 3 while going up hill is mechanically impractical, and an easy way to throw a chain.

    With a Watt meter, and a little DA, you could shift gears up or down based on your own personal Nm and Kw profile, and incline.




    Bill M.
  • TorTor Posts: 2,010
    edited 2011-07-26 02:49
    schill wrote: »
    erco:

    I haven't been keeping up to date on such things, but are issues of the chain crossing too far (in/out) between gears still important or are they going away due to better design, materials, etc?
    I'm not erco, but.. I used to be a competition cyclist. Nothing has changed w.r.t. materials since my time, as far as I know. I once destroyed the inner (13) back ring when I used it with the outer front chain ring (there are only two on competition road bikes) going uphill. Well, going uphill with a force.. it was steep too. Bad mistake. It was a particularly expensive, high-quality set of gears.

    The reason for having all these sprockets isn't to get AxBxC gears, it's really to have a selection of gears available for the inner front chain ring, a selection for the middle (or outer) front chain ring (and, for the 3-chainring types one for the outer ring). So, you select your combinations so that the chain is reasonably straight. Less strain, and more efficiency. Therefore you need the overlaps really.

    -Tor
  • Ray0665Ray0665 Posts: 231
    edited 2011-07-26 08:52
    Since practicality is not an issue:
    put one gear (front or back) and 21 gears on the other end and shift only that end.
    Problem/puzzle solved...
  • Dave HeinDave Hein Posts: 6,347
    edited 2011-07-26 09:02
    You could put 11 gears on the front and 11 gears on the back, and only allow a subset of the pairings to be used. The pairings would be something like this:
              1     2     3     4     5     6     7     8     9    10    11
             16    18    20    22    24    26    28    30    33    36    39
     1 24 0.667 0.750
     2 22       0.818 0.909
     3 20             1.000 1.100
     4 18                   1.222 1.333
     5 16                         1.500 1.625
     6 15                               1.733 1.867
     7 14                                     2.000 2.143
     8 13                                           2.308 2.538
     9 12                                                 2.750 3.000
    10 11                                                       3.273 3.545
    11 10                                                             3.900
    
    This would give 21 speeds with only one shift required to go from one speed to the next.
  • GadgetmanGadgetman Posts: 2,436
    edited 2011-07-26 09:04
    On my 21gear bike, I don't use the 2 largest or the smallest sprockets while in the 'low' gears, on the mid gear, I try avoiding the larget and smallest rear sprockets, and on high, I also skip the largest rear sprocket.

    My reason for skipping the very lowest two gears is that if I was to use thm it would be slower than getting off and walking!
    The other exclusions is to lessen the strain on the chain and wear on the sprockets

    Switching both derailleurs at the same time is asking for trouble.

    As for a certain 'dinnerplate bicycle'... OUCH!
    Hope you never have a spill, because that thing will cut into your leg like a blunt circular saw.

    As for finding the most efficient stepping and gears in general, maybe someone can put together a Propeller-based bicycle-coputer with servo-controller derailleurs?
    Add a climb-indicator and speed/distance, and it should be able to gear up/down for you when needed.
    (Hooking it up to a speedo isn't that difficult. I did it years ago with a 1987-vintage Psion Organisr II)
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-07-26 09:32
    Ray: See my post #5.

    Dave: Interesting! 'Not what I envisioned, but I guess your "sparse matrix" solution satisfies the stated conditions -- and it keeps the chain parallel!

    Putting it in matrixi form like that is an interesting way to view the problem, too. If all the boxes were filled in and all the gears used, it becomes a problem of how to arrange the columns and rows, such that adjacent speeds are in adjacent boxes. If there's a solution, shifting through the speeds creates a path through the martix, with each shift represented by a hop to an adjacent box.

    What this tells me, though, is that if the sprockets in each cluster are arranged in order, no solution exists. My reasoning is this: Suppose a legitimate shift occurs from y1 to y2 in a given column. Somewhere in that same trajectory, but in a different column, there will have to be a jump from y2 to y1, from y1 to y0, or from y3 to y2 to ensure that all the boxes are visited. But these latter movements go in the wrong direction: i.e. if you started out upshifting, they represent downshifts.

    That doesn't rule out a solution, though, if the sprockets are arranged out of order, or if diagonal jumps (i.e. shifting both derailleurs at once) are permitted.

    -Phil
  • Dave HeinDave Hein Posts: 6,347
    edited 2011-07-26 09:42
    Here's the matrix with all of the 121 speeds.
              1     2     3     4     5     6     7     8     9    10    11
             16    18    20    22    24    26    28    30    33    36    39
     1 24 0.667 0.750 0.833 0.917 1.000 1.083 1.167 1.250 1.375 1.500 1.625
     2 22 0.727 0.818 0.909 1.000 1.091 1.182 1.273 1.364 1.500 1.636 1.773
     3 20 0.800 0.900 1.000 1.100 1.200 1.300 1.400 1.500 1.650 1.800 1.950
     4 18 0.889 1.000 1.111 1.222 1.333 1.444 1.556 1.667 1.833 2.000 2.167
     5 16 1.000 1.125 1.250 1.375 1.500 1.625 1.750 1.875 2.063 2.250 2.438
     6 15 1.067 1.200 1.333 1.467 1.600 1.733 1.867 2.000 2.200 2.400 2.600
     7 14 1.143 1.286 1.429 1.571 1.714 1.857 2.000 2.143 2.357 2.571 2.786
     8 13 1.231 1.385 1.538 1.692 1.846 2.000 2.154 2.308 2.538 2.769 3.000
     9 12 1.333 1.500 1.667 1.833 2.000 2.167 2.333 2.500 2.750 3.000 3.250
    10 11 1.455 1.636 1.818 2.000 2.182 2.364 2.545 2.727 3.000 3.273 3.545
    11 10 1.600 1.800 2.000 2.200 2.400 2.600 2.800 3.000 3.300 3.600 3.900
    
    Realistically, there may be a problem with stacking 11 sprockets next to each other on the pedal crank. Also, you would probably be limited to +/-2 or 3 positions from the diagonal. However, a +/- 2 range would allow for shifting a few positons up on one derailer, and then shifting four positions up on the next derailer before going back to the other derailer.
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2011-07-26 11:10
    What you really need is an automatic transmission that changes gears based on the rear wheels load, The Salsbury was the first to introduce the transmission that is now common place in snowmobiles.
    877 x 368 - 353K
  • ercoerco Posts: 20,259
    edited 2011-07-26 14:08
    Dave Hein wrote: »
    Realistically, there may be a problem with stacking 11 sprockets next to each other on the pedal crank.

    Agreed! It's called tread, or Q-factor! :)

    http://sheldonbrown.com/gloss_q.html

    BTW, that whole website is a highly-revered knowledge base for cyclists. Definitely bookmark-worthy! Sheldon Brown was to cycling what Mike Green & PhiPi are to this forum. He passed away fairly recently, but his knowledge will go on until the Atomic Flame Deluge.

    http://sheldonbrown.com/
  • Mark_TMark_T Posts: 1,981
    edited 2011-07-26 17:40

    So here's the puzzle: Ignoring mechanical practicality, is it possible to come up with a selection of tooth counts that permit shifting incrementally through an entire range of gear ratios by shifting only one derailleur at a time? (This is where the Gray code reference in the title comes from.) If not (and I suspect not) can it be done by occasionally shifting both at once but only by a single step?

    -Phil

    No and no. Single moves would mean you can't go backwards at any point so you are limited to (A-1)+(B-1) steps where A and B are the numbers of sprockets on each axle.

    If you are allowed to move two at a time but only by one step each, you can only take one step backwards on one axle while going forwards on the other. This doesn't add enough cases to get A*B-1 steps unless both axles have 2 sprockets each.
  • Dave HeinDave Hein Posts: 6,347
    edited 2011-07-27 09:09
    Another possibility would be to have two chains with one on the left side and the other on the right. Each side would have two sprockets on the front and five on the back for a total of 20 speeds. The rear sprocket assemblies would each contain a clutch, or some other way to engage them. Maybe the current ratchet method would be sufficient, where the faster rear sprocket would engage while the other one would click freely. The clicking might get annoying after a while, and it would be nice to have control over the ratchet/clutch so the unused side could be freely shifted without tension on it. It would also be necessary to override the ratchet when downshifting.

    I think the gear ratios could be arranged so that each speed-increment alternates between the left and right side. If the right side is the current one in use, the next speed would be engaged by moving one or both of the derailers on the left side. You would then engage the left side and disengage the right side. If a ratchet is used instead of a clutch, a downspeed would require momentarily removing tension from the chain so the ratchet could release.

    This only requires 6 levers. :) This would be a good application for using a microcontroller and some servos to perform the shifting sequence. The rider would just need to control a single lever in this case. The shifting could even be made automatic so that a contant pedal force or power could be maintained.
Sign In or Register to comment.