Wednesday, October 21, 2015

Gear Design



For a class project, I wanted to dip my toes into generative CAD, and try to mimic organic growth. However, I Realized that even if I could formulate a method to do so, I would still get riddled with syntax errors. To simplify the task, I figured it would be easier to try to draw something with a defined shape.. So, I chose to parametrically draw gears with involute teeth profiles.

Gears are devices which transmit circular motion, and they are used just about everywhere. Gears today appear in cars, toys, clocks, any the majority of anything else that has spinning parts.  In ancient history, and even in nature, The desire to transmit and modify circular motion is ever apparent. 

  



Right, the Antikythera mechanism is estimated to date to around 200bc, and is comprised of 30 brass gears. Middle, the Isus bug uses gearing to transmit torque in it's legs while jumping. Left, an example of a crude gear with simple interlocking pins. In 200bc, a collection of brass gears was indeed an example of phenomenal engineering and craftsmanship. However, such gears can now be found in a child's wind-up toy. As a need is developed for specific gears, we have found ways to efficiently produce the needed gear. The following is a discussion of the modern standard in gearing, the involute profile.
   
The Involute Profile

Gears appear in all sizes and styles, with each being suited to a specific purpose. No matter the purpose of the gear, the designer has longevity and smooth operation in mind. While a gear from a car transmission will be very different from a gear in a watch, they hold the involute profile in common. The magic of the involute profile is to allow interlocking teeth to roll off of each other, rather than shearing. Shearing action under heavy load will lead to the gears wearing down and eventually failing.
A good place to start in describing the anatomy of an involute gear is to imagine two circles that roll on each other without slip. These are essentially gears minus the teeth. Once teeth are added, this circle is called the “pitch circle” and is the circle on which the gear teeth are always making contact. the illustration below details relevant measurements.


  As seen, the teeth are always contacting along the pitch circle. The next important dimension is the pressure angle. Pressure angle is the angle between a tangent to the pitch circle at the point of contact and the line on which the teeth mesh. A higher pressure angle leads to thicker teeth. After determination of the pitch circle diameter and the pressure angle, the base circle can be calculated as:

 
                                                                     

 

Once the base circle is calculated, It can be used to sketch the involute profiles. An involute profile is the profile obtained when a string is unwound from a cylinder, and the tip of the string is traced. 

 










For a counterclockwise arc, 
 

For a clockwise arc, values of t have their signs reversed. For different start points around the circle, the offset is added to t.

This allows a mat lab function to be created that takes the number of teeth, the pressure angle, and the modulus. The modulus and the number of teeth are used to create the pitch circle, then the base circle is calculated and involute profiles are sketched off of it. The tricky part is knowing when to start and stop sketching the profile, and then adding corresponding top lands and fillet radii.


       results from the created matlab function are shown for an 8, a 20, and a 50 tooth gear with pressure angle of .35 radians. The green circle represents the pitch circle.



he result of drawing equation driven involute gears gives accurate results, but takes many piecewise defined parts for the program to function. The same principle can in theory be applied to non-circular gears, but finding the end points for drawing the involute curves becomes very complex.

Below is the Matlab code. It takes input for modulus, Number of teeth, Pressure angle (in radians), and resolution of the drawing (as a fraction).

function [ output_args ] = Geardrawd( modulus,N, PA,res)
%UNTITLED4 Summary of this function goes here
%   Detailed explanation goes her
theta=0:res:2*pi;

offset=0;                             %offset is the angle between centers of gear teeth.

thetasize=size(theta);                % This is done to determine the size of the theta vector, so that a radius vector of the same length can be made for plotting.

pitchrad=N./(2.*modulus);             % Determines the pitch radius.                      

basrad=pitchrad.*cos(PA)            % Determines the base circle radius. The base circle radius is the radius that all the involutes are "unwound" from.

addendum=1/modulus;                    % The addendum is the distance from the pitch diameter to the top of the gear tooth.

dedendum=1.25/modulus;                         % The dedendum is the distance from the pitch diameter to the "well" of the gear tooth.

baseradius=ones(1,thetasize(end)).*basrad;     %sets up the base radius as a vector matched in length  to theta.

pitchradius=ones(1,thetasize(end)).*pitchrad;  % Sets up the pitch radius as a vector matched in length to theta

outrad=ones(1,thetasize(end)).*(pitchrad+addendum); %determines the radius of the outside edge of the teeth.

rootrad=ones(1,thetasize(end)).*pitchrad-dedendum;  % Determines the radius of the lowest spot in the well.

alpha=((((2.*pitchrad).^2)-((2.*basrad).^2)).^(1/2))/(2.*basrad)-PA  % alpha is a weird one. it is the angle between where the involute intersects the pitch circle to where the involute intersects the base circle.

osos=(2.*pi)/(4*N)-alpha;   % osos, standing for "offset offset" is the angular distance from the center of the tooth to where the involute intersects the pitch circle. by subtracting alpha, we determine the angular distance between the center of the tooth and the point of unwinding on the base circle.

filletrad=(basrad/(1.3*N)) % Determines radius for fillet circle

filletradius=(ones(1,thetasize(end)).*(filletrad))+rootrad; %fills in fillet circle matrix.

drawthetabegin=((((filletrad+rootrad).^2)-((basrad).^2)).^(1/2))/(basrad); %determines where the unwrap starts
%drawthetabegin(end)
drawtheta=drawthetabegin:res:((((outrad).^2)-((basrad).^2)).^(1/2))/(basrad); %determines how far the unwrap goes.
%R=(((basrad).^2)+((basrad.*drawtheta(end)).^2)).^(1/2);
  %  beta=atan(((basrad*(drawtheta(end))/basrad)))+alpha
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
xccw=basrad.*(cos(drawtheta(end)+offset+osos)+drawtheta(end).*sin(drawtheta(end)+offset+osos));                       % This is calculated to how far to traw the top land arc.
yccw=basrad.*(sin(drawtheta(end)+offset+osos)-drawtheta(end).*cos(drawtheta(end)+offset+osos));
xcw=basrad.*(cos(-drawtheta(end)+((2*pi)/N)-osos)-drawtheta(end).*sin(-drawtheta(end)+((2*pi)/N)-osos));
ycw=basrad.*(sin(-drawtheta(end)+((2*pi)/N)-osos)+drawtheta(end).*cos(-drawtheta(end)+((2*pi)/N)-osos));

arcstart=atan(yccw/xccw)                                 %BLACK MAGIC
arcend=atan(ycw/xcw)
arc=(arcstart+offset):res:(arcend+offset);
arcsize=size(arc);
plotarc=ones(1,arcsize(end)).*(pitchrad+addendum);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   
for i=1:N,                                    % for each loop, a tooth is drawn.
    %reftheta=0:.01:(N/14.4)*pi/N;
    %drawtheta=reftheta.*4;
     arc=(arcstart+offset):res:(arcend+offset);
   
   if (basrad>filletrad(end))

xccw=basrad.*(cos(drawtheta+offset+osos)+drawtheta.*sin(drawtheta+offset+osos));
yccw=basrad.*(sin(drawtheta+offset+osos)-drawtheta.*cos(drawtheta+offset+osos));
xcw=basrad.*(cos(-drawtheta+offset-osos)-drawtheta.*sin(-drawtheta+offset-osos));
ycw=basrad.*(sin(-drawtheta+offset-osos)+drawtheta.*cos(-drawtheta+offset-osos));

rad=(filletrad+rootrad):res:basrad;
radsize=size(rad);
cwtheta=ones(1,radsize(end)).*(offset-osos);            % for the straight lines
ccwtheta=ones(1,radsize(end)).*(offset+osos);;

cwfillettheta=offset-osos:res:offset-osos+(2*pi/(8.*N));
ccwfillettheta=offset+osos-(2*pi/(8.*N)):res:offset+osos;

filletthetasize=size(cwfillettheta);
cfilletthetasize=size(ccwfillettheta);
%ccwfillettheta=offset+osos:filletsize:(pi/(2.*N));
%fillet=(rootrad:1/filletthetasize(end):rootrad+filletrad);
cwfillet=linspace(rootrad(end)+filletrad,rootrad(end),filletthetasize(end));
ccwfillet=linspace(rootrad(end),rootrad(end)+filletrad,filletthetasize(end));
%filletsize=size(fillet)

% the U denotes under the base circle.
%uxccw=
%uyccw=
%uxcw=
%uycw=     
      
   else
   xccw=basrad.*(cos(drawtheta+offset+osos)+drawtheta.*sin(drawtheta+offset+osos));
yccw=basrad.*(sin(drawtheta+offset+osos)-drawtheta.*cos(drawtheta+offset+osos));
xcw=basrad.*(cos(-drawtheta+offset-osos)-drawtheta.*sin(-drawtheta+offset-osos));
ycw=basrad.*(sin(-drawtheta+offset-osos)+drawtheta.*cos(-drawtheta+offset-osos));   
   
   

   end
   hold on
%axesscale;
%axis([-3 3 -3 3]);
axis square;
polar(theta,pitchradius,'g');
%polar(theta,baseradius);
%polar(beta,outrad);
polar(theta,rootrad);
polar(arc,plotarc);
plot(xccw,yccw);
plot(xcw,ycw);
%plot(uxccw,uyccw);
%plot(uxcw,uycw);
%polar(theta,filletradius)
%plot(uxccw,uyccw);
%plot(uxcw,uycw);
polar(cwtheta,rad)
polar(ccwtheta,rad)
polar(cwfillettheta,cwfillet)
polar(ccwfillettheta,ccwfillet)
   offset=offset+((2*pi)/N);

end


Even with Matlab, I had trouble with a few syntax errors. However, I learned a few new commands, like linspace. I draw a connection between programming and building with legos. It is much easier to build something out of legos when you have an idea of every piece you own in your head. Likewise, I anticipate that a knowledge of data structures and algorithm tricks leads to a better coding experience. I think from here, The proper move is to start from the base with a "C for dummies" type of book and work on learning a language proper.

The next step is to print some of these gears of mine out and see if they really work!

2 comments:

  1. could you share the matlab .m file for 25 teeth 20 degree pressure angle?

    ReplyDelete
  2. my email id is geardyn.1@gmail.com

    ReplyDelete