Wonky Wheel Calculations
The mathematics in this article gets rather long-winded with few explanation steps. While I believe anyone with knowledge of trigonometry should be able to follow do feel free to skip it.
"Right, you're good at maths."
Now it's (almost) always nice to be complemented so a good conversation opener, that is until a fraction of a second later once the brain has whirred to life. On reflection that "Right" seems downright ominous and a demonstration of said capacity for mathematics (quite possibly at length) is being sought. Several moments later the follow up - "This is more of a theoretical exercise than anything else." Oh goodie. Deciding discretion was the better part of valour I decided now was the time to have that shower I had been putting off, typed some vaguely coherent excuse and booked it. Returning fresh I decided it was probably best to inquire what was being asked, and so we come to the meat of this page.
In short some (theoretical) wheel was going to be built and some input on spoke lengths was requested. This was not just any wheel however, the hub was not going to be in the dead centre of the wheel, but rather slightly closer to one side of the rim than the other. As you can see in this video this means the bike will bounce up and down when in motion. Oh and this was going to be for a unicycle, because apparently removing a wheel and the handlebars just isn't challenging enough...
Anyway, I didn't have to ride it, just crunch the numbers for it. So here goes.
According to my understanding a bike wheel generally consists of the hub (middle spiny bit), spokes (thin bit connecting middle bit to outer bit), rim (outer bit) and the tyre (squidgy far out bit). For my purposes I don't care about the tyre so we're going to ignore it, leaving us with something like this:
Now in the real world the rim has an actual width, the spokes don't magically attach to the very edge of the hub and there's all sorts of awkward bits that mathematicians and physicists prefer to ignore. Luckily for me though a load of smart cycley people have already standardised the measurement system meaning we can use the above diagram. Now all we need are some measurements.
The Effective Rim Diameter (d) is the distance across the wheel from one side to the other factoring in the rim's thickness. The Flange Diameter (f) is the diameter of the circle passing through the centre of each hole used for the spokes to slot into, and is not the diameter of the actual hub. As we only care about the connection point however this is perfect for our calculations. Now to begin with we're going to start with the simplest case - the spokes go out straight and the hub is in the centre of the wheel. From our diagram we can see that the spoke length is (d-f)/2
Unfortunately spokes generally do not go straight out to the rim (radially laced). Rather they go out at an angle and cross other spokes. I'm not going to go into detail, but purecycles have a good explanation with images. In short a wheel has a certain number of spokes (s) which are split evenly with half on each side of the hub. Then on each side of the hub alternate spokes are threaded through from opposite sides and angled in opposite directions. For example in the diagram below we have one side of a wheel consisting of 18 spokes.
We are crossing the spokes twice, and so we do the following calculation. 36 spokes in total, halved means 18 spokes per side. 360 degrees divided by 18 means 20 degree segments between where each spoke connects. This means that there will be 20 degrees between each spoke attached to the hub, and depending on the direction the spoke is rotated it will connect at an angle 40 (2 x 20 as crossing twice) degrees further clockwise or anticlockwise at the rim.
Let us zoom in on a singular spoke. We will set θ as the angle between the spoke hole on the rim being used and the spoke hole that would be used if the spoke was following the line of the radius. θ will be equal to to 2 times the number of spoke crosses (c), times 360 degrees divided by the number of spokes (s) being used. This value is a calculation of how far apart the spoke holes are, doubling it as each side of the hub is going to connect to every second spoke hole on the rim, and then finally multiplying by the number of crosses as this is how many additional spoke holes we need to "count along".
Using the cosine rule we can easily calculate a value for spoke length as follows.
This should give us a length for the spoke, however up until now we have been ignoring two points. The first part is that this is taking place in 3 dimensions, and so we have to take into account the width of the hub. Secondly the spoke's rounded end has not been taken into account when calculating its length. The first of these issues can be solved simply using half the width of the hub to create a right angled triangle through the third dimension which can then be solved using Pythagoras' Theorem. Meanwhile the second issue can be resolved by subtracting half of the diameter of the spoke (a very small amount). Putting this all together we end up with:
Quickly recapping:
- d - Effective Rim Diameter
- f - Flange Diameter
- h - Hub Width
- c - Spoke Crossings
- s - Number of Spokes
- w - Spoke width
As several spoke length calculators already exist online we can substitute in some numbers and quickly check our work...or at least that was the plan. Checking unicycle.co.uk and adding some numbers to the website and our formula we end up with very similar answers, but I'm not after similar results I'm looking for accuracy. A brief search turns up the website that this calculator is based on, the Edmonton Bicycle Commuters' Society, and after quickly adding our numbers we can see that we're still slightly off... Thankfully the calculation is being done client side with JavaScript so we can easily check under the hood.
form.SpokeLength.value = -(HoleDiameter / 2) + 0.998 *
Math.sqrt(
(Math.pow(RimDiameter, 2) / 4) + (Math.pow(HubDiameter, 2) / 4) -
(RimDiameter * HubDiameter / 2 * Math.cos(4 * Math.PI * NumCrosses / NumSpokes)) +
Math.pow(HubWidth, 2)
);
form.SpokeLength.value = Math.round( form.SpokeLength.value * 100 ) / 100;
On the face of it this looks pretty much the same as our calculation, but further inspection reveals some slight differences. Firstly we're not doing any rounding, whereas the final line of this code is causing their value to be rounded to 2 decimal places. Rounding however is not enough to explain the difference in length we're observing. For this we need to look to the first line where we find a perplexing 0.998 which is being multiplied by our square root. My first guess is that this is a "fudge" factor, a number used to drag pure mathematical calculations kicking and screaming into the real world accounting for small differences that are very difficult to accurately to model properly. So to check this I go hunting for every spoke calculator I can find.
I won't bore you with all of the results, but I end up with at least 4 different answers to my test case, several of which I'm glad to say actually match my calculation. All results are very close, generally varying by fractions of a millimetre, with the entire spread between low and high values at most a few millimetres. To resolve all of these differing values I delve into wheel building forums and it seems that the issue is one of stretch, specifically the spokes when subjected to load deform slightly and it is this deformation that several calculators are attempting to account for.
The wheelpro website gives an in depth look at several calculators explaining how they are modifying the standard formula which we have derived above, and finishing by explaining that their calculator is "calculating the spoke stretch using engineering equations, taking into account the spoke diameter and spoke tension" and should be used instead of the others. I'm not going to weigh in to be honest, I've a solid enough mathematical background and a pretty basic understanding of how a bike wheel has been put together, but several of the people involved in these calculators have some serious bona fides, appearing to have spent most of their lives fully immersed in cycling and bike building. As such I bow to their superior knowledge, but I'm going to entirely ignore it for my calculations for several reasons. Firstly the differences appear to be very small. Secondly any spoke stretch is going to depend on spoke material (and I don't know what types of spokes are going to be used - I'm assuming they're going to be non-standard?). Finally the spokes are all going to be of different lengths this is going to mean each individual spoke is going to have a separate value for how much it stretches and frankly I'm just not that much of a masochist. I'm declaring the unmodified formula "sufficiently accurate" and moving on.
Going back to our 2D model again we now need to look at how this calculation will change when moving the hub from the centre of the wheel. In the diagram below we can see the original spoke, and the new adjusted spoke position. To be able to work out the adjusted spoke length, we need to know the angle between the original spoke side and the hub offset side. We can see this is made up of two angles, the angle between the hub offset and the radius (which we know for each spoke) and the angle between the radius and our original spoke (which we can calculate).
For a given spoke, proceeding anticlockwise from the direction of the hub offset, the angle between the hub offset and the radius passing through the spoke hole is given by:
Where # is the spoke number starting with spoke 0 which would lie parallel to the hub offset if radially laced (straight up in this diagram above). We can then calculate the angle between the radius and the spoke by:
From this we can see that we will need to add these value to the standard cosine formula giving us the rather ugly equation below:
It's possible there are some trigonometric identities that can simplify this, however as I'm going to use a spreadsheet or code to do the calculation it suits my purposes fine. Below you will find a calculator which will give you the spoke lengths required if for some reason you want to undertake construction of such a wonky wheel, or just want to play with it.
Note the calculation from above has been slightly tweaked so that the first spoke is offset from the vertical (this makes it so that spokes are paired). If you desperately want to take this into account simply add 180 divided by the number of spokes to any given spoke angle. Hover over a spoke for information.
This form does not validate inputs, if you tell it to do dumb things it will do dumb things.