From ad47c9c773f050662851e0ec41c9b4d0b76422fb Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 16 Sep 2023 01:09:23 -0400 Subject: [PATCH 1/7] Add inline belt calculator --- source/_static/calculator-utils.js | 11 ++ .../belt-c2c-calculator.html | 130 ++++++++++++++++++ .../power-transmission/belt.rst | 32 ++--- 3 files changed, 150 insertions(+), 23 deletions(-) create mode 100644 source/_static/calculator-utils.js create mode 100644 source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html diff --git a/source/_static/calculator-utils.js b/source/_static/calculator-utils.js new file mode 100644 index 00000000..1b470e8e --- /dev/null +++ b/source/_static/calculator-utils.js @@ -0,0 +1,11 @@ +function prettifyFloat(float) { + return float.toFixed(2); +} + +function writeText(id, content) { + document.getElementById(id).innerText = content; +} + +function getValue(id) { + return document.getElementById(id).value; +} diff --git a/source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html b/source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html new file mode 100644 index 00000000..0f04e860 --- /dev/null +++ b/source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html @@ -0,0 +1,130 @@ + + + +
+ + + +
+Pulley A Pitch Diameter (mm): +
+ + + +
+Pulley B Pitch Diameter (mm): +
+ + + +
+Ratio: +
+ + + + + + + + +
Tooth CountC2C (mm)Length (mm)
+ + + + + + + + diff --git a/source/docs/common-mechanisms/power-transmission/belt.rst b/source/docs/common-mechanisms/power-transmission/belt.rst index 5fd8ef32..e7a6ccc4 100644 --- a/source/docs/common-mechanisms/power-transmission/belt.rst +++ b/source/docs/common-mechanisms/power-transmission/belt.rst @@ -25,35 +25,21 @@ When using timing belts, correct tension is very important. There are two main w Center-to-Center calculations ----------------------------- -Just like chain, the actual calculations for precise :term:`C2C` distances for belts are complicated. Here is a `calculator `_ or `two `_ that simplifies the work. +Just like chain, the actual calculations for precise center-to-center (:term:`C2C`) distances for belts are complicated. Below is a calculator for them: -.. math:: +.. card:: - C=\frac{P}{8}*(2L-(N+n)+\sqrt{(2L-(N+n))^2-\frac{8}{\pi^2}*(N-n)^2}) + Belt C2C Distance Calculator + ^^^ - L=\frac{2C}{P}+\frac{N+n}{2}+\frac{P(\frac{N-n}{2\pi})^2}{C} + .. only:: latex -- :math:`C=` center-to-center distance, inches + The web version of gm0 has a C2C calculator available here. -- :math:`L=` belt length in pitches + .. raw:: html + :file: belt-c2c-calculator.html -- :math:`P=` pitch of belt - -- :math:`N=` number of teeth in large pulley - -- :math:`n=` number of teeth in small pulley - -.. math:: C=\frac{L-\frac{\pi}{2}(D+d)}{4}+\sqrt{[(\frac{L-\frac{\pi}{2}(D+d)}{4})^2-\frac{(D-d)^2}{8}} - -- :math:`D=` chosen diameter of large pulley - -- :math:`d=` chosen diameter of small pulley - -- :math:`L=` length of belt - -- :math:`C=` center distance - -- (all units must be the same) +The equations for calculating these values by hand can be found in `SDP-SI's Designing a Miniature Belt and Pulley Drive System Design Guide `_. Belt Wrap --------- From 3bd4590003254d1b2447fc70a5bf66ac5697854d Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 16 Sep 2023 01:41:21 -0400 Subject: [PATCH 2/7] Add a modicum of error-handling --- source/_static/calculator-utils.js | 20 ++++++++++++++++++- .../belt-c2c-calculator.html | 3 ++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/source/_static/calculator-utils.js b/source/_static/calculator-utils.js index 1b470e8e..fc840473 100644 --- a/source/_static/calculator-utils.js +++ b/source/_static/calculator-utils.js @@ -3,9 +3,27 @@ function prettifyFloat(float) { } function writeText(id, content) { + if (isNaN(content)) { + content = "Invalid!"; + } + document.getElementById(id).innerText = content; } function getValue(id) { - return document.getElementById(id).value; + const value = parseFloat(document.getElementById(id).value); + + if (isNaN(value)) { + throw new Error("Value must be a number!"); + } + + if (value <= 0) { + throw new Error("Value must be positive!"); + } + + if (value >= 1e6) { + throw new Error("Value must be reasonably small! (Less than 1e6.)"); + } + + return value; } diff --git a/source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html b/source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html index 0f04e860..e9d6381d 100644 --- a/source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html +++ b/source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html @@ -83,13 +83,14 @@ } function updateBeltC2CCalculator() { - const pitch = parseFloat(getValue("belt-pitch")); + const pitch = getValue("belt-pitch"); const teethA = getValue("pulley-a"); const teethB = getValue("pulley-b"); const c2c = getValue("c2c"); const pdA = pitchDiameter(teethA, pitch); const pdB = pitchDiameter(teethB, pitch); + const idealBeltTeeth = beltPitchLength(pdA, pdB, pitch, c2c) / pitch; writeText("pulley-a-pd", prettifyFloat(pdA)); From 30cfb5afd5a9cb1d1c250010b5e747064655289a Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 16 Sep 2023 01:51:58 -0400 Subject: [PATCH 3/7] Add table buttons, remove arrows on numeric inputs --- .../power-transmission/belt-c2c-calculator.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html b/source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html index e9d6381d..31b9aa39 100644 --- a/source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html +++ b/source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html @@ -55,6 +55,23 @@ .closest-belt { font-weight: bold; } + + table, th, td { + border: 1px solid black; + border-collapse: collapse; + } + + /* Remove arrows for numeric inputs. */ + /* Chrome, Safari, Edge, Opera */ + input::-webkit-outer-spin-button, + input::-webkit-inner-spin-button { + -webkit-appearance: none; + margin: 0; + } + /* Firefox */ + input[type=number] { + -moz-appearance: textfield; + } From 47b8a45ebf781820e0b81c1b684eeefc9fe4c2f3 Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 16 Sep 2023 02:02:33 -0400 Subject: [PATCH 4/7] Change wording slightly --- source/docs/common-mechanisms/power-transmission/belt.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/docs/common-mechanisms/power-transmission/belt.rst b/source/docs/common-mechanisms/power-transmission/belt.rst index e7a6ccc4..bd12718a 100644 --- a/source/docs/common-mechanisms/power-transmission/belt.rst +++ b/source/docs/common-mechanisms/power-transmission/belt.rst @@ -22,8 +22,8 @@ Like chain, belt is identified by its :term:`pitch ` - common pitches fou When using timing belts, correct tension is very important. There are two main ways to get your tension right. The first is easy - goBILDA and Actobotics already have belts integrated into their hole patterns. You can buy correctly sized belt directly from each vendor, and your tension will be perfect as soon as the belt is installed. As your designs gain complexity, so will your belt runs - maybe there are more than 2 pulleys, and maybe your pulleys are all different sizes. To compensate for this, the second way to ensure tension is to use a dynamic tensioner, similar to those found in complex chain runs. To design for these tensioners, we recommend planning more complex belt runs in CAD before building them in real life. -Center-to-Center calculations ------------------------------ +Center-to-Center Calculator +--------------------------- Just like chain, the actual calculations for precise center-to-center (:term:`C2C`) distances for belts are complicated. Below is a calculator for them: From efcc2c3914a4b73edcc7d535af6c01f945d1575b Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 16 Sep 2023 18:52:10 -0400 Subject: [PATCH 5/7] Fix ratio calculation --- .../power-transmission/belt-c2c-calculator.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html b/source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html index 31b9aa39..b963aa1d 100644 --- a/source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html +++ b/source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html @@ -113,7 +113,7 @@ writeText("pulley-a-pd", prettifyFloat(pdA)); writeText("pulley-b-pd", prettifyFloat(pdB)); - writeText("ratio", prettifyFloat(teethB/teethA)); + writeText("ratio", prettifyFloat(teethA/teethB)); // in each direction, above and below the closest ones const numberOfBeltsToShow = 3; From 3ab08e46de4b2d694534429aed67bd544ed6cb0a Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 16 Sep 2023 18:59:02 -0400 Subject: [PATCH 6/7] Add links to advanced belt calculators --- source/docs/common-mechanisms/power-transmission/belt.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/docs/common-mechanisms/power-transmission/belt.rst b/source/docs/common-mechanisms/power-transmission/belt.rst index bd12718a..2c25bc82 100644 --- a/source/docs/common-mechanisms/power-transmission/belt.rst +++ b/source/docs/common-mechanisms/power-transmission/belt.rst @@ -39,7 +39,7 @@ Just like chain, the actual calculations for precise center-to-center (:term:`C2 .. raw:: html :file: belt-c2c-calculator.html -The equations for calculating these values by hand can be found in `SDP-SI's Designing a Miniature Belt and Pulley Drive System Design Guide `_. +SDP-SI has a `more advanced calculator `_, as does `ReCalc `_. The equations for calculating these values by hand can be found in `SDP-SI's Designing a Miniature Belt and Pulley Drive System Design Guide `_. Belt Wrap --------- From a7e0978ea9dc7edd67b3981851d287ed1d59ede7 Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 16 Sep 2023 19:18:02 -0400 Subject: [PATCH 7/7] Reword section slightly --- ...belt-c2c-calculator.html => belt-calculator.html} | 12 ++++++------ .../common-mechanisms/power-transmission/belt.rst | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) rename source/docs/common-mechanisms/power-transmission/{belt-c2c-calculator.html => belt-calculator.html} (89%) diff --git a/source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html b/source/docs/common-mechanisms/power-transmission/belt-calculator.html similarity index 89% rename from source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html rename to source/docs/common-mechanisms/power-transmission/belt-calculator.html index b963aa1d..bc9964e2 100644 --- a/source/docs/common-mechanisms/power-transmission/belt-c2c-calculator.html +++ b/source/docs/common-mechanisms/power-transmission/belt-calculator.html @@ -1,6 +1,6 @@ - @@ -10,19 +10,19 @@
- +
Pulley A Pitch Diameter (mm):
- +
Pulley B Pitch Diameter (mm):
- +
Ratio:
@@ -99,7 +99,7 @@ return 2 * c2c + Math.PI / 2 * (D+d) + Math.pow(D-d, 2)/(4*c2c); } - function updateBeltC2CCalculator() { + function updateBeltCalculator() { const pitch = getValue("belt-pitch"); const teethA = getValue("pulley-a"); const teethB = getValue("pulley-b"); @@ -144,5 +144,5 @@ } } - updateBeltC2CCalculator(); + updateBeltCalculator(); diff --git a/source/docs/common-mechanisms/power-transmission/belt.rst b/source/docs/common-mechanisms/power-transmission/belt.rst index 2c25bc82..de1d00ab 100644 --- a/source/docs/common-mechanisms/power-transmission/belt.rst +++ b/source/docs/common-mechanisms/power-transmission/belt.rst @@ -22,22 +22,22 @@ Like chain, belt is identified by its :term:`pitch ` - common pitches fou When using timing belts, correct tension is very important. There are two main ways to get your tension right. The first is easy - goBILDA and Actobotics already have belts integrated into their hole patterns. You can buy correctly sized belt directly from each vendor, and your tension will be perfect as soon as the belt is installed. As your designs gain complexity, so will your belt runs - maybe there are more than 2 pulleys, and maybe your pulleys are all different sizes. To compensate for this, the second way to ensure tension is to use a dynamic tensioner, similar to those found in complex chain runs. To design for these tensioners, we recommend planning more complex belt runs in CAD before building them in real life. -Center-to-Center Calculator ---------------------------- +Belt Calculator +--------------- -Just like chain, the actual calculations for precise center-to-center (:term:`C2C`) distances for belts are complicated. Below is a calculator for them: +The actual calculations to determine which belt to use to get close to a given center-to-center (:term:`C2C`) distance are complicated. Below is a calculator to help out: .. card:: - Belt C2C Distance Calculator + Belt Calculator ^^^ .. only:: latex - The web version of gm0 has a C2C calculator available here. + The web version of gm0 has a belt calculator available here. .. raw:: html - :file: belt-c2c-calculator.html + :file: belt-calculator.html SDP-SI has a `more advanced calculator `_, as does `ReCalc `_. The equations for calculating these values by hand can be found in `SDP-SI's Designing a Miniature Belt and Pulley Drive System Design Guide `_.