Difference between revisions of "Projectile Launcher"

From ENGR005 2008
Jump to: navigation, search
(Programming)
Line 37: Line 37:
  
 
::end
 
::end
 +
 +
I used this program to check that the servo wasn't crooked (which it was--notice that 1 is subtracted from theta when it is translated to pw) and to collect data later on in the experiment.
 +
 +
Next, I wrote a similar function which took a range as input and calculated the needed launch angle, sending it to the servo in the same manner as above. The calculations were based on the equation:
 +
::theta = 180/pi*(.5*asin(9.81*r/(v^2)))
 +
derived from equations describing projectile motion (with angles in degrees).  This program did not work--or, would have required a far more precise apparatus and many small adjustments to work properly. It would also have required a very exact calculation of the launch velocity. As it was, there were too many variables, and the ball consistently missed the target when this program was used.
 +
 +
I then
  
 
[[Image:Range_vs._Angle.JPG]]
 
[[Image:Range_vs._Angle.JPG]]

Revision as of 01:00, 11 December 2008

This is the page for Frances Hunter's final project.

Motivation

To apply the concepts of projectile motion to a practical situation. Also, it seemed like a cool idea.

Design

The main component of my project is a projectile launcher attached to a servo. The launcher is powered by a spring (compressed to the same distance each time to produce a consistent initial velocity) and loaded with a small metal ball. The servo is connected to a Matlab program which, given the range from the target, turns the launcher to the correct angle. With no variation in initial velocity, the range will be dependent on the launch angle. The spring is then released by hand.

Launcher

Diagram.jpg

A diagram of the inside of the launcher is shown above. The spring is secured at one end of the tube by a screw passing directly through its coils. The other end is hot-glued to a metal plug of the same diameter as the inside of the tube. To load the launcher, one compresses the spring using a wooden rod and secures it by pushing a nail through a hole in the plug lining up with two holes in the side of the tube. The ball rests against the flat side of the plug until the nail is pulled out, launching the ball. The launcher is attached to the servo with strong double-sided tape (the kind used for wall hooks) and secured with string.

Programming

I ultimately wrote three programs for the launcher. The first simply translates an angle defined by the user to pulse widths and sends it to the servo. Its code is below:

function [theta] = angle_test(theta)
s=instrfind; %Find any serial links (we can have only 1)
delete(s); %... and delete.
%Create a new serial communications link
s=serial('COM1','Baudrate',115200,'Terminator','CR');
fopen(s); %... and open it
pw = ((90-theta-1)+61.884)/.10103;  %Translates angle to pulse widths
ch=1;  %Defines channel
cmd=['#' num2str(ch) 'P' num2str(round(pw)) 'T' num2str(200)];
%creates command string from given variables
fprintf(s,cmd);  %Sends the command to serial link.
end

I used this program to check that the servo wasn't crooked (which it was--notice that 1 is subtracted from theta when it is translated to pw) and to collect data later on in the experiment.

Next, I wrote a similar function which took a range as input and calculated the needed launch angle, sending it to the servo in the same manner as above. The calculations were based on the equation:

theta = 180/pi*(.5*asin(9.81*r/(v^2)))

derived from equations describing projectile motion (with angles in degrees). This program did not work--or, would have required a far more precise apparatus and many small adjustments to work properly. It would also have required a very exact calculation of the launch velocity. As it was, there were too many variables, and the ball consistently missed the target when this program was used.

I then

Range vs. Angle.JPG

Materials

- Servo with connecting cords

- Matlab

- Spring, plug, and loading rod

- Nail

- Plastic tubing

- Metal ball

- Assorted screws, string, and double-sided tape

- Target (piece of paper)

Evaluation

Timeline

Week of 11/17: Collect materials; plan exact design; solve physics that will underlie the Matlab program.

Week of 11/24: Construct launcher and determine initial velocity; write Matlab code.

Week of 12/1: Mount launcher on the servo and frame; debug.