MIDI Drum - help with measuring displacement

Hello all,

I am currently building a MIDI controlled air-drum. The idea is to be able to play a virtual drum kit by sensing motion. To this effect, I have an MPU-9250 9-axis IMU/Magnemeter mounted to the drumsticks to determine velocity and position.

My strategy is as follows:
Divide the space in front of the player into three zone
Zone 1: Hi hat, crash cymbal
Zone 2: Snare, Tom
Zone 3: Floor tom, ride cymbal

  • First determine that a hit occurred
  • Then determine which zone the hit occurred in
  • Then determine the angle of the stick to determine which of the two instruments in the zone will be played
  • Trigger the corresponding MIDI note.

I can reliably determine the actual hit and the position of the incline of the drum stick using accelerometer and gyro values, however, I am having trouble determining which zone I am currently in.

I tried magnetometer readings, tried to calculate displacement but so far I didn't find any reliable way to do this. The reading doesn't need to be very accurate, all I need to know if I am within certain zone or not.

Any input would be much appreciated.

Here is a link to an explanation of zones I mentioned earlier, please note that angle values are approximate only.

https://drive.google.com/file/d/1Ngm2ukKMFZm3oX6fXNDYQw__8D0f0nz4/view?usp=sharing

to determine velocity and position.

Nope. Not with a consumer device like that. Remember the accelerometer is operating in a 1G field, which is like trying to measure your drumsticks while riding in a dragster car doing a 7-second pass. The tiny inaccuracies inside the device add up to kilometers of position error in just minutes.

Your best bet is to get the "heading" of the drumstick (which direction it is pointing relative to the Earth's magnetic field) and use that for your zones. Or use some other fixed sensor, like ultrasonic or infrared positioned underneath or above each zone.

Maybe a Pixy cam can follow the movements and help you determine which zone you are.