Getting acceleration from a childrens swing

Hey guys. Trying to hookup neopixels to a swing. I need to pick on your brains for this one after mine failed on me. How would you go about reading the speed or acceleration from a childrens swing?

Gyro sensors such as mpu6050 seem to create a lot of challenges since there is a tilt involved too. I would need a detailed explanation on this one regarding the entire workflow possibly including mount orientation of the sensor and possibly caliberation and all. Any help would be appreciated.

Use basic physics: there is only one way down (direction of rope), and one endpoint (where motion stops and acc==0). You measure the acc at a given rope length and time between endpoints --> v_max: as frequency of a constant rope length is constant, so acc_max is to be found at the bottom position, 1G of that value accounts for earth gravitation, the rest is centrifugal/centripedal force

Thank you. what do you mean when you say "1g of that value"?

When we talk about basic physics yes that is true but Im having hard time getting measurements from an accelerometer where values are all effected by the tilt of the swing. Among the accelx, accelY, accelZ; gyroX, gyroY, gyroZ values Im having hard time to find which one to use.

(though now I found out there are also gForceX, gForceY, gForceZ values I can get from sensor)

was late yesterday, so my mind was a bit cloudy :slight_smile:

it's easier to use gyro values instead of acc. just make sure the sensor is placed in a way that you have one axis parallel to the swing axis. then you get the 2 extreme points the easy way: angular velocity changes sign - if you are interested in them at all.
you get the current velocity: v=angular_velocity*length_of_rope.

Stick 2 pieces of aluminum folio(or any conductive material) as electrical switches to the hinge of your swing and measure the duration between triggers. It would be cheaper, easier and more precise for measuring speed rather than going into calculations.

You realise that speed of a swing is not constant?

nervusvagus:
Thank you. what do you mean when you say "1g of that value"?

When we talk about basic physics yes that is true but Im having hard time getting measurements from an accelerometer where values are all effected by the tilt of the swing. Among the accelx, accelY, accelZ; gyroX, gyroY, gyroZ values Im having hard time to find which one to use.

(though now I found out there are also gForceX, gForceY, gForceZ values I can get from sensor)

Don't use one set, combine them to make a full IMU. 3D orientation can only be tracked by combining
all 6 values. Once you have orientation you can resolve acceleration forces to the global frame, not just local.