IMU controlled sound effect

Status
Not open for further replies.

lawmate

Member
Hi

I'm working on a project to have a IMU controlled motor sound effect. Basically when a remote is moved, the sound effect changes. Similar to https://sonory.org/ but controlled by an IMU and generated on the Teensy. I've seen light saber projects that are kind of similar but the ones I've seen just use a full sample triggered by a change in movement rather than adapting the sound to the movement dynamically.

I've been playing with the MPU9250 with limited success. As I understand what I'm after on the input side is to integrate the raw data to get a velocity value. So far I have had pretty unreliable results using the raw accel data, with the velocity very spikey and difficult to use. Most of the development for these IMUs seems to be for UAV use and there is some great output for that but I can't transfer it across for my requirements. The MPU9250 has on board fusion (DMP) that outputs pretty useful data. I tried it using the Sparkfun library and got quaternion values that I converted into gravity values. Unfortunately when I subtracted these from the raw accel values to give real-world acceleration, it didn't give anywhere near 0 when laying on a table, so the velocity rapidly increases even though it's not moving. Not sure how to develop from there.

I'm guessing I'll have to learn more about Kalman filters (which I don't really know much about presently) as everyone seem to say they are the best way to filter out noise and remain responsive. If anyone knows of any examples of using them to get acceleration values, please let me know.

Also, from this input, I'm hoping to create a realistic sound effect. From reading about computer game sound effect I understand it's done using a granular synth, where a number of pre-recorded samples are split into very short sections then sequenced dynamically, depending on the input value. Again if anyone knows of any examples of things like this on the Teensy or similar, it would be great to see.

Thanks
 
Best is Kalman filter, but I had some success with bandpass filtering the integrated values (HP to remove drift, LP to remove HF noise).
 
OK thanks, did you use a Kalman filter at all or just go for the bandpass ones?

There's a MPU9250 library for Teensy here https://github.com/bolderflight/MPU9250 that has a digital low pass filter incorporated. I'm yet to get it working though.

Thanks

Let me know if you have issues getting the library to work. There's a thread here with people's previous questions:
https://forum.pjrc.com/threads/37891-MPU-9250-Teensy-Library

Getting good velocity data from an IMU is going to be tough!

I haven't built in calibration tools to the library, but you'll need to calibrate the accelerometer, which sounds like your main issue right now. If you think about the error sources, you likely have alignment issues (small errors in alignment between the MPU-9250 and the breakout board plus small errors in the alignment between the breakout board and your system). These low cost IMU's also have temperature sensitivities and where you live gravity is not likely to be exactly 9.81 m/s/s. All of these error sources mean that you'll have biases that you'll need to calibrate out.

You can do a static calibration (i.e. let the thing be motionless, collect 1,000 samples and average to compute the bias) or there are some more advanced methods, there is a good series of blog posts about calibrating accelerometers here:
https://chionophilous.wordpress.com/2011/06/22/accelerometer-calibration-i-introduction/

Best,
Brian
 
An IMU by itself can't measure an absolute velocity. It can only measure short term velocity changes. If you start from 0, the absolute velocity estimate will drift over time (the question is not if, but rather how fast).

You need some method to correct the absolute velocity. E.g., you could have a heuristic to set the absolute velocity to 0, if you detect a direction reversal.
 
Hi

Thanks for the reply. I will ask about the library in the thread you linked to.

I have been calibrating the device currently, by taking an average of 1000 samples and then subtracting it from each reading. This does help, but doesn't help with noisey data. The link you posted about using the Gauss-Newton method looks very interesting. I will definitely look into that in more depth. The author does talk about calibrating the device by holding it in 14 different positions though, which is definitely not an option for me.

I need to have a pretty clean value eventually. I am hoping that I can achieve this with a good low pass filter. If not I guess I will have to look more into Kalman filtering, but what I understand so far is that it's pretty complex maths.

For the drifting, I am planning on implementing a way for the readings to always be converging towards zero. For my project I do not need to know accurate velocity values, I just need to know roughly if the sensor is moving or not. Also the movements would never last more than 4 or 5 seconds, so if the velocity increases for more than 2 or 3 seconds, it's probably due to drift rather than actual movement.

Thanks
 
Status
Not open for further replies.
Back
Top