Loading

Parametric Involute Bevel and Spur Gears

by GregFrost, published

Parametric Involute Bevel and Spur Gears by GregFrost Jul 19, 2010

Description

This OpenSCAD script provides modules for both Spur and Bevel Gears. It has some major enhancements over my original gear script thingiverse.com/thing:3534. It uses some of the spur gear nomenclature code from TheOtherRob github.com/TheOtherRob/MCAD with my own code for generating the involute teeth. The bevel gear is also my own work. Thanks also to elmom for some enhancements to my original gear script thingiverse.com/thing:3547.

Enhancements include the Bevel gear module, backlash settings, parameterised number of facets for the involute curve and whole of tooth generation to avoid some of the issues the original script had when mirroring a half tooth.

The STLs provided are not intended for direct use, but instead show examples of what can be done with the parametric script.

Parametric Involute Spur Gears take the following parameters:
number_of_teeth
circular_pitch or diametral_pitch: controls the size of the teeth (and hence the size of the gear).
pressure_angle: controls the shape of the teeth.
clearance: The gap between the root between teeth and the teeth point on a meshing gear.
gear_thickness: the thickness of the gear plate.
rim_thickness: the thickness of the gear at the rim (including the teeth).
rim_width: radial distance from the root of the teeth to the inside of the rim.
hub_thickness: the thickness of the section around the bore.
hub_diameter
bore_diameter: size of the hole in the middle
circles: the number of circular holes to cut in the gear plate.
backlash: the space between this the back of this gears teeth and the front of its meshing gear\'s teeth when the gear is correctly spaced from it.
twist: for making helical gears.
involute_facets: the number of facets in one side of the involute tooth shape. If this is omitted it will be 1/4 of $fn. If $fn is not set, it will be 5.

Parametric Involute Profile Bevel (Conical) Gears take the following parameters:
number_of_teeth
cone_distance: The distance from the pitch apex to the outside pitch diameter.
face_width: The length of the teeth.
outside_circular_pitch: The circular pitch at the outside pitch diameter.
pressure_angle: Defines the shape of the teeth.
clearance: Gap between the tip of the teeth on one gear and the root of the teeth on another meshing gear.
bore_diameter: The size of the hole in the middle.
gear_thickness: The thickness of the gear for bevel_gear_back_cone finish (see below).
backlash: Makes the tooth width smaller to make a gap between teeth of correctly spaced gears to allow for manufacturing tolerances.
involute_facets: As for spur gears.
finish: Specify either bevel_gear_flat(0) or bevel_gear_back_cone(1). If you don't specify this parameter you will get a flat gear for pitch angles less than 45 degrees and a back cone gear for pitch angles greater than 45 degrees. The example shows both with the small gear being the flat one.

Update: v5.0 Implements backlash for bevel gears (This was not working in v4.0).

Recent Comments

view all
What's the best way to calculate the bevel gear pair bore base offsets from y0,z0?
I have an existing model that I want to add a 90degree bevel gear pair to, but I need them to be a specific distance apart to fit.
For the small gear, the correct y value appears to be pitch_apex2, but pitch_apex1 for the other gear, seems to be in the middle of the teeth.
pitch_apex1+half_tooth_thickness+gear_thickness seems to be pretty close, but not quite the value I'm after.

If you could add this as a feature, that would be great! but I'd be happy just to know how to calculate it and plug in numbers till I get what I want.
Hi Greg,
Thank you for sharing this terrific SCAD script. One question- is there a way to separate the two gears into two different files? The STL export gives one object with both gears; I want to be able to print them individually.

Regards,
John
Oh, is that why the gears have no teeth? unless one hits F10 or F6. The render() patch below seemed to fix the problem though, at least the teeth show.

Liked By

view all

License

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag. Print Thing Tag

Instructions

