Using an Arduino with IR Phototransistors and IR LEDs to analyze the relationship between the pressure of a Pneumatic Cannon and Velocity of a Tennis Ball



Jorge Reyes




Table of Contents

Go Up



     Statement of problem                                                                  



     Experimental set up                                                                    







     Error and Improvements                                                           


Related Websites                                                                                   



Background .:. Top

In modern day society, people commonly use pneumatic cannons, also known as air cannons, as a recreational tool along with its companion the spud gun. They are loaded with a variety of projectiles which include objects such as potatoes, tennis balls, and even soda cans. The significant difference between spud guns and pneumatic cannons is that spud guns use a combustible gas such as hairspray and ignite it to cause an expansion in gas and launch the projectile. In pneumatic cannons, air is stored and then released to launch the projectile. The use of air cannons, however, is not just limited to recreational uses because they are also utilized in useful ways. Some individuals specialize in making air cannons that launch tennis ball with a wire attached to them and use this wire to raise up an antenna and set up ham radio systems(Pneumatic Antenna Launchers). The pneumatic cannon has also recently seen use in law enforcement as law enforcement officers shoot magnetic gps trackers onto cars using pneumatic cannons(Hickey). Although pneumatic cannons aren’t utilized in the industry to commonly, the concepts behind these cannons can always be seen being applied to other mechanisms such as nail guns.

The range of a projectile launched out of a pneumatic cannon is highly dependent on several factors. The first set of factors is design related as multiple key components make up the pneumatic cannon which are the tank where the air for the launching of the projectile is stored, the sprinkler valve which allows that tank’s pressurized air into the next component which is the barrel which is where the projectile is pushed by pressurized air through a certain length. Each of these three components has several variables to it. The tank can be pressurized to a certain measure of pressure which in this case will be psi (pounds per square inch). The sprinkler valve can be electronically set to open for a specific amount of time which will be measured in milliseconds thus controlling amount of time air travels into the barrel. The barrel can be cut to a certain length and each length will grant the projectile a unique range.

Pressure is a significant factor because pressure exerts force on the projectile and therefore makes the projectile travel faster. Air pressure in a cannon works essentially the same as water pressure commonly seen around a house. For example in water hose, with a small pressure the water will pour out slowly but with larger pressures the water will speed out. Air in a cannon also acts like water in a hose.

Aside from the characteristics of the cannon itself, there are other factors that affect object trajectories. The angle of elevation will affect the range and the other factor will be air resistance. Especially for lighter objects such as tennis balls, air resistance will play a bigger role in the range and therefore is important to consider.


Statement of Problem.:. Top

The purpose behind this investigation it to determine the role air pressure plays in the initial velocity of a projectile shot out of a pneumatic cannon.

Hypothesis .:. Top

I believe that the higher the pneumatic cannon air reservoir is pressurized, the faster the speed of the tennis ball shot out of the barrel will be. It is predicted that a graph with pressure as the independent variable and projectile velocity as the dependent variable will show a linear increase because the tennis ball will form a seal in the cannon barrel which will cause the tennis ball, barrel, and air to act as a pneumatic cylinder. The controlled variables in this experiment will be the barrel length and the distance at which the velocity is tested with the IR sensors. The equation F=PXA where F is force, P is pressure, and A is area will effectively model this linear trend in the graph.  


Experimental Set up.:. Top



