I'm trying to create a low powered device using an Arduino Mega. In order for it to be as low power as possible, I need to somehow put it to sleep. However, I absolutely NEED to maintain serial communication, meaning I cannot use the standard SLEEP_MODE_PWR_DOWN. I can matain serial communication with SLEEP_MODE_IDLE BUT need to individually shutdown clks I am NOT using. Can someone point me to a library or any information in order for me to do this ? Thanks !
The only documentation I can find for setting the arduino to sleep is in the playground: Arduino Playground - HomePage. I have absolutely no idea if you can still talk over serial with it when you send it to sleep, but some simple experiments should answer the question...
Just found this on the playground page:
Events on the USART (the serial port) will also wake up the Arduino. In order for this to work, the Arduino must be in POWER_MODE_IDLE, the only power mode that doesn't disable the USART. Although this mode doesn't give great power savings you can use the functions provided in avr/power.h ( power_adc_disable(),power_spi_disable(),power_timer0_disable(), power_timer1_disable(),power_timer2_disable(),power_twi_disable()) to disable other hardware modules to achieve greater power savings. See this link for example code.
So anything other than POWER_MODE_IDLE will sto the UART - and serial communication.
I can matain serial communication with SLEEP_MODE_IDLE BUT need to individually shutdown clks I am NOT using.
Browse the datasheet for PRR (power reduction register). By writing various bits to that you shut down some internal functions.