# Difference between revisions of "Projectile Launcher"

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

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

## Materials

- Servo with connecting cords

- Matlab

- Nail

- Plastic tubing

- Metal ball

- Assorted screws, string, and double-sided tape

- Target (piece of paper)

## 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.