Pendulum mathematics

Pendulums are one of the earliest machines we see and Physics courses can take advantage of that familiarity to reveal fundamental principles and demonstrate the mathematical relationships.

In this demonstration, I suspended an NXT with three sensors from above, and let it swing back and forth, recording the data via Bluetooth to the NXT-G data logging window.

The sensors logged were the NXT Ultrasonic sensor, Light sensor, and HiTechnic accelerometer mounted on the bottom of the pendulum. The NXT internal timer was also used to determine sample rate and experiment duration, but that will probably be transparent to most students.

The program was very simple – essentially two data logging blocks:

NXT-G Pendulum Data Logging Program and Palette
NXT-G Pendulum Data Logging Program and Palette

Here’s a snapshot of the resulting accelerometer plot:

Accelerometer Pendulum Data
Accelerometer Pendulum Data

Depending on your goals, and the readiness of your students, you can ask them to do a lot of things with this exercise. Some of them include:

  • predict the pendulum period
  • predict pendulum period variation with length
  • determine how pendulum weight affects period (sneaky question – it doesn’t)
  •  measure acceleration due to gravity

For the elementary kids, don’t think they’re left out. One of the ways to get them thinking about the periodic motion would be to study the relationships of all three data streams and see if they can tell what’s going on in each part.
Here’s an example:

multiple pendulum streams
Multiple Pendulum Data Streams. Red = Light, Green = Acceleration, Yellow = Ultrasonic

So when the light sensor is reading the brightest, it is closest to the floor, which aligns with the accelerometer showing maximum negative acceleration, and the ultrasonic sensor showing closest proximity to the floor.

The width of the light sensor spike also reveals that the pendulum is moving fastest (narrow peaks of light sensor curve) when it’s closest to the floor (bottom of the swing) and slows down as it nears the top of the swing (widest, lowest points of light sensor curve).

Just having the younger kids walk through these qualitative relationships should help them make connections in other analytic subjects later on.

For kids that are ready for the math, here’s the pendulum equation:

 T = 2π√(L/g)
Period (time) = 2π* Square Root of (pendulum Length/acceleration due to gravity)

For students ready to embark on differential equations or signal processing, this should be a decent challenge to predict or develop the equation for the exponentially damped sinusoid curve that’s shown in the logged data.

Further Extension For Any Age Students

In the images above you’ll see I chose 100 samples per second (100 Hz) for my sample rate. For the hot runner students who get done and start being bored (or the mathematicians) ask the students to start lowering the sample rate and observe the effects on the logged curve. If time is short, tell them to pick a sample rate that’s close to the pendulum’s period. Then ask them why the logged data doesn’t look like their earlier curve with the higher sample rate. If they used their pendulum’s period, the logged data should be a flat line.

What’s going on?

Too low a sample rate violates the Nyquist Theorem, or Sampling Theorem which tells us that any sampled signal must be sampled at least twice as fast as its highest frequency. This is why compact disk music is sampled at 44,100 Hz, because humans can only hear up to about 20,000 Hz.


At first blush, you might think hanging the NXT Intelligent Brick on a string would be sufficient, but unfortunately it tends to spin, which disturbs the signals and the data being collected. To prevent this, the intelligent brick needs to be constrained such that it can swing only about one axis. I used an arrangement of studless beams and an axle to make that happen.

Watch the NXT Ultrasonic sensor – if it does not get a return, it defaults to a value of 255 cm or 100 inches, which has a tendency to foul up the ultrasonic curve early in the experiment.

Further reading

The following two tabs change content below.
Craig focuses on demonstrating educational robots in realistic scenarios and connecting abstract concepts to robot movement.