Arduino Break Beam Gravity
GOAL: Measure acceleration due to Earth's gravity using Arduino microsecond timer circuit
- Drop a ball at L = 10, 20, 30, 15, 25 inches 5x each.
O -> ball at L height
|
|
(L-4) inches
|
|
+ -> sensor 1
| -> 4 in
+ -> sensor 2
Measure time in microseconds to fall between sensor 1 and sensor 2 when it breaks the light beam.
RESULT: my estimate is
. This is within 3% of true value. Air resistance probably affected my estimate.OVERALL RESULT: you can use an Arduino Uno micro-second timer circuit to accurately estimate acceleration due to gravity.
================================
Data
The data right of the serial port:
--- Miniterm on /dev/ttyS4 9600,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
setup
elapsed_time 54112
elapsed_time 52152
elapsed_time 51488
elapsed_time 51888
elapsed_time 50536
elapsed_time 36364
elapsed_time 35464
elapsed_time 35548
elapsed_time 33984
elapsed_time 36768
elapsed_time 27836
elapsed_time 28036
elapsed_time 27056
elapsed_time 28044
elapsed_time 28972
elapsed_time 39532
elapsed_time 40480
elapsed_time 38668
elapsed_time 41200
elapsed_time 44512
elapsed_time 29268
elapsed_time 30200
elapsed_time 28488
elapsed_time 30252
elapsed_time 29868
================================
What Do the Laws of Physics Say Should Happen?
# newton's lawForce of earth (
) gravity at surface on object with mass M. The acceleration is for any mass!Knowing the acceleration g we can get the velocity and position by integrating twice.
Starting at height L, 0 velocity and triger sensors S apart:
fall L-S to sensor1 in t1 to v1.
fall S to sensor2 with initial velocity v1 in time t2
# from x equation # rearrange: time to get to sensor 1 # velocity at sensor 1 from v equation # substitute t_1 from a above # simplify
# sensor fall S with initial v1 using x equation # rearrangequadratic formula
. . . # positive root, time has to be positiveSubstitute v1:
RESULT: t_2 is the calculated time as measured by sensors S apart falling from a height of L
================================
Statistical Data Analysis
Pull the data into R
# observed sensor times in microseconds
t = c(54112, 52152, 51488, 51888, 50536, 36364, 35464, 35548, 33984, 36768, 27836, 28036, 27056, 28044, 28972, 39532, 40480, 38668, 41200, 44512, 29268, 30200, 28488, 30252, 29868)/1.0E+06
# the heights the experiment was performed at
l = c(rep(10,5),rep(20,5),rep(30,5),rep(15,5),rep(25,5))
S=4
myx = (sqrt(l)-sqrt(l-S)) # what the linear model inputs. t2 equation
# make a linear estimate of the relationship (least squares: t = A*myx+B)
mylm = lm(t ~ myx)
summary(mylm)
Residuals:
Min 1Q Median 3Q Max
-0.0021731 -0.0007420 -0.0003242 0.0008086 0.0037078
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.0001866 0.0012439 0.15 0.882
myx 0.0730061 0.0023870 30.58 <2e-16 ***
# make a linear estimate of the relationship forcing 0 intercept
mylm = lm(t ~ myx+0)
summary(mylm)
Residuals:
Min 1Q Median 3Q Max
-0.0021436 -0.0007521 -0.0003316 0.0008306 0.0037004
Coefficients:
Estimate Std. Error t value Pr(>|t|)
myx 0.0733548 0.0005332 137.6 <2e-16 ***
RESULT: the empirical constant estimate is between 0.0730 and 0.0733:
From model:
inches/s/s # 1 m = 39.37 inchesTrue:
RESULT: My estimate of the acceleration due to gravity 9.5 m/s^2 is within 3% of the true value 9.8 m/s^2. Air resistance?
Plot data
# what the model predicts given correct constants
S=4
modelTgivenL = function(L){
gtrue = 9.8*39.37 # inches/s^2
return(sqrt(2/gtrue)*(sqrt(L) - sqrt(L-S) ))
}
modelEstTgivenL = function(L){
constestimate = 0.0733 # from linear fit
return(constestimate*(sqrt(L) - sqrt(L-S) ))
}
png("drop.png",width=1024,height=1024)
plot(t ~ l,pch="x",xlab="L height",ylab="sensor time",cex=2)
points(seq(10,30), modelTgivenL(seq(10,30)),type="b", col="red",cex=2)
points(seq(10,30), modelEstTgivenL(seq(10,30)),type="b", col="green",cex=2)
title("drop times. black=measured red=model green=estimated model")
dev.off()
RESULT: modeling and empirical data line up pretty well. Times are a bit high for 20 inches (did I consistently hold it too low?)
TODO: I plugged in the measured distance between sensors = 4 inches. Could I have estimated this also to get two estimates, g and S, from the data? g can compensate S so you can't detangle.
================================
Timer Construction
- For timer construction see: