I am just about finished with a project I've been working on except for one small piece of code. I want to be able to have the Arduino be in sleep mode when it is not being used and have it wake up when data is received from an external source through one of its serial ports.
I have an RS-485 system that will be sending commands to the Arduino and would hopefully trigger the wake up. The Arduino would have to capture all the data, but could miss the first bit or two probably.
I was hoping that someone could suggest a power mode to use, and how to implement this feature. I have found some sources online where people used interrupts of some sort, but I was hoping to avoid this. If this isn't possible with the current requirements I have set , feel free to let me know that also. Your help is greatly appreciated, thank you.
Edit: I am using the Arduino MEGA if that information is necessary
As far as I know (and read the datasheet) only timers and Interrupts can wake the chip up at all. Since the data can come in at any time, timers probably won't work. So, you're left using an Interrupt to wake the chip.
The power consumption of the MEGA board is not materially affected by the sleep mode. Why do you feel the need to sleep?
See Gammon Forum : Electronics : Microprocessors : Power saving techniques for microprocessors
As I’m re-reading that now, it shows that the MEGA power consumption can be reduced by more than 50% when using sleep. But it is still drawing a lot of milliamps.
Why do you feel the need to sleep?
It isn't necessary for the project, but it would fit with the theme of the building where the Arduinos will be used. The building I work in is all about being energy efficient and being a green building, so it would be beneficial to have the Arduinos implement this in some way if possible.
Then don't use Arduinos, as the 5V regulator, 3.3V regulator, USB/Serial chip, power LED, and power-switching Op Amp are on all the time. Use a minimal 8 MHz 3.3v '328P setup instead, powered from an efficient switching regulator, so that when it sleeps the current really drops low.
Or a 2560 chip, I have one that is basically a Mega with the support needed, no regulator, no USB: