Arduino Pendulum Physics Lab

Paul Kassebaum
MathWorks, Physics
Author Profile
Initial Publication Date: August 16, 2018 | Reviewed: November 19, 2018


Easy to build pendulum lab to acquire data from an Arduino, analyze the data to find the period of the pendulum, and connect theory with the experiment using symbolic calculations.

Used this activity? Share your experiences and modifications

Learning Goals

Students should learn about how to relate theoretical and computational thinking to the collection and analysis of real world data. There are several points in the material that pose potential conceptual stumbling blocks that the students will need to think carefully about. This is by design of the material.

MATLAB is used to give students an interactive, live link between their code and the instrument. This activity only involves data acquisition, but the skills learned using MATLAB can be applied to actuation (e.g. a driven pendulum).

Students will need to think critically about what their data signal is telling them and the limitations/effects of the instrument's time sample rate. They'll learn how to map the analytical solution of a pendulum's angle vs time to the time signal of the pendulum breaking an IR beam. For example, they'll discover that these two periodic signals have different frequencies, related by a factor of 2 (or 1/2), challenging their natural intuition.

They could also be taught about breaking an experimental device down to its simplest form. There are many takes on this experimental set up, and this arrangement is among the simplest. How does one go about designing experiments for simplicity?

Context for Use

This physics lab material is made for lower undergrads who have no experience with electronics and a little experience with programming, but may have never used MATLAB before. Each device can be shared by a pair of students. The device is easy to make in that it requires no fabrication tools (e.g. woodworking or soldering) and takes less than an hour to assemble from inexpensive parts. The material can be covered in two hours, with a natural break in the middle transitioning from experiment to theory. The material walks through a particular pedagogy, but is easy to adapt for different learning goals. For example, the circuit of the device itself can be studied or treated as a black box. The activity can be situated at the early stage of a course based on instrumentation, or at the later stage of a course based on theory.

Description and Teaching Materials

The complete lab can be downloaded from here:

The data acquisition aspect (but not the theory part) of the lab is also documented here:

Teaching Notes and Tips

I highly recommend a brief (5-10 minute) overview of the MATLAB environment. I cover usage of the toolstrip, command window, and how to author live scripts. Here's a video about live scripts:


Students should be able to

  1. build the circuit based on a schematic
  2. connect MATLAB to the Arduino
  3. collect data and save it to disk
  4. plot the data in MATLAB
  5. find the peaks in the data
  6. explain why the histogram of the time between peaks looks the way it does
  7. explain why diff() gives the falling edge rather than the rising edge of peaks
  8. calculate the peak to peak time
  9. explain why the period is half the peak to peak time
  10. hand in a full report of their work

References and Resources

I recommend the Khan Academy video on the theory of harmonic pendulum motion: