Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
143 views7 pages

Coding Simple Pendulum

1. This document provides instructions for an experiment measuring the acceleration due to gravity (g) using a simple pendulum. Students are expected to know how to calculate averages and standard deviations from data. 2. The period of a simple pendulum's oscillation can be used to calculate g, assuming small oscillations. Measurements of the pendulum length (L) and period (T) will be taken, along with uncertainties, to determine g. 3. Several measurements will be taken to determine g using different timing methods - a stopwatch, an Arduino, and timing multiple oscillations - to improve accuracy and understand sources of error. Comparisons between measurement and statistical uncertainties will be made.

Uploaded by

Sarifudin Husni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
143 views7 pages

Coding Simple Pendulum

1. This document provides instructions for an experiment measuring the acceleration due to gravity (g) using a simple pendulum. Students are expected to know how to calculate averages and standard deviations from data. 2. The period of a simple pendulum's oscillation can be used to calculate g, assuming small oscillations. Measurements of the pendulum length (L) and period (T) will be taken, along with uncertainties, to determine g. 3. Several measurements will be taken to determine g using different timing methods - a stopwatch, an Arduino, and timing multiple oscillations - to improve accuracy and understand sources of error. Comparisons between measurement and statistical uncertainties will be made.

Uploaded by

Sarifudin Husni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

1 SIMPLE PENDULUM 1

October 13, 2015

1 Simple Pendulum

IMPORTANT: You must work through the derivation required for this assignment before you turn up to
the laboratory. You are also expected to know what the arithmetic average and standard deviation of an
ensemble of data are. If you miss the relevant lecture you will need to read up on the background material
in preparation.

1.1 Aim

You will probably have encountered a description of, or performed a simple pendulum experiment before.
Therefore it is fair to ask yourself why are you encountering this elementary example of experimental physics
at undergraduate level? The answer is simple - we want you to think deeply about what you can do with the
apparatus, and to do so while applying your knowledge of statistics. Having done this we want you to reflect
on how you can move toward a better, more refined, methodology and estimate what that might produce in
terms of an improved result.
In essence, this is an experiment designed for you to use your knowledge of data analysis (the mean, standard
deviation, error propagation) to arrive at a well-defined measurement of g.
The final point is as important as the prelude . . . to explore the validity of the method used; at what point
will the simple pendulum approximation fail to be valid given the data you are collecting; are there other
limitations or prospects for this methodology; and so on.
You are expected to have familiarised yourself with this script before you turn up to the lab. This will ensure
that you will be able to complete the required work, and therefore maximise your chances of a good grade
for this assignment.

1.2 Background physics

The value of acceleration due to gravity (g typically reported in units of m/s2 ) changes slightly depending on
where one makes the measurement. Precise maps of g are used in geological surveys as small local deviations
in g may be indicative of mineral reserves, such as oil or gas. There are a number of ways of measuring this
quantity and the one discussed here is the use of a swinging (simple) pendulum. This can be described as a
simple harmonic oscillator (see the Waves and Optics course [SPA4217] for details) with mass m, suspended
on a string p
of length L. The period of oscillation T is given by 2π/ω, where ω is the angular frequency and
is given by g/L. The corresponding period of oscillation for the pendulum is given by

s
L
T = 2π . (1.1)
g

This is valid for small oscillations, as the small angle approximation of sin θ ' θ is used in deriving the
relationship between T and g. Using Eq. (1.1) it is possible to estimate the acceleration due to the Earth’s
gravity from measurements of (i) the length L and (ii) the period of oscillation T . There is no dependence
on the amplitude of oscillation (as long as the small angle approximation remains valid) or the mass of the
1 SIMPLE PENDULUM 2

bob at the end of the pendulum. Eq. (1.1) can be re-arranged as follows

4π 2 L
g= , (1.2)
T2

so that one can directly obtain g from a single measurement or data point. This is the initial aim of the
experiment. Following on from this we expect you to make use of your knowledge of statistics in order to
develop refined measurements and explore systematic errors associated with this experiment.
DERIVATION REQUIRED: Starting from the error propagation formula given in Eq. (1.3)

 2  2
∂f ∂f
σf2 = σx2 + σy2 (1.3)
∂x ∂y

for two measurements x and y, with uncertainties σx and σy , respectively one can determine the variance
σf2 and hence uncertainty σf of some function of x and y: f = f (x, y). Apply this equation to the problem
at hand in order to determine the uncertainty on g in terms of the values and uncertainties on L and T .

1.3 Experimental setup

The basic experimental setup is shown in Figure 1. One can see a retort stand holding a mass (the bob)
that is suspended by a string. The mass has a small permanent magnet attached to its base. You will need
to measure the length L of the pendulum and determine the expected measurement uncertainty ∆L on this
measurement. Carefully justify your choice for this uncertainty. You should assume that the bob can be
approximated by a point mass, but consider the effect of the other parts of the pendulum.
Important: We will distinguish between a measurement uncertainty and the statistical uncertainty. The
former is the expected uncertainty on each measurement. It arises from the least count or from the calibration
error of the instrument used. The latter is associated with the statistical spread of a large number of
measurements and is usually calculated as the standard deviation of the measurements. We will denote the
former using the symbol ∆ and the latter using the symbol σ.

