# I Determining the period of a pendulum with an accelerometer

1. Nov 3, 2016

### tony873004

I've got an accelerometer swinging back and forth on a string collecting data. But because of the tolerance of the accelerometer, the data is not quite clean enough to simply determine when positive turns to negative, or passes through equilibrium.

Here's the data. (arbitrary reading vs. time in milliseconds). It's easy to eyeball and see that the period is roughly 1.2 seconds. What kind of logic can I give my code so it doesn't get confused by the outliers?

2. Nov 3, 2016

### Staff: Mentor

Have you tried just doing a Fourier transform?

3. Nov 3, 2016

### tony873004

Thanks, I think that's a step in the right direction. I haven't done one since college so I'm rusty at it.

A little background...
I teach high school Physics.

Earlier this year our school got a few 3d printers. My students and I are together learning how to design things. I thought it would be fun to build a robotic person on a playground swing. Our "swingman" can lean his torso and kick his lower legs. We time his period unpowered with a stopwatch and then code that into an Arduino which tells him how often to pump.

It would be nicer if "swingman" could figure that out on his own. We're guessing that we could get more amplitude if the timing were better. The forward motion and backwards motion should have slightly different periods, as his center of mass changes. And as the amplitude gets larger, it becomes a factor in the period. So I'm trying to use the accelerometer to get better timing of his motions.

Here's a Youtube of the setup: