# calculate force in one direction only

How can I calculate the force in one direction only.

I have a 3 axis accelerometer. I want to trigger an event based on an impact in the +Z direction only.

force = mass x acceleration, in one direction only....

However that's not what you want to measure for an impact necessarily, momentum may
important too.

well i can't get it to work.

I started with the square root of all three axis squared, and that gives me the total acceleration. I am not sure about the mass of the object. I am trying to make an electronic drum stick. the sensor doesn't weight much, but i suppose the hand/arm needs to be counted. But tt actually doesn't matter about the exact mass, I can use an arbitary value as I don't want an accurate measurement at all, I simply want the trigger to only occur when there is sufficient force in one direction. But regardless of what I do, I still get a force in all directions.

I should be able to simply check the Z direction for a positive or negative value, I think that would do it. But there always seems to be positive acceleration in the negative direction. Perhaps it bounces back a little or ..... I don't

tim77777:
well i can't get it to work.

I started with the square root of all three axis squared, and that gives me the total acceleration.

That measures the magnitude in the direction of the acceleration, its not extracting just the z component.

I am not sure about the mass of the object. I am trying to make an electronic drum stick. the sensor doesn't weight much, but i suppose the hand/arm needs to be counted.

No, the mass that is accelerating is the one, and that's the sensor itself.

But tt actually doesn't matter about the exact mass, I can use an arbitary value as I don't want an accurate measurement at all, I simply want the trigger to only occur when there is sufficient force in one direction. But regardless of what I do, I still get a force in all directions.

Just use the z-component if all you want is the z-component.

I should be able to simply check the Z direction for a positive or negative value, I think that would do it. But there always seems to be positive acceleration in the negative direction. Perhaps it bounces back a little or ..... I don't

Yes, unless the sensor is free-floating in zero gravity it will spring back after the impact. Perhaps you want just

aha, the peak reading. I'll try that.

hmm actually I am already filtering, looking for a high value, so that would be the same thing assuming the bounce back was smaller than the original. I have put a delay in also which makes a significant difference, but there is still the odd one getting through.

If i filter for a really high value, that works, but the acceleration required to trigger things is a lot. I mean its not sensitive enough.

How about measuring change of speed. That is just acceleration. When the speed is getting slower quickly, you have just hit something for instance.

LMI1:
How about measuring change of speed. That is just acceleration. When the speed is getting slower quickly, you have just hit something for instance.

The OP is measuring the change of speed over time (acceleration)...with an....(wait for it)...accelerometer.

Thanks but if someone uses drum sticks there will be large negative acceleration. That is what is wanted.

There's no question that an accelerometer in the tip of a drumstick[1] will register a large acceleration when the tip hits something. Whether the sensor reports positive or negative x,y, and z accelerations upon impact depends on the sensor's orientation.

[1] It is not entirely clear that is what the OP is doing (or whether the sensor is in a pad that the stick hits). It is also not clear why the OP thinks a delay in the code is helpful, why the OP thinks "calculating the force in one direction only" is important (suggests that the sensor is in a pad, not the stick), what direction that would be, why a "force" is needed, why the OP thinks the z component is important (also suggests sensor in pad, tho' drum surfaces are often not horizontal), why using only the z component doesn't work, what a "positive acceleration in the negative direction" means.....