1.3.1 Stopwatch timing

One can use a stopwatch to determine the time period for one full oscillation T . What do you think the
measurement uncertainty ∆T is on any one measurement of T ? Is it related to your reaction time? Discuss
this issue.
MEASUREMENT (1): Record the period T of a single oscillation of the pendulum using a stop clock. Use
this single measurement, the measurement uncertainty ∆T , and your measurement of L ± ∆L to determine
g ± ∆g .
MEASUREMENT (2): Now record 10 measurements for a single oscillation of the pendulum using a
stop clock. From these measurements you can calculate a standard deviation which will be your measure of
the statistical uncertainty in T . Compare this statistical uncertainty with the measurement uncertainty you
recorded earlier. Are they comparable? Discuss. Use the statistical uncertainty in T to determine g ± σg .
Is this a better measurement? Discuss.
MEASUREMENT (3): Now record 10 measurements for 10 oscillations of the pendulum using a stop
clock. What is the uncertainty on T now? Use these data to calculate g ± σg and compare this value with
your previous calculations. Discuss.
1 SIMPLE PENDULUM 3

Upper  clamp  to  hold  the  


string  for  the  pendulum  

Pendulum  bob  

Lower  clamp  to  hold  the  


Hall  probe  

Hall  probe:  should  align  magnet  to  pass  


over  the  probe  and  ensure  that  the  probe  
is  close  to,  but  does  not  touch  the  bob  

Figure 1: The apparatus used for the simple pendulum experiment.

1.3.2 Arduino timing

[The Arduino programme for this experiment is provided at the end of the assignment and is available online
as for reference].
Timing using a stopwatch is not optimal as the uncertainty in timing one period of oscillation is relatively
large. As a result one can implement an automated data acquisition (DAQ) system using an Arduino
connected to a hall probe. The magnet on the base of the pendulum bob induces a current in the hall probe
which can be used to start and stop a clock running at one kHz in the Arduino. This gives a resolution
on timing at the level of a millisecond. However one should still consider systematic uncertainty on timing
arising from the experimental setup. The circuit for the Arduino DAQ system is shown in Figure 2 (refer
to the lectures for general setup and usage information for the Arduino board). The pins on the Hall probe
need to be connected as follows1 :

• Pin 1: +5 V
• Pin 2: 0 V (GND)
• Pin 3: Analogue output (A0)

The Hall probe will need to be placed so that the magnet passes close by when the pendulum swings past
it. As a rule of thumb, keep the separation of around 1mm between the two.
1 Pins are numbered from left to right, as viewed from the front (the back side is flat).
1 SIMPLE PENDULUM 4

Figure 2: The Arduino circuit diagram to be used for the simple pendulum experiment.
1 SIMPLE PENDULUM 5

The number of oscillations that are timed by the system is specified by the following line of code:2

int periods = 1; (1.4)

You can change the number of periods from 1 to a higher number in order to time for more than one period
of oscillation.
MEASUREMENT (4): Set the Arduino to time single periods. Compile and upload the code. Using this
DAQ system record 10 measurements of a single period of oscillation. Calculate the statistical error on this
set of measurements and evaluate g ± σg . Compare with the earlier measurements and discuss.
MEASUREMENT (5): Set the Arduino to time 10 periods. Compile and upload the code. Using this
DAQ system record 10 measurements of a 10 periods of oscillation. Calculate the statistical error on this
set of measurements and evaluate g ± σg . Compare with the earlier measurements and discuss.

1.4 Systematic uncertainties

So far we have assumed that the uncertainties in T arise from random errors. But what about systematic
errors? List possible sources of systematic errors in this experiment (3 will do).
But what about the DAQ system? Here the Arduino timer is quite accurate. So where do the uncertainties
come from? In fact, are the errors now random, or are they systematic?
MEASUREMENT (6): Set the Arduino DAQ to record 10 periods of oscillation. Start the oscillations
with a relatively large amplitude (of say 10cm). You will need to ensure that the pendulum does not precess
significantly. Now record the period of the pendulum till the amplitude decreases to about 1cm. This will
take time, but once this is set up correctly and you are sure that the periods are being recorded correctly
(i.e., no precession), you may leave the setup alone and carry on with your calculations from the earlier
parts of the experiment. Once done, plot the period versus measurement number. Since the measurement
number is roughly proportional to time, you have, in effect, plotted period versus time. You may ignore error
bars on this plot. What do you observe? Are the readings of successive period measurements correlated or
uncorrelated? Does the period change randomly or systematically? What are the consequences of this for
the observations made with the Arduino DAQ?

1.5 Reflection

An important part of any experimental investigation is to step back and think about what you have done,
what it means, and what could be improved next time. Reflect on your work with the simple pendulum, in
particular on how you have used statistics to refine your understanding of the problem and any limitations
of the experimental setup you have identified. Note down any possible improvements to the methodology
that could be used in the future, and where appropriate quantify the effect of said improvements.

1.6 Submission on QM+

You will need to submit your data and analysis via QM+ for marking. This is not a report in the strict
sense of the word, rather it is meant to be a record of your data and analysis. The document should be
no more than 3/4 pages long and should have a title, your name, date, data in tables, graph(s), and the
results, analysis, and reflection. Remember that data tables and graphs should have captions, and that, as
with your lab book, you need to record uncertainties and units for all physical quantities. Also remember
2 The default number is normally set to 1. To make sure it is, you will need to do is locate this line and change it to count a

single period only.


1 SIMPLE PENDULUM 6

that you need to compare your calculated value of g with experiment. This comparison will need to be done
using the 3σ-test.
To make marking the submission easier, please include these clearly headed sections:

• Derivation of error propagation formula


• Measurement of L
• Measurement (1): Single period measurement with stop clock.
• Measurement (2): 10 single period measurements with stop clock.
• Measurement (3): 10 measurements of 10 periods with stop clock.
• Measurement (4): 10 measurements of 1 period with Arduino.
• Measurement (5): 10 measurements of 10 periods with Arduino.
• Measurement (6): Investigation into period as a function of time.
• Reflection

In each of the ‘Measurement’ sections you will include your data and analysis for that set of measurements.
Each of these parts will be assigned marks so they must all be present and clearly indicated. It would be
best if you began your document with sections with these titles and then filled in the data/analysis.
Create this document using MS Word and save it as a PDF file. We will not accept submissions in any other
format. The submission deadline will be posted on QM+.

1.7 Arduino code

The Arduino code is written in C. This is similar to the language that many of you will be learning next
semester in the C++ course. There are times when C is a superior language to C++, for example when
you want to write efficient code and the advantages brought by the object-oriented paradigm of coding are
not relevant. A good example of this is embedded programming, a simple example of which you are doing
when you perform this experiment.3 See the SPA4321 module for more details regarding C++ and ask a
demonstrator or academic if you have questions regarding the C code used here. Those who are interested
in developing a more detailed understanding of the C programming language might consider looking in the
Library for the classic reference used by generations of programmers: the book by Brian Kernighan and
Dennis Ritchie, “The C Programming Language”.
/*
Hall sensor timing code
Navot Arad , Queen Mary U n i v e r s i t y of London
M o d i f i e d : AJM 21 Sep 2015
* periods now does refer to a period !
* Message printed out stating number of periods .
*/

// number of o s c i l l a t i o n s m e a s u r e d
int periods = 1;
int swings = 0;

int pin = 0 , hall = 0 , time = 0 , start = 0;


int calibration = 510 , count = 0 , swing = 0;
int uplim = 0 , lowlim = 0;
float seconds = 0;
3 The coding paradigm required by physicists is often procedural. This is the origin of the saying that Physicists can program

FORTRAN in any language.


1 SIMPLE PENDULUM 7

void setup () {
Serial . begin (115200) ;
Serial . print ( " Starting timing for " ) ;
Serial . print ( periods ) ;
Serial . println ( " periods . " ) ;
delay (1000) ;
swings = 4 * ( periods ) ;
uplim = calibration + 30;
lowlim = calibration - 30;
cli () ; // stop i n t e r r u p t s
// set timer1 i n t e r r u p t at 1 kHz
TCCR1A = 0; // set entire TCCR1A r e g i s t e r to 0
TCCR1B = 0; // same for TCCR1B
TCNT1 = 0; // i n i t i a l i z e counter value to 0
// set timer count for 1 khz i n c r e m e n t s
OCR1A = 1999; // = ( 1 6 * 1 0 ^ 6 ) / ( 1 0 0 0 * 8 ) - 1
// had to use 16 bit timer1 for this bc 1999 >255 , but could switch to timers 0 or 2 with
larger p r e s c a l e r
// turn on CTC mode
TCCR1B |= (1 << WGM12 ) ;
// Set CS11 bit for 8 p r e s c a l e r
TCCR1B |= (1 << CS11 ) ;
// enable timer compare i n t e r r u p t
TIMSK1 |= (1 << OCIE1A ) ;
sei () ; //
}

// I n t e r r u p t function , runs at 1 kHz


ISR ( T I M E R 1 _ C O M P A _ v e c t ) {
hall = analogRead ( pin ) ;
// Serial . println ( hall ) ;
if ( count > 0) {
start = 1;
}
if ( start == 1) {
time ++;
}
if ( hall > uplim or hall < lowlim ) {
swing ++;
}
if ( hall > lowlim and hall < uplim and swing != 0) {
count ++;
swing = 0;
}
}

void loop () {

if ( count == ( swings + 1) ) {
seconds = time / 1000.0;
Serial . println ( seconds , 3) ;
// Serial . print (" Count = ") ;
// Serial . println ( count ) ;
delay (100) ;
time = 0;
start = 0;
count = 0;
}
}

You might also like