Timer when accelerometer is active

Hello everyone!

I have to admit I am very much a hobbyist with patches of knowledge, so I’m hoping for some kind and straight forward advice :slight_smile:

I’m want my Electric Imp to send data from an accelerometer on one of it’s pins, to a web server (which I can see is relatively simple) but I’m looking to only send data when the accelerometer is active; if the imp isn’t moving, I don’t want to know about it. On the web server end, I will be essentially creating a “timer” to capture how long the electric imp has been in motion, so for example if the imp has been picked up and moved in any way, I want to time how long the imp gets interacted with, and once it is put down, I want it to stop timing.

I can’t work out how best to implement this, or if it is possible without spending my money on components now.
Does anyone have any advice or experience here?

Thanks a lot!
Tom

Most accelerometers have interrupts that can signal to the imp when acceleration crosses a threshold; you can use this to tell the imp that a movement event has started.

Then, you’d poll the accelerometer regularly (say, every 100ms) and when the movement had dropped below a threshold for a certain period, you could decide the device had been abandoned and you’d send a notification movement had ended.

It’s mainly a software task, not hardware.

Thanks for your help Hugo, I will look into this when I get the components.