An Arduino Investigation of Simple Harmonic Motion

advertisement
An Arduino Investigation of Simple
Harmonic Motion
Calin Galeriu, Becker College, Worcester, MA
Scott Edwards and Geoffrey Esper, Bay Path Regional Vocational Technical High School, Charlton, MA
W
e cannot hope for a new generation of scientists
and engineers if we don’t let our young students
take ownership of their scientific and engineering
explorations, if we don’t let them enjoy the hands-on cycle of
design and production, and if we don’t let them implant their
creativity into a technologically friendly environment. With
this educational philosophy in mind, Massimo Banzi1 and
his team have developed and popularized the open source
Arduino microcontroller board. The Arduino board has
helped countless people in their science, electronics, robotics, or engineering projects, allowing them to build things
that we have not even dreamed of. Physics instructors have
also realized the advantages of using Arduino boards for lab
experiments.2-4 The schools are saving money because the
homemade experimental equipment is much cheaper than
the commercial alternatives. The students are thankful for an
educational experience that is more interesting, more loaded
with STEM content, and more fun. As further proof of this
new trend in physics education, Vernier5 is now documenting
the use of their probes with Arduino boards. This is why we
have developed an Arduino-based physics investigation of the
simple harmonic motion (SHM) of a mass on a spring. The
experimental data are collected with the help of an ultrasonic
distance sensor and an Arduino Uno board. The data are
then graphed and analyzed using Origin 9. This rich crosscurricular STEM activity integrates electronics, computer
programming, physics, and mathematics in a way that is both
experimentally exciting and intellectually rewarding.
The experimental investigation
Fig. 1. The experimental setup for our investigation of SHM. Our students Colin Wolfe and
Nathan Youngs have helped us with the data
collection and analysis.
spring, a brass weight, and an ultrasonic position sensor, as
shown in Fig. 1. Pulling the brass weight down a little bit, and
then releasing it, will start the oscillation. Due to very small
frictional forces, the amplitude of the observed SHM will
slowly decrease in time, but we can neglect this effect when
we analyze just a few cycles.
We have used springs specially made for the study of
Hooke’s law. One good supplier of such springs is Home Science Tools ($1.95, http://www.hometrainingtools.com). We
have also used a brass weight holder with a base diameter of
4.4 cm and brass slotted weights. The computerized data collection was done with the help of an HC-SR04 ultrasonic distance sensor ($5.18 from Amazon, http://www.amazon.com),
an Arduino Uno microcontroller board ($29.95 from Jameco,
http://www.jameco.com), a USB cable, and four male-tofemale breadboard jumper wires ($0.69 each from Vetco,
http://www.vetco.net). We have also tested a Parallax PING)))
ultrasonic distance sensor ($29.95 from Jameco) with similar
results. We have repeated the SHM experiment with a variety
of springs and masses with excellent results. The data reported in this article were obtained with the spring from Home
Science Tools using a total mass of 250 grams and using the
HC-SR04 ultrasonic distance sensor.
The HC-SR04 ultrasonic distance sensor, shown in Fig. 2,
uses the principle of echolocation. The sensor has four pins:
5 V (power supply), 0 V (ground), trigger pulse input, and
echo pulse output. A trigger signal of 5 V, lasting for at least
10 ms, will cause the sensor to emit a short ultrasonic signal.
After the transmission of this short ultrasonic signal, conof SHM
sisting of eight pulses at 40 kHz, the sensor will listen for the
echo. During this time the echo pin is kept at 5 V. After the
The exreceiver detects the echo signal, or after a maximum wait time
perimental
of 38 ms, the echo pin is reset to 0 V. The HC-SR04 ultrasonic
setup for our
distance sensor has an operating range of 2 cm to 5 m, with a
investigation of
resolution of 0.3 cm. A datasheet is posted at http://www.elecSHM consists
troschematics.com/8902/hc-sr04-datasheet/.
of a stand, a
The Arduino Uno is a microcontroller board based on
the Atmega328 microcontroller
integrated circuit. It draws current from a USB cable, or from
an ac-to-dc adapter. It has six
analog input pins and 14 digital
input/output pins. Detailed
hardware documentation, the
free Arduino software (the inFig. 2. The HC-SR04 ultrasonic distance sensor.
tegrated development environment), and plenty of program-
DOI: 10.1119/1.4865518
The Physics Teacher ◆ Vol. 52, March 2014
157
Fig. 4. SHM data analysis done using Origin 9.
Fig. 3. The Arduino code used for data collection.
ming examples are provided on the official Arduino website at
http://arduino.cc.
The HC-SR04 sensor is connected to the Arduino Uno
board with the help of four male-to-female breadboard
jumper wires. The Arduino Uno board supplies the voltage to
the HC-SR04 sensor. The Vcc pin of the sensor is connected
to the 5 V pin of the Arduino board, and the GND pin of the
sensor is connected to a GND pin of the Arduino board. The
Trig pin of the sensor is connected to the Arduino digital pin
7, and the Echo pin of the sensor is connected to the Arduino
digital pin 8.
A short piece of Arduino programming code, shown in
Fig. 3, is needed to collect the experimental data. The computer first compiles this program and then sends it to the Arduino board through the USB cable. The Arduino board will
execute the code and will repeatedly send back to the computer the two experimental measurements, the internal clock
time, and the distance to the brass weight. The measurements
are repeated every 10 ms. The list of experimental measurements is copied from the Arduino Serial Monitor window and
pasted into a Microsoft Excel worksheet.
If the PING))) sensor is used instead, then the trigPin and
echoPin constants have to be set to the same number, 7, since
this sensor uses only one pin for both the trigger and the echo
signals. In this case the SIG pin of the PING))) sensor is connected to the Arduino digital pin 7.
The Parallax PING))) sensor has been on the market for
about 10 years. During this time this sensor has become very
popular, and fortunately the Arduino software comes with an
158
The Physics Teacher ◆ Vol. 52, March 2014
example code for how to use the PING))) sensor. This code is
called from the Examples|Sensors menu. A tutorial about the
PING))) sensor is also posted on the official Arduino site at
http://www.arduino.cc/en/Tutorial/Ping. The Arduino code
that we have used is a variation of this PING))) example code.
The Arduino board is measuring the echo time with the
help of the pulseIn() function, which in this case measures
the total time (in ms) during which the HC-SR04 sensor keeps
the Echo pin at 5 V. By multiplying this time with the speed of
sound in air at room temperature (343 m/s), we obtain the total distance d traveled by the ultrasonic pulse. When the HCSR04 sensor is centered very precisely under the brass weight,
this total distance is the sum of two sides in an isosceles triangle. The height in this triangle is the distance to the brass
weight, the position x that we are looking for. The distance
between the transmitter and the receiver of the HC-SR04 sensor is 2.6 cm, and we can use the Pythagorean theorem to calculate the distance x. This correction becomes very important
when the distance between the sensor and the brass weight
is small, just a few cm. With this correction accurate results
can be obtained even with shorter stands. Our code improves
the PING))) example code in three ways. Our code works for
both 3 and 4 pin sensors, we implement a Pythagorean correction in the calculation of the distance, and we use floating
point arithmetic in the calculation and reporting of the data.
Data analysis
Data analysis was done using an evaluation copy of Origin 9 downloaded from http://www.originlab.com. Origin
is a powerful software application specifically tailored for
scientific calculations. We have used the Nonlinear Curve
Fit option, with a User Defined fitting function of the form
A*sin(2*pi*x/T+B)+M. For our example the amplitude A is
7.3460.026 cm, the period T is 0.767540.00018 s, the initial phase B is 3.5730.014 rad, and the midline (equilibrium
position) M is 43.5460.015 cm. The R2 value is very close to
one, a further indication that the sinusoidal model describes
very well the experimental data. The value of the period can
5.
“A guide to using Vernier sensors with Arduino,” The Caliper
30, 1-2 (Fall 2013).
Calin Galeriu is teaching physics at Becker College and math at Bay
Path Regional Vocational Technical High School. He earned a BS degree in
physics from the University of Bucharest, MA degree from Clark University,
and a PhD degree from Worcester Polytechnic Institute.
Becker College, 61 Sever St., Worcester, MA 01609;
Calin.Galeriu@becker.edu
Scott Edwards is an electronics instructor and vocational lead teacher
at Bay Path Reg. Voc. Tec. High School. He has a BS in engineering from
UConn.
Bay Path Reg. Voc. Tec. High School, 57 Old Muggett Hill Rd.,
Charlton, MA 01507; SEdwards@baypath.net
Fig. 5. Experimental investigation of Hooke’s law.
be used to calculate the elastic constant of the spring:
k = m(2.p/T)2 < 16.75 N/m.
The same experimental setup can be used to investigate
Hooke’s law. This will produce an independent measurement
of the elastic constant of the spring. We have used total masses from 100 g to 450 g. The graph of the applied force mg as a
function of position x displays the anticipated linear behavior,
and the slope of the line of best fit gives the elastic constant.
The value obtained this way, k <16.77 N/m, is very close to
the value determined from the period of the SHM. Another
important observation is that the spring has a residual force,
and it won’t stretch if the mass of the brass weight is less than
100 g.
Conclusions
We have developed an Arduino-based exploration of the
simple harmonic motion of a mass on a spring. By using an
Arduino Uno board and an HC-SR04 ultrasonic distance
sensor, this very important physics experiment can be performed on a budget, with an excellent match between the
experimental data and the theoretical model. This integrated
STEM activity has also uncovered some fundamental connections between physics, electronics, computer programming,
and mathematics. This Arduino-based investigation of SHM
has helped the students to improve both their experimental
and theoretical skills. We would like to thank the anonymous
referee for very valuable comments.
References
1. 2. 3. 4. Massimo Banzi, Getting Started with Arduino, 2nd ed. (O’Reilly
Media, 2011).
K. Zachariadou, K. Yiasemides, and N. Trougkakos, “A lowcost computer-controlled Arduino-based educational laboratory system for teaching the fundamentals of photovoltaic
cells,” Eur. J. Phys. 33, 1599–1610 (Nov. 2012).
Eric Ayars, “Applications of Arduino Microcontrollers in Undergraduate Laboratories,” invited talk presented at the AAPT
national meeting in New Orleans, LA, Jan. 2013.
Calin Galeriu, “An Arduino-controlled photogate,” Phys. Teach.
51, 156–158 (March 2013).
Geoffrey Esper is an electronics instructor at Bay Path Reg. Voc. Tec. High
School. He has a BS and MA degree in physics from Clark University.
Bay Path Reg. Voc. Tec. High School, 57 Old Muggett Hill Rd.,
Charlton, MA 01507; GEsper@baypath.net
A mus
ement Par k Physic
s
2nd Edition
by Clarence Bakken
Plan now for your spring trip to
the local amusement park
And save $5 through March 31!
Completely updated, Amusement Park
Physics, 2nd ed. gives teachers a gamut of
subjects ranging from ways to incorporate
amusement parks in classroom work to
practical suggestions for taking a class to
Physics Day.
www.aapt.org/Store
The Physics Teacher ◆ Vol. 52, March 2014
159
Download