In order to calculate an accurate value of the velocity of a projectile leaving a cannon, many variables had to be eliminated. This investigation solely focuses on the relationship between pressure and velocity. The diagram below demonstrates the experimental set up for this investigation. There are two mounts in this set up. One holds the air cannon and another holds the constructed chronograph. The cannon lies parallel to the floor and its angle is not adjustable. The cannon is powered by connecting the 24 volt solenoids on the sprinkler valves to 3 9 volt batteries. The cannon fires a tennis ball wrapped in a towel which ensures a proper seal. It is hooked up straight to a compressor which allows for quick refilling The other mount holding the chronograph is a slightly more complex setup. On the top horizontal piece of wood, there are two holes at the ends which are represented by the red circles. What cannot be visualized in the diagram is that there are two sides which means that there are two of these pieces of wood separated by about 18 inches. On one side are infrared (IR) LEDs shining light across onto the other piece of wood which holds IR photoresistors.  There are two pairs of these devices. When the ball crosses through and blocks the first light, it initiates a stopwatch and when it crosses through the second it ends the time. These LEDs and phototransistors are controlled by a programmed arduino and hooked up via USB to a laptop which displays the calculated velocity by dividing the distance between the IR phototransistors by the time it took for the tennis ball to cross the IR phototransistors. This investigation was done indoors so a tennis ball trap was needed. It was found that using cushions with a box in front of them (side closest to cannon) and a wall behind the cushions works very effectively. This set up allows for extremely accurate velocity data because it eliminates the variables of angle, human reaction time, air friction, and other variables which contribute to to uncertainty.


Materials.:. Top


1.       Cannon

       4 inch ABS cap

       4 inch X 2 feet long ABS tube

       4 inch X 2 inch ABS reducer

       2 X 1 ½  inch ABS bushing

       1 ½ X 1 in PVC bushing

       Approximately 1 X 8 in PVC tube

       1 in PVC male adapter

       1 in threaded PVC 90 degree elbow

       1 X 2 in PVC bushing

       2 X 3” ABS bushing

       3 in 90 degree vent ABS elbow

       3 in X 4 ft ABS tube

       1” Inline Sprinkler Valve

       Pressure Gauge

       ¼” Brass Coupler to attach air hose

       Compressor with regulator

2.       Chronograph

       2 IR LEDs

       2 IR phototransistors


       1K Resistors


       USB Cable (same one printers use)

       Breadboard and Soldering Iron (optional)

3.       Mounts

       2X4 Wood (2 lengths of 8 feet)

4.       Tools

       Hand Drill

       Drill Bits



Procedure.:. Top


1.       First the tennis ball is wrapped with a 8 inch diameter circular piece of towel and the ends are tied

2.       Using a long rod, the tennis ball is pushed into the barrel of the cannon and the rod is set aside

3.       The IR LEDs are powered on and the code is loaded onto the Arduino which controls the sensors and is also hooked to a computer

4.       The Arduino screen, called the Serial Monitor, that displays data is pulled up and should be blank

5.       Hose is hooked up from compressor to cannon and knob on regulator is adjusted to desired pressure

6.       Double check pressure on pressure gauge on cannon

7.       Cannon, which is parallel to ground is aligned so that the ball travels through the center of the chronograph and does not hit any of the structure

8.       Solenoid is then powered with the 3 9 volt batteries

9.       Tennis ball will shoot through the chronograph and into the trap

10.   Serial Monitor on computer will display projectile velocity

11.   Record the velocity under the pressure that was utilized

12.   Repeat process until all desired data is collected


Data.:. Top

Pressure (PSI)

Average Velocity (m/s)

Uncertainty (m/s)


























Data file: text .:. Excel



This is a trend that shows the pressure vs velocity data collected throughout the investigation.


This graph demonstrates that there is a clear linear trend across the acquired data points.

Evaluation.:. Top

