1
\$\begingroup\$

I'm playing with an idea of putting Arduino microcontroller and IMU sensor inside of a ball in order to measure the trajectory and speed of the ball and also determine when it's not in motion.

Any ideas on how to do that? So far I've gotten raw values - 6 DOF (X, Y, Z from the accelerometer and X, Y, Z from the gyroscope) but they are quite noisy and trying to make sense of them. Also one of the other challenge is getting location in 3D space as the data is relative to the Arduino but it has no understanding of where it is in real world.

Some things in my initial research came up are using Kalman filter to clean up data, similar question/answer posted here: https://stackoverflow.com/questions/42176603/getting-a-trajectory-from-accelerometer-and-gyroscope-imu and Transform linear acceleration from frame of reference of IMU to vehicle but still not clear to me yet.

\$\endgroup\$
10
  • 2
    \$\begingroup\$ Look up vector math, integration, dead reckoning. You're also going to need either quaternions or Euler angles. Good luck studying! \$\endgroup\$
    – DKNguyen
    Commented Feb 8 at 16:57
  • 1
    \$\begingroup\$ Those aren't broad. Those are the fundamentals if you want trajectory. Speed is easier since you only need vector math and integration...assuming no rotation. If rotation then it becomes complicated again. Quaternions and Euler angles are quite involved. In any case you will need vector math to get a taste of how to do anything at all with IMUs so at least look at that. Specifically pay attention to how unit vectors work and can indicate a direction independently of magnitude. \$\endgroup\$
    – DKNguyen
    Commented Feb 8 at 16:58
  • 1
    \$\begingroup\$ You can gloss over dot and cross products while trying to understand unit vectors, until you get into rotations, but they are basic operations. Off the top of my head they aren't too important for what you are trying to do but you should be aware. \$\endgroup\$
    – DKNguyen
    Commented Feb 8 at 17:04
  • 1
    \$\begingroup\$ electronics.stackexchange.com/questions/605890/… \$\endgroup\$
    – DKNguyen
    Commented Feb 8 at 17:09
  • 1
    \$\begingroup\$ It's not everything you need but its the beginning unit vector stuff. Just pay attention to the way the unit vector comes together in those equations. You will probably need a bit of other supplementary reading but if you get that you can move on to other stuff. \$\endgroup\$
    – DKNguyen
    Commented Feb 8 at 17:09

1 Answer 1

1
\$\begingroup\$

You definately need a kalman filter. It tracks the states (position velocity ect) of the data from the IMU. Kalman filters are complex and hard to get working because you need to understand every piece and how to test it to get it working in software if writing your own.

It would be good to see if there is a library or something you can use to get it working. If you value your time it would be good to find an off the shelf solution that automatically reports states.

Even with a kalman filter, accuracy can be an issue because of the sensor. Use a 9 DOF (magentometer) if you need better rate info.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ IMU does not provide position and velocity data. In this specific case, Kalman filter is used to predict orientation using integration of gyro data, and then update it using data from accelerometer and magnetometer. The end result is AHRS data which needs a lot of additional processing to turn it into position and velocity. \$\endgroup\$
    – Maple
    Commented Feb 8 at 19:59
  • \$\begingroup\$ You can have it track whatever states you want, you can have it predict the position and velocity if you want to transform the data before you throw it into the filter. The Kalman filter tracks the distribution of the states and propagates it. \$\endgroup\$
    – Voltage Spike
    Commented Feb 8 at 20:02
  • \$\begingroup\$ Your statement is technically correct, however practical implementation requires at least one additional sensor providing altitude data with greater certainty than can be estimated from accelerometer. This is required whether you do the transformation before the filter or do the calculations after. IMU is simply not enough to get true trajectory. Although you may get close enough if you reset position every time the ball is not in motion. \$\endgroup\$
    – Maple
    Commented Feb 8 at 20:55
  • 1
    \$\begingroup\$ Complimentary filters (low pass for the accelerometer and high pass for gyroscope) can be used if you can't figure out how the Kalman filter works. You would want to find a filter designer in something like MATLAB or OCTAVE so you can find two filters that drop to -3dB or 50% signal amplitude at the same point so one picks up where the other leaves off. \$\endgroup\$
    – DKNguyen
    Commented Feb 8 at 22:13
  • \$\begingroup\$ Thanks, will try that :) \$\endgroup\$
    – Suyash
    Commented Feb 12 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.