To make a pair of spur gears mesh, they must have the same circular pitch and pressure angle. Look in the console window and you will see the pitch radius of each gear produced. The axes of two gears must be separated by the sum of their pitch radii to mesh correctly. Use the backlash option to allow for the gears to work with printing inaccuracies.

Bevel gears are more complicated. Meshing bevel gears have the same cone distance, circular pitch and pressure angle. The cone distance, circular pitch and number of teeth will define the pitch angle. The example provided shows how to calculate the parameters for two gears if you have a desired axis angle (the sum of the pitch angles for the two bevel gears).
2 days ago - Modified 2 days ago
What's the best way to calculate the bevel gear pair bore base offsets from y0,z0?
I have an existing model that I want to add a 90degree bevel gear pair to, but I need them to be a specific distance apart to fit.
For the small gear, the correct y value appears to be pitch_apex2, but pitch_apex1 for the other gear, seems to be in the middle of the teeth.
pitch_apex1+half_tooth_thickness+gear_thickness seems to be pretty close, but not quite the value I'm after.

If you could add this as a feature, that would be great! but I'd be happy just to know how to calculate it and plug in numbers till I get what I want.
Hi Greg,
Thank you for sharing this terrific SCAD script. One question- is there a way to separate the two gears into two different files? The STL export gives one object with both gears; I want to be able to print them individually.

Regards,
John
Is there a newer version of this somewhere? I noticed that the involute_bevel_gear_tooth() module has a bug: The triangles are inverted which causes rendering to be wrong in preview mode. The correct triangle ordering should be: triangles=[[0,2,1],[0,3,2],[0,4,3],[0,1,5],[1,2,5],[2,3,5],[3,4,5],[0,5,4]]);Also, we've almost finalized list comprehension functionality in OpenSCAD, which could significantly reduce the complexity of this script, especially the stitching together of 2D polygons.
Oh, is that why the gears have no teeth? unless one hits F10 or F6. The render() patch below seemed to fix the problem though, at least the teeth show.
For those wanting internal gears, an external gear is one Boolean operation away from an internal gear.
...You would want to reverse the clearance though, since positive clearance on an internal gear would make it TIGHTER.
I was using this to make a set of bevel gears for a 90 degree gearbox. To get gears that look half way reasonable required that the circular pitch be set no smaller than 750. However, this generated large gears. I finally got my head on straight and figured out the work around for this. I made the bore diameters twice the size they needed to be and scaled the gears down 0.5 during slicing. Now I have good looking gears the proper size. This is a great script. It beats me having to learn another programming language. Thanks GregFrost.
Think you could add a root fillet (radius) parameter to the spur gears? I'm finding that my printer doesn't like the sharp inside corners on smaller pitch gears, smoothing that out would be great.
I've just found out that for small gears the resolution for the hub and bore isn't increased appropriately thus one ends up with three sided prisms.
ok cool, so it is not just me lol, I wasn't sure I wasn't just using it wrong. I need a little more functionality from your modules so I am trying my hand at my first bit of openSCAD coding. I will probably host my mods on github, but if you have any design notes you could share here regarding units, I would like to at least annotate your code, since if it is wrong we can atleast warn people lol, or I can be the jerk who forks the code to use proper units, with a note on backwards compatibility.
Yeah yeah. I know. I wish I had realised sooner, but now lots of designs use this so if I changed the definition of circular pitch, it would need to have all designs using this updated. As it is it is in some stupid units like pi/180 mm.
I would vote for correcting units. Designs needs updating, so what?

Every software has bugs, and bugfixes which may break backward compatibility.

The sooner the fix the less break in the future.

Or just release a v2, with a warning, that definition has been changed.
I'm super-grateful to sasa, I tried to debug a year back, but gave up before finding the culprit.

Laszlo
github.com/VladAlpha/gearCreator
the functionalEnough branch is, well, functional enough. I hope to have 3 new features added today, check the readme file I am trying to document it well. Note my code will still create a backwards compatible gear if you use his old parameters, or you can use the right ones, it is all covered in the readme.
Hi,

Thank you very much permn00b! I will definietly dive into it.

Best,

Laszlo
great! I will probably in the next day or three restructure it a bit. Instead of different modules for different mounting types, I will put it all into the gear module, and have a variable for the type of mounting ie Flange, Set_screw etc
ok cool, so it is not just me lol, I wasn't sure I wasn't just using it
wrong. I need a little more functionality from your modules so I am
trying my hand at my first bit of openSCAD coding. I will probably host
my mods on github, but if you have any design notes you could share
here regarding units, I would like to at least annotate your code, since
if it is wrong we can atleast warn people lol, or I can be the jerk who
forks the code to use proper units, with a note on backwards
compatibility.
ok, I see where this rabbit hole is headed. I need to get this print going before too late today, so I am going to try to churn through this, backwards compatibilty can be preserved by scaling your input numbers and I am going to include that in the readme. If you are interested in trying to keep my new code cohesive with your older stuff let me know and I will work with you on that. The big plus to fixing this error is that you can mate printed gears with industry standard gears you can buy off the shelf, which will matter to some people.
Thank you for doing all the hard work for me though, no way in hell I could have written this from scratch.
well once I understand variable scope a bit better I can stick my kludge into a module (once I learn how modules work...) but I got the code to take standard units and I call that a win. Question for you tho, why is this line like this?

circular_pitch = (circular_pitch!=false?circular_pitch:180/diametral_pitch);
and not
circular_pitch = (circular_pitch==true?circular_pitch:180/diametral_pitch);

as any value inside of circular_pitch should evaluate as true?
False is zero whereas true is a specific value (probably 1) so your line says if they specify a circular pitch of 1 then use it, otherwise use the diametric pitch. The !=false line says if they have specified any circular pitch use it, otherwise use the diametral pitch.
oh see I thougt any non-zero value would evaluate true, so it would be
logically the same as your statement but more readable, but in
retrospect I would agree your way is better. since if this was written
in C++ you could say definitly ANY value will evaluate true, but this is
openscad, and since I don't know that for fact, your method is safer.
This didn't occur to me originally hence the question.
I don't mean to bea jerk, but units man! units! Should really spell that out somewhere. I have been throwing numbers at this till a gear appeared. I am trying to match up to some gears I made in a different program that I no longer have, so took me a while to get usefull results from this. Also since I have never used openscad before it was extra intimidating, and for the record compile-time variables scare the poo out of me, what is this black magic. Otherwise I'd offer to help.
Version in gears (vs version in rack)

First thanks for the scripts-

