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.

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:
Viscous + Coulomb (dry) friction — adds a friction term of roughly constant magnitude that opposes whatever direction the pendulum is moving:
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:
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.

| model | length (mm) | damping (kg·m²/s) | coulomb (kg·m²/s²) | RMSE (deg) |
|---|---|---|---|---|
| viscous | 61.93 | 0.0026 | — | 5.23 |
| viscous + Coulomb | 60.70 | 0.0012 | 0.013 | 0.48 |
Both fitted lengths land close to the pendulum's actual ~62mm design length — a reasonable sanity check for a first identification pass.