Experiment 2: Free-Falling Bodies & Optoelectronic Sensors: Ntroduction
Experiment 2: Free-Falling Bodies & Optoelectronic Sensors: Ntroduction
Experiment 2: Free-Falling Bodies & Optoelectronic Sensors: Ntroduction
As shown in Fig. E2-1-1, a ball of mass m initially at an elevation y(0) = y0 is ejected upward with an
initial velocity v(0) = v0 into a Newtonian viscous medium with a damping constant b. (Note: If b equals zero,
the medium is called inviscid.) According to Newton’s law of viscosity, the instantaneous viscous force vector
r
(also called damping force), fb ( t ) , is acting against the motion of the ball and can be expressed as:
r r
Eq. (E2-1-1) fb = −bv ( t )
r
where v ( t ) is instantaneous velocity vector of the ball. Define the upward direction as the positive y-direction
with $j as its unit vector. Then, according to Newton’s second law, we have:
v
bg bg
Here instantaneous acceleration vector of the ball, a t = a t $j , is :
where g is the gravitational constant. Note: A positive (or a negative) a(t) means an acceleration (or a
deceleration) along the positive y-direction. To find the velocity, we have:
⎧inviscid case: dv ( t ) = − gdt → v ( t ) = − gt + C1
⎪⎪
dv ( t ) m
⎨ viscous case: − = dt → − ln ⎡⎣ mg + bv ( t ) ⎤⎦ = t + C1
⎪ b
g + v (t ) b
⎪⎩ m
⎧v0 for inviscid case
⎪
Since, v ( t ) t =0 = v ( 0 ) = v0 , we have: C1 = ⎨ m
⎪⎩− b ln ( mg + bv0 ) for viscous case
bg bg
v
Hence, the velocity vector v t = v t $j becomes:
⎡ 2
⎤ bt
⎪− ⎛⎜ m ⎞⎟ gt − ⎢⎛⎜ m ⎞⎟ g + ⎛⎜ m ⎞⎟ v0 ⎥ e − m + C2
0
for viscous case
⎩⎪ ⎝ b ⎠ ⎢⎣⎝ b ⎠ ⎝ b ⎠ ⎥⎦
⎧ 1 2
⎪ − 2 gt + v0t + y0 for inviscid case
⎪
Eq. (E2-1-6) y (t ) = ⎨
⎡
(⎤
)
2
⎪ − ⎜⎛ m ⎟⎞ gt + ⎢⎜⎛ m ⎟⎞ g + ⎜⎛ m ⎟⎞ v0 ⎥ 1 − e − m + y0
bt
for viscous case
⎩⎪ ⎝ b ⎠ ⎣⎢⎝ b ⎠ ⎝ b ⎠ ⎦⎥
We will consider two special cases in this experiment. The first, which is called the approaching case,
studies a ball falling freely from an elevation y0 with zero initial velocity (i.e., v0 = 0) onto a massive plate,
which can be assumed rigid. The second, which is termed the rebounding case, investigates the rebounding of a
ball from the rigid plate. In this case the ball has a zero initial elevation (i.e., y0 = 0) with an initial velocity
equal to the rebounding velocity. Using Eqs (2-1-4) to (2-1-6) we can summarize the solutions of these two
cases as follows:
⎧ 1 2
⎪− 2 gt + y0 for inviscid case
⎪
Eq. (E2-1-9) y (t ) = ⎨
( )
2
⎪− ⎛ m ⎞ gt + ⎛ m ⎞ g 1 − e −bt m + y
⎪⎩ ⎜⎝ b ⎟⎠ ⎜ ⎟ 0 for viscous case
⎝b⎠
⎧ 1 2
⎪ − 2 gt + v0t for inviscid case
⎪
Eq. (E2-1-12) y (t ) = ⎨
⎡
(⎤
)
2
⎪ − ⎜⎛ m ⎟⎞ gt + ⎢⎜⎛ m ⎟⎞ g + ⎜⎛ m ⎟⎞ v0 ⎥ 1 − e − M
Bt
for viscous case
⎩⎪ ⎝ b ⎠ ⎣⎢⎝ b ⎠ ⎝ b ⎠ ⎦⎥
Consider the inviscid approaching case. From Eq. (E2-1-9) we can determine the time ta required for
the ball, which is falling freely from an elevation ya, to hit the ground as:
ME 31100: FUNDAMENTALS OF MECHATRONICS STUDENT LABORATORY GUIDE
EXPERIMENT 2: FREE-FALLING BODIES & OPTOELECTRONIC SENSORS Page 4/16
1
y ( ta ) = 0 = − gta2 + y0 , or
2
2 ya
Eq. (E2-1-13) t a =
g
From Eq. (E2-1-8), the corresponding particle velocity just before the ball hits the ground is then given by:
2 ya
va = v ( ta ) = − gta = − g , or
g
Next, consider the frictionless separation case. From Eq. (E2-1-11) we can determine the time tr
required for the ball, which is rebounding from a rigid floor with an initial velocity of vr, to reach the maximum
height as:
v ( tr ) = 0 = − gtr + vr , or
vr
Eq. (E2-1-15) tr =
g
From Eq. (E2-1-12), the corresponding maximum elevation is given by:
2
1 1 ⎛v ⎞ v
yr = y ( tr ) = − gtr2 + vr tr = − g ⎜ r ⎟ + vr r , or
2 2 ⎝g⎠ g
1 vr2
Eq. (E2-1-16) yr =
2 g
When the ball falls in a viscous medium, one can prove easily that there exists a maximum velocity,
which is called the terminal velocity vt. Assuming the particle starts from rest, with the aid of Eq. (E2-1-8) we
can prove easily that:
(
⎡ m
) ⎤ ⎛ m ⎞ ⎛ m −bt ⎞ m m
vt = lim v ( t ) = lim ⎢ − g 1 − e m ⎥ = lim ⎜ − g ⎟ + lim ⎜ ge m ⎟ = − g + g lim e m , or
t →∞ t →∞
⎣ b
−bt
⎦ t →∞ ⎝ b ⎠ t →∞ ⎝ b ⎠ b b t →∞
− bt
( )
m
Eq. (E2-1-17) vt = − g
b
Again, the negative sign implies that the particle travels downward. It can also be shown easily from Eq. (E2-1-
8) that if the particle falls from rest, it takes approximately:
5m
Eq. (E2-1-18) tt = 5τ =
b
for the particle velocity to reach within 1% of the terminal velocity vt. Here,
m
Eq. (E2-1-19) τ =
b
ME 31100: FUNDAMENTALS OF MECHATRONICS STUDENT LABORATORY GUIDE
EXPERIMENT 2: FREE-FALLING BODIES & OPTOELECTRONIC SENSORS Page 5/16
When two particles collide without loss of energy, the impact is said to be perfectly-elastic. If there is
a loss of energy, the collision is said to be plastic. The coefficient of restitution, e, is a measure of the elasticity
(or equivalently, the plasticity) of the collision; a value of 1 indicates perfectly-elastic collision whereas a value
of zero implies perfectly-plastic collision. The coefficient of restitution is defined by the following expression:
relative separating velocity v′ − v′
Eq. (E2-1-20) e = = 2 1
relative approaching velocity v2 − v1
where vi and vi′ (i = 1,2) are the approaching and separating velocities of the particle i (i = 1,2). In our
experiment, the velocities of the massive aluminum base, v2 and v2′ , can be taken as zero. Hence the relative
approaching and separating velocities are the approaching and rebounding velocities, va and vr, respectively.
Thus Eq. (E2-1-20) reduces to:
Eq. (E2-1-21) e =
( first ) rebounding velocity = vr
( first ) approaching velocity va
If the free-falling and rebounding processes are inviscid, then by combining Eqs (E2-1-14), (E2-1-16)
and (E2-1-21) one can verify easily that the initial drop height ya and the first rebound height yr can be related
by:
Eq. (E2-1-22) e =
( first ) rebounding height =
yr
( first ) approaching height ya
E2-2 OBJECTIVES
The objectives of this experiment are:
(1) To use optoelectronics-based emitter-detector sensors to record the motion of free-falling balls - using both
MATLAB and LabVIEW;
(2) To apply polynomial regression analysis to fit recorded data for position vs time and velocity vs time curves
and to compare the experimental results with those predicted by theory of particle dynamics.
sensor pair, called Sensor 0, is 2¼” away from the top opening of the guide rails. Thus, the total height of the
guide rails is 17½”.
Figure E2-3-2 shows the circuit for a typical emitter-detector pair. If there is no incident light on the
phototransistor, then no current will flow through the output circuit; thus the position of a ball between the
guide rails can be determined by measuring the voltage levels in the output side of the detector circuits. As the
ball falls between the guides, the optical paths between the emitter-detector pairs are interrupted sequentially,
causing changes in output voltages. Each of the detectors has been connected to one channel of the National
Instruments SCB-68-board so that the voltage change can be recorded with a PC. In this experiment, three balls
will be used. They are:
(1) a tennis ball, which is green-yellow and has a diameter of approximately 64.8 mm (or 2.55”), a mass of
approximately 54.8 g, and a relatively rigid surface with a felt-like texture;
(2) a racquet ball, which is blue and has a diameter of approximately 55.9 mm (or 2.2”), a mass of
approximately 40.2 g, and a moderately smooth surface which seems to be easily deformable;
(3) a ping-pong ball, which is white and has a diameter of approximately 38.1 mm (or 1.5”), a mass of
approximately 2.8 g, and an extremely smooth surface (Because of its light weight, this make ping-pong ball
buoyant easily).
Question: Why use infrared rather than visible light LED’s?
Answer: First of all, infrared LED’s give more illumination for less current (longer wavelength, lower
frequency). Secondly, fluorescent lights (like those in the laboratory) emit very little infrared (this is
contrary to the emission from incandescent bulbs). Thus there is little possibility of interference with
the signal from ambient fluorescent lighting.
USING LABVIEW:
(1) Double-click on the icon Free Fall on the desktop to start LabVIEW for this experiment.
(2) The screen that pops-up before you is called the front panel. On this screen make sure that the channels
range from 0 to 7; the trigger channel is 0; and the trigger level is 1.
(3) Right click within the graph to clear the Free Fall graph on the front panel. Scroll down to Data
Operations then left click on Clear Chart.
(4) Place the tennis ball at the entrance of the ball guide.
(5) Left-click the Run button on the toolbar of the front panel. Figure 2-4-1 shows sample results of the
free falling experiment.
(6) Save the filename in a text format, for example ball.txt, that will permit future analysis.
(7) Immediately drop the tennis ball through the guides. Care should be taken to ensure that the ball is
dropped freely; that is, no initial velocity v0 is exerted when the ball is released.
(8) Repeat Steps (4) to (8) for the racquetball and the ping-pong ball.
Figure E2-4-1. Sample results showing the NI-LabVIEW front panel of the free-fall.VI.
USING MATLAB:1
We can see in the appendix that the block diagram for the data acquisition using LabVIEW is quite complicated
and hard to follow. One of the benefits of the Data Acquisition Toolbox is that it is possible to see in detail the
finer points of data acquisition. From the front panel of the LabVIEW VI, we can define the requirements of
what the MATLAB counterpart should be able to do. As with the Skin Temperature Measurement activity, we
will look a little deeper into the way data is acquired.
i. The first part of any program is to ensure that there are no variables in the memory, and then initialize
any drivers needed for the software to communicate with the hardware. This is the analog input object –
it contains the drivers necessary for MATLAB® to interface with the software.
ii. Once the analog input object is created, we will refer to the functional details of the LabVIEW
counterpart to define the parameters of the data acquisition.
ch =addchannel(ai, [0:7]);
1
An annotated copy of this data acquisition code is provided in the Appendix
ME 31100: FUNDAMENTALS OF MECHATRONICS STUDENT LABORATORY GUIDE
EXPERIMENT 2: FREE-FALLING BODIES & OPTOELECTRONIC SENSORS Page 9/16
set(ai,'ChannelSkewMode', 'Minimum');
duration = 6;
ActualRate = 8000;
set(ai, 'SampleRate', ActualRate / 8);
TotalSamples = duration * ActualRate / 8;
set(ai,'SamplesPerTrigger', TotalSamples);
iii. The program should have the ability to record data prior to the ball passing through each sensor so that
we will have a basis of comparison. This is the pre-trigger.2
iv. A trigger is introduced so that we should be able to record the phenomenon, as it meets a criterion that
we set beforehand.
v. Real-time display of data acquired during the procedure is a must. It is a waste of time if data is
collected but the phenomenon we are looking for is not in it. As an extra feature, the plot window will
pop up to full screen size.
start(ai);
while strcmp(ai.Running, 'On')
while ai.SamplesAcquired < ai.SamplesPerTrigger
data = peekdata(ai, ai.SamplesAcquired);
set(P1,'ydata',data(:,1));
set(P2,'ydata',data(:,2));
set(P3,'ydata',data(:,3));
set(P4,'ydata',data(:,4));
set(P5,'ydata',data(:,5));
set(P6,'ydata',data(:,6));
set(P7,'ydata',data(:,7));
set(P8,'ydata',data(:,8));
set(T,'String',[sprintf('Samples Acquired: '),...
num2str(ai.SamplesAcquired)]);
drawnow
end
end
vi. Run the program by pressing either F5 or the run button located below the menu bar. When the plot
pops up showing the actual data from the data acquisition card, pay attention to the title. It changes with
time, indicating how many samples it has already acquired. You may drop the ball once it indicated that
200 samples have been collected. At the end of the data acquisition, the data is saved to an ASCII-
format tab-delimited file, for future analysis.
data = getdata(ai);
save 'freefall.dat' data -ASCII -tabs
vii. In this instance, the data file where the data is saved is called ‘freefall.dat’. Please remember to either
change the code to indicate a new file or copy the data file to another location before it gets rewritten.
Once the program is complete, the analog input object is no longer running and has to be cleared from
memory.3
delete (ai)
clear ai
viii. The first step of any program is to ensure that it runs as it is supposed to. You may experiment with
the sensors themselves, and see the change in voltage on the screen, as you pass objects across the path
of each, individual sensor. When you do this, note how the plot changes accordingly. You may also
change the sampling rate (the ActualRate variable), so that you may observe the effects of higher
sampling rates on the real-time plots. Below is a sample of results showing the real-time plot in
MATLAB®:
3
Please note that if the program does not run properly, and data is not collected, the memory should not be cleared immediately. If the
object is no longer in the workspace, the program can not be run again, since there is already an instance of it. It can not be stopped,
either, since the analog input object, and thus the drivers permitting the interface are no longer present for MATLAB® to use. To
clear this, you must close the MATLAB® program, and start it up again.
ME 31100: FUNDAMENTALS OF MECHATRONICS STUDENT LABORATORY GUIDE
EXPERIMENT 2: FREE-FALLING BODIES & OPTOELECTRONIC SENSORS Page 11/16
E2-5 REPORT
The final report of this experiment is expected to include at least the following items:
(1) With the three sets of voltage-time data of the eight proximity sensors, tabulate the position vs time histories
of the three balls. Assume frictionless, use the 2nd-degree polynomial equation:
Eq. (E2-5-1) bg
y t = a0 + a1t + a2 t 2
and the least-square regression technique to fit the first approaching and the first separation curves of the three
balls. Estimate:
(i) the difference in time between the moment when a ball was released and the instant when the data
acquisition started for all the ball;
(ii) the initial heights, y0, when the balls were dropped and the first rebounding heights, y1, that the balls
had reached for all three balls, respectively (Note: Because of the hand position when the ball was
released, the initial height might not be the height of the ball guide.);
(iii) the first approaching and rebounding velocities, va and vr, of the three balls, respectively;
(iv) the coefficients of restitution, e, of the three balls using Eqs (E2-1-21) and (E2-1-22), respectively.
Determine if the collisions were elastic or plastic?
(2) Plot and compare in the same graph the theoretically-predicted and experimentally-determined position vs
time histories for each ball.
(3) The theoretically-predicted velocities can be obtained by differentiating Eq. (E2-5-1). Plot and compare in
the same graph the theoretically-predicted and experimentally-determined velocity vs time histories of each
ball. Try to determine the velocities from experimental data using various techniques, such as those you
learned in Homework #7: Optoelectronic Sensors - High-Speed Measurement. Explain which
technique you think may be the most accurate.
(4) Determine what attributes of these three balls may have caused the differences in the time histories of
position and velocity among the three balls.
(5) Can you use the viscous model, as shown in Eqs (E2-1-7) to (E2-1-12), to estimate the viscous damping
constants, b, of the three balls. Once the b’s are obtained, determine if the inviscid model is still valid for
each ball. What would be the corresponding terminal velocities, vt, and how high would the track have to be
to allow the balls to reach 99% of their terminal velocities? What are the sources of friction and viscosity?
Can they be minimized? Can you propose a different mathematical model for the friction? If so, can you
calculate the values for the parameters of your new model?
(6) We see from the MATLAB® code that the input types from the sensors are of the single ended non-
referenced type. Why is this so? Is this better than using a differential input type? Is there a difference
between the two, and how does this affect the data acquisition?
(7) Though the sample rate for this experiment was set at 8000 samples per second, it can arbitrarily be set for
almost any value. However, for this experiment, there is a minimum sampling rate. What is it, and how is it
determined?4
E2-5 APPENDIX
The following is the block diagram of the free-fall.VI:
4
HINT: This involves the balls velocity and the distance between sensors
ME 31100: FUNDAMENTALS OF MECHATRONICS STUDENT LABORATORY GUIDE
EXPERIMENT 2: FREE-FALLING BODIES & OPTOELECTRONIC SENSORS Page 13/16
Figure E2-5-1. Sample results showing the NI-LabVIEW block diagram of the free-fall.VI.
%--------------------------------------------------------------------------
% 1. Set up the data acquisition
% Initialize handle for analog input - board is device 1 on computer
ai = analoginput('nidaq',1);
%Set channel skew mode - the time delay between scanning different
%channels - minimum would set it to smallest possible value supported
%by hardware
set(ai,'ChannelSkewMode', 'Minimum');
ChSkew = ai.ChannelSkew
%Because max sample rate of board is rated for one channel, divide the
%sample rate by the number of channels to be scanned, in this case - 8
set(ai, 'SampleRate', ActualRate / 8);
%The total number of samples would be the sampling rate times the duration
%of the sampling
TotalSamples = duration * ActualRate / 8;
%With the sampling rate, set the number of samples to take per trigger
set(ai,'SamplesPerTrigger', TotalSamples);
%Insert trigger here to start acquiring data - specify the channel where
%the trigger is to be used
set(ai, 'TriggerChannel', ch(1));
%0, the first channel for Nat'l Instr. boards. In this matrix for the
%channel the first index is for the first channel
set(ai, 'TriggerType','Software');
%Set the conditions which will trigger/start data logging - 'Rising' means
%having a positive slope as it passes through the value
set(ai, 'TriggerCondition', 'Rising');
set(ai, 'TriggerConditionValue', 1);
%Now, to set up the plot to display the data in real time. When the program
%is running, we want the figure to open up full screen, so first we
%determine the size of the screen
scrsz = get(0, 'ScreenSize');
subplot(811), P1 = plot(zeros(TotalSamples,1));
axis([0 TotalSamples -5 5]);
subplot(812), P2 = plot(zeros(TotalSamples,1));
axis([0 TotalSamples -5 5]);
subplot(813), P3 = plot(zeros(TotalSamples,1));
axis([0 TotalSamples -5 5]);
subplot(814), P4 = plot(zeros(TotalSamples,1));
axis([0 TotalSamples -5 5]);
subplot(815), P5 = plot(zeros(TotalSamples,1));
axis([0 TotalSamples -5 5]);
subplot(816), P6 = plot(zeros(TotalSamples,1));
axis([0 TotalSamples -5 5]);
subplot(817), P7 = plot(zeros(TotalSamples,1));
axis([0 TotalSamples -5 5]);
subplot(818), P8 = plot(zeros(TotalSamples,1));
xlabel('Samples'), axis([0 TotalSamples -5 5]);
subplot(811)
T = title([sprintf('Samples Acquired: '), num2str(ai.SamplesAcquired)]);
%Note that we're using a y-axis range of -5 to 5 because we expect the
%input to fall within that range only
%--------------------------------------------------------------------------
% 2. Acquiring pre-trigger data
%To acquire pre-trigger data, we have to pre-determine how many samples or
%how much time is used for the pre-tigger.
%To set the pre-trigger, we have to use the 'TriggerDelay' property with a
%negative value.
set(ai, 'TriggerDelayUnits', 'Samples')
set(ai, 'TriggerDelay', -200);
%In this case, we set a pre-tigger of 200 samples prior to the
%trigger to be recorded. However, this means that we have decreased the
%number of samples to be saved in memory after the trigger.
%--------------------------------------------------------------------------
ME 31100: FUNDAMENTALS OF MECHATRONICS STUDENT LABORATORY GUIDE
EXPERIMENT 2: FREE-FALLING BODIES & OPTOELECTRONIC SENSORS Page 16/16
%--------------------------------------------------------------------------
% 4. Display the data
figure
dat = load('freefall.dat');
for i = 1:size(dat(:,1))
x(i) = (ai.TriggerDelay + i) / ai.SampleRate;
end
for i = 1:4
subplot(8,1,i), plot(x, dat(:,i));
ylabel('Voltage');
subplot(8,1,i+4), plot(x, dat(:,i+4));
ylabel('Voltage');
end
xlabel('Time (sec)')
%--------------------------------------------------------------------------
% 5. Cleaning up - The analog input object must be stopped before it can be
% started again, or else there will be problems re-running the program from
% the beginning if it is stopped in the middle. If this happens, you will have to
% exit and restart the MATLAB environment
delete (ai)
clear ai
ME 31100: FUNDAMENTALS OF MECHATRONICS STUDENT LABORATORY GUIDE