jdinatx Posted January 12, 2014 Report Share Posted January 12, 2014 Hi everyone, thanks so much for the community, and a particular thanks to those that worked so hard on getting this code up and running (Jeff). I am designing a desktop experiment for a college class that looks at oscillations of a scale-model building. Basically, the math can describe any system oscillating about its equilibrium as a simple harmonic oscillator (using a simple Taylor Series expansion of a potential energy function). i.e. acceleration is proportional to displacement. The goal of the experiment was to verify the math model with sensor data, but this is proving to be very difficult. The scale-building is fairly rigid, so displacements are small. Standard issues: acceleration data is too noisy and gyro data drifts (though it seems to be somewhat noisy as well). And integration is a nightmare. The only shot I have at making it work is that I don't need to filter or fuse sensors in real time. I can use 1000 or so points and use some other program (even excel) to do the processing. I've tried to implement a complimentary filter, a kalman filter, and now the DMP on the MPU all without much success. The DMP pitch and roll output shows the sinusoidal behavior I'm looking for, but it drifts, and taking 2 derivatives to obtain acceleration isn't helping. The complimentary filter basically only works if I reject the accelerometers completely (alpha = 1), and I have no idea how to tune the Kalman filter, though I've certainly tried. I hate to ask for help in solving my problems (rather than hang-ups) but I'm simply out of ideas, or possibly approaching the problem completely incorrectly. I could sure use some help. Integration was brought up in another post here titled "integration" and Jeff mentioned someone by the name of Seb Madgwick, and a cursory google search hasn't provided much information. Any thoughts would be welcome. (on sensors, filters, experiment design issues, etc). Thanks, and seriously great work here. -JD Quote Link to comment Share on other sites More sharing options...
luisrodenas Posted January 13, 2014 Report Share Posted January 13, 2014 What are you actually trying to measure? Displacement of some building's points while it vibrates? What is the frecuency of the vibration? I didn't understand why would you need Yaw, pitch, roll. Without having much understanding on the matter, I would put the MPU on top of the building, and only measure acelerometers at the highest possible rate. You can try with different MPU's lowpass filters. Later process that data trying to get that sinusoidal behavior. Quote Link to comment Share on other sites More sharing options...
jdinatx Posted January 13, 2014 Author Report Share Posted January 13, 2014 What are you actually trying to measure? Displacement of some building's points while it vibrates? What is the frecuency of the vibration? Yes, the very top and center of the building. The frequencies appear to be no greater than 5-10 Hz. I didn't understand why would you need Yaw, pitch, roll. If the building behaves like an inverted pendulum (it should) then pitch and roll can be used to find angular acceleration for the two perpendicular axis. Dividing the acceleration by the position will yield the spring constant (as a = k * theta for a simple pendulum). To make sure I understand: The highest sampling rate is set using .setrate(), and .setDLPFMode() for the Loss-pass filter? Currently I have not modified default setRate(), or Range, and have the DLPF set to 5Hz. So the accelerometers are outputting at 1KHz for +/- 2g, right? The arduino is gathering data at ~400Hz, but I added a delay to pull it to ~100Hz as the data looks a little cleaner. Still, after taking two derivatives, the numbers quickly reach unreasonable values. Is it possible that I need an inclinometer with faster output and higher precision? Thanks for your reply, -JD Quote Link to comment Share on other sites More sharing options...
luisrodenas Posted January 14, 2014 Report Share Posted January 14, 2014 So you want to get those two measures of that point, angular acceleration and horizontal displacement, rigth? I find it quite difficult. Because translational acceleration will cause problems trying to get pitch and roll, and displacement will drift over time... In case you want to try I would forget about DMP. Set your Arduino to read at the highest frecuency it can, then set that rate to the MPU, and configure de low pass filter to something like 20Hz. Read raw giros and accels and print them with Matlab or similar. Check that accelerometers are not saturating, if they are, change your accel range. Same thing with giros. Once you have that info registered for a period of time (1-2 minutes), you can start to process it. You can integrate accels twice to see what results. About the angular acceleration, I would take giros measure and derive it, instead of integrating twice pitch and roll. I would read everything at highest possible rate, altough you are quite sure it is vibrating at 5-10 Hz. If once you process info you achieve a bad result, then I think you should try other sensor or other methods. Maybe a flashing ligth to get vibration frecuency and something like a IR distance sensor to get displacement? Quote Link to comment Share on other sites More sharing options...
jdinatx Posted January 15, 2014 Author Report Share Posted January 15, 2014 Thanks again for the reply. Because translational acceleration will cause problems trying to get pitch and roll If it's oscillating, we can assume the motion is purely rotational, no? Check that accelerometers are not saturating I'm not sure I know what this means. I'm outputting only the accel values, these are converted to pitch and roll using an atan2 function ( http://www.freescale.com/files/sensors/doc/app_note/AN3461.pdf ). They look really close to sinusoidal. I would like to implement the gyro readings and make a simple complimentary filter, but the gyro values are rubbish. Can't figure out why they are so noisy. The accelerometers are outputting at 1KHz, and I'm guessing the gyros are too. That's plenty oversampled. I would take giros measure and derive it, instead of integrating twice pitch and roll. That's a great idea. Thanks. Will let you know how it turns out.-JD Quote Link to comment Share on other sites More sharing options...
jdinatx Posted January 31, 2014 Author Report Share Posted January 31, 2014 For those interested: I output pitch and roll (euler angles) and the x & y gyros. With these values in excel, I used a complimentary filter to obtain theta(pitch), and phi(roll). I took two derivatives of these values using the 5-point numerical-derivative method (see Wikipedia) The acceleration values were clean-ish but still not very accurate. I ended up performing an FFT on the complimentary data (excel data analysis pack is pretty darn good), obtaining the frequency of the oscillations, and plotting a sinusoid at that frequency overtop of my data. I used this sinusoid for my derivatives. And that worked. It's cheating, but, hey, it's real life. I would really have liked to achieve the precision with the MPU-6050. Seems strange that I couldn't. I wonder if a dedicated inclinometer (like from analog devices) would provide better results... -JD Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.