Arduino sleep mode accelerometer

ok so im trying to make something that will put the arduino to sleep then wake the arduino up when an accelerometer is moved. log the time its moved at, then go back to sleep if no movement for 5 minutes.

any ideas on how to program this?

the thing that concerns me is if the accelerometer need a constant 5 volts for it to be able to send the code to wake the arduino up, therefor defeting the perpose of putting it to sleep in the first place

any ideas on how to program this?

There are a few examples available on the Internet that show how to put the processor to sleep. Here are the two I started with... http://www.arduino.cc/playground/Learning/ArduinoSleepCode http://interface.khm.de/index.php/lab/experiments/sleep_watchdog_battery/

The processor can be wakened by an interrupt. If the accelerometer has some way of generating an interrupt (a serial recieve may do it), then what you want to do may work.

log the time its moved at

Save yourself a great headache. Plan to include a real-time clock.

the thing that concerns me is if the accelerometer need a constant 5 volts for it to be able to send the code to wake the arduino up, therefor defeting the perpose of putting it to sleep in the first place

If the goal is to run from batteries then every little bit helps.

A few caveats...

  • The deeper sleep modes turn off the processor's clock (which may disable the serial port and definately stops the millis counter)
  • It can take serveral clock cycles for the processor to wake. The processor may not wake fast enough to catch the first bit of data from the accelerometer.
  • The watchdog oscillator is not a reliable source of time. Temperature and load affect it dramatically. And even when those are stable it still has jitter and drift.