Pendulum experiment

Pendulum experiment

Building a simple pendulum test rig and fitting a viscous and a viscous + Coulomb friction model to real encoder data.

First pass at building a small pendulum test rig and pulling a usable model out of its free-swing data, as a warm-up for a Furuta pendulum project.

Mechanical setup

The pendulum arm is sized for roughly a 0.5s natural period; the measured free-swing period from the data below comes out around 0.53s, close enough for a first check. Angle is read by an MT6701 magnetic encoder (14-bit, 16384 counts/rev, I2C) mounted at the pivot, driven by an STM32F031K6 Nucleo board on a breadboard.

Inside the pendulum housing: the MT6701 encoder board, its bearing, and the pivot rod

Identification

With the encoder trace converted to angle and cropped to a clean free-swing window (6-13s into the capture), the next step is fitting a model of the pendulum to it.

Viscous damping only — a point-mass pendulum with damping proportional to angular velocity:

θ = gL·sin(θ) bmL2·θ

Viscous + Coulomb (dry) friction — adds a friction term of roughly constant magnitude that opposes whatever direction the pendulum is moving:

θ = gL·sin(θ) bmL2·θ cmL2·sign(θ)

sign(θ') is discontinuous at θ' = 0, which forces the ODE solver into tiny steps at every zero-crossing and makes the fit impractically slow. Fitting instead uses a tanh-smoothed version of the same equation:

θ = gL·sin(θ) bmL2·θ cmL2·tanh(θε)

tanh(θ'/ε) → sign(θ') as ε → 0, so this behaves like the exact model above but stays smooth (and fast to solve) through zero velocity.

Viscous damping alone only ever decays asymptotically — it can't fully explain a real pendulum coming to rest. Coulomb friction is what actually brings it to a stop in finite time. Fitting both models to the same 6-13s window makes the difference obvious: the viscous-only model keeps a small residual wobble long after the real pendulum (and the viscous + Coulomb model) has settled.

Experiment data vs. viscous-only and viscous + Coulomb models over the 6-13s window

modellength (mm)damping (kg·m²/s)coulomb (kg·m²/s²)RMSE (deg)
viscous61.930.00265.23
viscous + Coulomb60.700.00120.0130.48

Both fitted lengths land close to the pendulum's actual ~62mm design length — a reasonable sanity check for a first identification pass.