It'd be worth trying. Take a look at this - it seems to work pretty well: http://forum.espruino.com/conversations/301185/#comment13502846
Otherwise there are simple mechanical sensors like this: https://www.adafruit.com/product/1766
or this: https://www.adafruit.com/products/173
But they're not perfect themselves as they often don't detect motion in all axes.
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
It'd be worth trying. Take a look at this - it seems to work pretty well: http://forum.espruino.com/conversations/301185/#comment13502846
Otherwise there are simple mechanical sensors like this: https://www.adafruit.com/product/1766
or this: https://www.adafruit.com/products/173
But they're not perfect themselves as they often don't detect motion in all axes.