Triggering an alarm when someone picks something up and tries to walk away

Hi,

I'm trying to get an alarm to go off if my Arduino Nano is picked up and moved (in any direction) consistently for at least 5 seconds. So if someone picks my Nano up and walks away for 5 seconds, the alarm should go off.

I'm somewhat restricted because all the sensing has to be onboard. I've been trying to use a 3-axis accelerometer, but I'm having a hard time figuring out the programming. I've also been looking at vibration sensors.

Does anyone have any advice for getting something like this working? I'm looking for the lowest cost reliable way of doing this.

Thank you for your time!

Use the 3-axis accelorometer.

Take the modulus of sum of the 3 axes.

Take an average modulus over say 5 seconds…

if (average > limit){
set off alarm
}

*Take a rolling average…say a reading every 250ms and add it to an array…looping over the array.

Low cost and reliable: make a wire disconnect when it is picked up. Or have a microswitch on the bottom. Other methods can be defeated by moving it slowly, if that's a concern.