I got very confused when trying to marry up this rack (http://www.thingiverse.com/thing:6011)
and pinions (http://www.thingiverse.com/thing:3575) and eventually came to the conclusions that
there were errors and bodges in both sets of scripts.

The rack has the "multiplier" bodge (*20) in it. The pinion has a very odd and incorrect definition
of the circular_pitch. Correcting both makes it easy and intuitive to make matching rack and pinions.

(1) the CP in 3575 should be in units of length (ie the distance between teeth defined on the pitch
radius) but in this script it is in units of degrees/radians*length (ie you need to enter a number
180/pi* bigger than the actual distance you want). Fixing this makes everything a _lot_ easier.

...
pitch_diameter = number_of_teeth * circular_pitch / pi;
...
addendum = cp/pi;
dedendum = addendum*1.1;
... // a few more trivial fixes below

(2) the *20 multiplier bodge in the rack script (6011) - I didn't get to the bottom of this but if the script
is rewritten using the correct CP then it isn't necessary.

module rack(width,thickness,cp,N){
...
a = 1.0*cp/pi; // addendum
d = 1.1*cp/pi; // dedendum
height=(d+a);
... // more fixes below but you get the idea

Personally I'd drop the diametrial_pitch options - this is much hard to understand than the CP which is
in simple mm/tooth units. Anyone who cares can just use CP=pi/DP.
how to change gear size big and or small?
how cab I customize this?
Hello. I am very new to modeling and OpenSCAD. I am trying to model bevel gears. Can someone please tell me what all I must change in the downloaded code? A step-by-step guide? I would really appreciate it. I have my desired bevel gear dimensions with me. I just don't understand how much and where to enter it all..
I'm a little confused by this line in the gear module
pitch_diameter = number_of_teeth * circular_pitch / 180;

Shouldn't this be
pitch_diameter = number_of_teeth * circular_pitch / pi;

Because of this, the gears generated by the script end up being way smaller than they should be.
How would one design off-center gears similar to those being used on emmet's heart and your own projects? I would like to produce my own kinetic sculpture that "explodes" when rotated. If you have any references I could research I'd greatly appreciate it. I'm sure I could construct on-center bevel gears similar to the first gear cubes but I'm having a hard time wrapping my head around 8 gears who's contact points constantly change.
They are not off centre. They are just reshaped by unioning it with a non-symmetrical shape.
after reading docs here and trying to create a 32DP (diametral pitch) gear model, I have determined that the units must be metric, so to use 32DP (32 teeth per inch diameter) the value entered for Diametral Pitch should be 32/25.4 hence the gear is

module testDPGear()
{
gear(number_of_teeth=127,
diametral_pitch=32/25.4,
pressure_angle=20);
}this is now working as I expected thank you Greg for a fantastic tool!

Is it possible to use this script to create racks?  If so, what are the correct parameters to create a matching "normal" and rack gear?
When i try to generate a gear with my own parameters, i only get some sort of rod. My parameters: gear (circular_pitch=0.051181,

number_of_teeth = 20,

gear_thickness = 0.066929,

rim_thickness = 0.066929,

hub_thickness = 0.066929,

hub_diameter = 0,

bore_diameter = 0.086614,

twist = 0,

circles=0);

The gear is 1,68 mm thick. As far as i understand the programm takes imperial values so i´ve converted the values to inches.
Can anyone tell me what i´m doing wrong?
pro tip: wrap the actual operations of the teeth inside render(), that will significantly simplify the CSG trees (and thus make previews work better).

gist.github.com/2487245
Thanks mashiaraI applied the patch and now the gears have teeth with out having to hit F6 or F10. And it seems faster also.
I have a license question. Are the gears made (the stls) also LGPL? Or can I consider them to be whatever license I wish, as it's *L* GPL, and not GPL, as long as I haven't changed your scad script, but I'm just using it? I'm asking as my thing where I included a gear made by your script was criticized for including your part on my page, since my thing has a different license. Now I've noted in the description that your part is LGPL, and hope this is ok, but it'd be good to get a clarification from you. My thing is on: thingiverse.com/thing:15611 (And thanks for a great and very useful script, as well as all the other parts you've designed that I use frequently!)
The output of a gpl/lgpl program is not goverened by the gpl/lgpl.

You caqn do with it whatever you like.
who can help me!

i need 2 gears

1st - 108 thooth /modulus 1/ 3mm thick

2nd - 20 thooth / modulus 1 / 3mm thick

which settingsmust i use

further

a 20 thooth bevelgear / modulus 1

same question

rgrds
henk
I'm confused with one of the comments below, are the measurements in imperial or metric?
What is the unit for the parameter outside_circular_pitch?

You are calculating:
outside_pitch_radius1 = gear1_teeth * outside_circular_pitch / 360;
outside_pitch_radius2 = gear2_teeth * outside_circular_pitch / 360;
This looks somewhat like you are actually calculating some circumference instead of a radius
but I haven't yet found my way around the formul
as.

(In software development it's accepted and often even enforced practice
to have a comment in front of a method to document not only it's purpose
but it's parameters and their allowed values too.)
I could use some help.

Given a dedendum circle(and shaft)-Diameter of exactly 75,3(65,5mm) mm and something like 35(8mm)mm.

How do I calculate sensible parameters for bevel_gear_pair()? *DONT_KNOW*

Preferably with a 0.8/ 32 pitch. (An industry standard for the application I have in mind.)
Well, I'm trying to enter a pitch of 32 and doing a binary search to find the correct number of teeth to get my diameter.

Somehow this is extremely slow.

The first 2 runs took
&
gt; 2 minutes on a 2x2.8GHz with 8GB or Memory.

The third one is running for more then 15 MINUTES now. (parameter: 80, 20, , 32)

OpenSCAD is using 320MB of memory already and adding megabytes by the second.

Could there be a massive memory leak?
Okay, there are memory leaks the size of the UK.

It runs much faster if you stop and re-start OpenSCAD every time you run it.
(I just don't like spending 30eur+80eur on two plastic gears that I could print myself.

store.redrockmicro.com/Catalog/Upgrades/microFollowFocus-Drive-Gear-0-6-Fujinon-Pitch-upgrade )
This is great but I am having a little difficulty working with it. I need 2 spur gears that mesh together that have a 6:1 gear ratio. The largest gear can be no larger than 40.64 mm can someone help me set this up?
//6:1 is a pretty high ratio for such small gears:

large_gear_radius=40.64/2;
small_gear_teeth=7;
large_gear_teeth=6*small_gear_teeth;
circular_pitch=large_gear_radius/large_gear_teeth*360;

gear (circular_pitch=circular_pitch,
gear_thickness = 3,
rim_thickness = 4,
rim_width=3,
hub_thickness = 6,
number_of_teeth=large_gear_teeth,
circles=10
);

translate([large_gear_radius*(1+1/6),0,0])
gear (circular_pitch=circular_pitch,
gear_thickness = 3,
rim_thickness = 4,
hub_thickness = 0,
bore_diameter=3,
number_of_teeth=small_gear_teeth);
I was totally failing to generate an actual gear with my own numbers and then I realized that gears are typically imperial! Converted my metric to inches and bam! A gear with teeth! Doh.

Another little gotcha is when you load up the STL into ReplicatorG the gear will be TINY! I guess the STL file can specify a unit so you'll need to use the scale tool to go from inches to mm.
Made a pair of these, using the simple gear template. They meshed perfectly, rotated 1:2 like they should, and taught me something about why the teeth on gears aren't flat.

Entirely rad. Thanks.
I tried it, I printed some gears, but Im unable to create meshing inside gear and external gear.

Making a difference from a plain cylinder is not working. Some clearence needs to be adding.

Can you extend this script to have inside gears? They allow to create more compact design, and Im desperately looking for a solution.

I would like to have herringbone inside gear...

Laszlo
jag - in reply to laszlo
I've been working with internal gears for my gearbox.

I had to make some modifications to the library to get it to work. I added a way to adjust the addendum
&
amp; dedendum. The addendum is defined as 1/pitch_diametrical, I changed it so that you can set it to something like 1.25/pitch_diametrical so that you can make the tooth taller do so that when you subtract the gear from something it leaves more room, alternatively, you could have another clearance adjustment that increases the addendum instead of the dedendum. I also found some documentation on the net implying that the dedendum should be more like 1.4/pitch_diametrical for fine pitched gears but that adjustment can easily be made with the clearance parameter.
Can you post a pic of the gears you printed that don't mesh? I though internal gears were the made just as you suggest (i.e. the negative of an external gear), but I think there are some limitations on the teeth ratios. Have you tried using the backlash parameter? That will give some clearance between the teeth.
Actually, if you are taking the negative of a gear, you would need negative backlash... I havent tried that.
Thank you, I will try out with negative backlash.

Also I can try out only after a week or so. I will definietly update you here.

Thanks for the support. I try to make some photos to discuss it further.
is it possible to make a bevel gear the same size as the large gear? i want to make a lens focus gear but i want to eliminate the 90
º junction box on most traditional designs. if i print it with a bevel gear that fits on the lens and another the same size but with a much smaller bore diameter that is attached to a knob will that work?

basically something like this with bevel gears
http://store.redrockmicro.com/Catalog/microFo
llowFocusBundles15mm/microFollowFocusv2IndieBundle
That large gear is a bevel gear! It looks like a circular rack because of the combination of the teeth ratio and the axis angles. If either the axis angles were closer together or the second gear was much larger, it would be obvious that both gears are bevel gears.
This is an amazing script. There is so much functionality here that an instruction manual would be amazing. Nothing to fancy but a simple wiki page or something. I have the script running and am working my way through the commented code now.

Thanks for a great addition
josh
To be honest, I thought the documentation on this page would be sufficient. I guess that is the problem with open source software. It is hard to be a good judge of what documentation is required when you have been intimately involved in the development.
without knowing much about openscad its hard.. took me a while to realize that openscad is a stand alone application :) i kept trying to figure out how to make this work in a 3d application
Amazing scad work! Such a useful library and good variety of gear types!!

I have made an update allowing a gear to be made 2D for exporting to a laser cutter. The update is here thingiverse.com/thing:3752.

If you want to pull the changes into your code and release a new version/ add it to the next release that would be great :)

Thanks again for the good work!
w00t! Thanks for making everything work and awesome Greg! I didn't even realize this was based on my script until i checked GitHub today XP
The bevel gears are missing their teeth :)
For some reason, it sometimes renders without teeth using the F5 option. Using F6 takes a lot longer but always results in the teeth showing up. I just did this in a small script:
use
&
lt;parametric_involute_gear_v5.0.scad
&
gt;
bevel_gear();

F5 produced what you have shown. F6 rendered the gear properly. If you hit F12, you can see the component objects including the teeth. This must be some sort of limitation in the OpenCSG viewer.
if you put a render() statement in module bevel_gear() before it calls involute_bevel_gear_tooth, the problem is solved
elmom - in reply to elmom
that was from bevel_gear() with default parameters. Others seem to work great.
Could please licence this as "GPL 2 or later", to allow it to be properly included in the MCAD lib (http://github.com/elmom/MCAD). LGPL would work also.
"gpl2 or later" didn't seem to be an option. I have gone with LGPL.
Great, thanks. Even just clarifying the license here or in the code would've been good, but LGPL works.

I'll try to make a release and blog it some day, the lib already has other great additions also.
This Thingiverse page says "LGPL", but the file itself says "GPL". Would it be possible to change either the file or the page so they're the same?
Could you add inverted gears (think planetary) to your script. The sign of the radii/pitch parameters could act as the switch. You can take a look at swineworld.org/blender/gears/ which has a script for generating gears in blender. thing:505 has an example usage similar to what I'm planning (gearing for a gearbox for attaching to a drill chuck etc).
Flagging this as a derivative isn't obvious. The way I know how to do it is to press the "I made one!" on the thing to be derived and the form that opens has the option to add your changes. From there it uses the normal widget for thing editing.
elmom - in reply to elmom
Obviously this won't work after adding the derived thing.
would be super cool to have this type of scad libraries in some sort of svn/git ..

thanks for the superb work :) I'v bin trying to make script that does the same thing for few weeks and was not able to properly design involute shape in openscad.
elmom - in reply to Guest
github.com/D1plo1d/MCAD is the working address for the MCAD lib, from which some code was used for this script. I'm adding this script to my fork on github at least.
Very nice work, incredibly useful.
Wow! amazing script!
Are you sure this isnt some sort of black magic?

WOW. This is greatness. Any gear, any size, any type. From my perspective, the single most useful thingiverse post yet.
Thanks! That's high praise indeed! The script does represent about a weeks worth of research and development work. I think it does a good job showcasing the power of Openscad (and trigonometry).
Top