The hypothesis that with an increase in air pressure, the velocity of the tennis ball leaving the cannon will linearly increase is very well supported by the data acquired. After 5 different trials at each of the 9 different pressures, the linear trend is evident through graphs. A linear line was inserted into the graph by using Excel and is shown in the graph above with an R² value of .986 which signifies that this line formulated by Excel has an extremely strong correlation with the data points. Using this R², it can be concluded that the function of pressure vs velocity is a linear function. The second part of the hypothesis that stated that the function will be able to be represented by the equation F=P*A  is also very justifiable by the data. Increased force,  F,  should translate into faster velocities and would occur when more pressure P is applied and this is exactly what happens thus a tennis ball in an air cannon acts the same way a piston in a cylinder would act. In the graph with the trend line it can also be noted that the y-intercept is 18.17. While it might sound ludicrous that the tennis ball will have an exit velocity of 18.17 m/s when 0 pressure it applied, it is not so because it does not reflect this situation. What it most likely represents is the pressure zone between 0 to apprximately 15 psi where there is not enough pressure to move the tennis ball so it builds up behind the ball. It demonstrates that at some point in this pressure zone the buildup of pressure allows the tennis ball to have enough force behind it to propel forward and overcome static friction. Theoretically, if more pressure is continued to be added into the cannon, the velocity of the tennis ball will only increase linearly. This experiment accomplished the task of demonstrating that the function of pressure vs tennis ball velocity is a linear trend  that acts exactly like a piston.  There have been other similar experiments but most utilize range as a means to solve for velocity. This introduces the huge variable of air friction which will strongly affect data and since air resistance is directly proportional to velocity, the graph will probably demonstrate a curve with a downwards concavity. This causes these types of experiment to fail to truly demonstrate the relationship between pressure and velocity and was the main motivator to attempt to eliminate the unnecessary variables in this successful investigation.

Error and Improvements.:. Top

         With all experiments there is always a place for improvement. This experiment although it eliminated many variables and used sensors to produce very accurate and  precise data, also has some areas it could be improved on. Throughout the experiment the solenoids were powered by pressing the wires of the solenoid onto the leads of the connected 3 9 volt batteries. It would have been better if the solenoids were also controlled by the arduino which guarantee the solenoids opened up exactly the same way every time. One aspect of the experiment that might be considered a flaw is that the same ball was used throughout all the testing. Even though there was a cushioned platform to stop the ball, it might have potentially slightly deformed throughout the investigation and if it did, it will have affected its seal with the barrel. A deformed ball could have differing pressures behind it which could lead to differing velocities. A simple solution to this problem is to make a better cushion to stop the ball which will prevent any possible deformation. If a digital regulator was used in place of the current regulator, it would have a pressure gauge on it that would be more accurate and help reduce any uncertainties in the experiment. Another thing that was not considered in this experiment is the effect different temperatures of air had on the pressure and velocity. A wiser thing to do in the future would be the have a thermometer and try to take trials during the same times of the day when the temperature is the same. The same thing is applicable to atmospheric pressure conditions as these  might also affect results. Atmospheric pressure conditions do not play a substantial role in this experiment however because the experiment was conducted indoors which should imply that there was a fairly constant air pressure inside.



Related Websites
.:. Top Describes the physics of the trajectory of projectile An air cannon that launches pumpkins Describes the general details of the airflow of a cannon Describes the flow of energy in a cannon A website that explains air cannons



Bibliography.:. Top

"Characteristics of a Projectile's Trajectory." Characteristics of a Projectile's Trajectory. PhysicsClassroom, n.d. Web. 12 Dec. 2015. <>.


 "Connect a Phototransistor to Arduino - The Robotronics." 3. Connect a Phototransistor to Arduino - The Robotronics. Robotronics, n.d. Web. 11 Nov. 2014. <>.


"FAQ - Frequently Asked Questions." Pneumatic Antenna Launchers. Antenna Launchers, 4 July 2013. Web. 11 Nov. 2014. <>.


Hickey, Kathleen. "Police Fire GPS 'cannon' to Track Suspects, Reduce Car Chases -- GCN." Police Fire GPS 'cannon' to Track Suspects, Reduce Car Chases -- GCN. Government Computer News, n.d. Web. 15 Dec. 2014. <>.


"How To Build a Generic Air Cannon." Instructables, 23 Mar. 2013. Web. Nov.-Dec. 2015. <>.


"Pneumatic Air Cylinders - Force Exerted." Pneumatic Air Cylinders - Force Exerted. EngineeringToolbox, n.d. Web. 15 Dec. 2014.