Arduino low power: switching components on and off

Hello,

Couple of weeks back I did a room temperature logger on a breadboard, using a DHT21 sensor, an SD module, and an RTC module. So far, so good working off of mains. I've got tens of thousands of data points for processing, did some cross checks with a room thermometer, all good.

Now the next thing I want to do is take this thing off mains, so I can run it off batteries. I'm planning on the usual setup: the ATMEGA328 chip by itself + switching regulator + modules mounted on a custom made PCB. I've been looking into the arduino low power libraries, which seems to be the way to go.

The idea I have is to keep the CPU running on low power standby, when it wakes up every so often, it takes a reading. And I figure I can improve the power consumption a whole bunch if the CPU cuts power to the sensors and modules, goes to sleep, and then powers each module back on only when it's needed. In fact that would probably allow me to add an RF transmitting module and make it play nice with the SD module, but that's another story.

I was thinking of simply putting 4 or 5 transistors on the VCC line and using them to switch power off and on. But that might take up a bit of space and a small mess of traces on the PCB. So I got to thinking ICs: a shift register, sourcing power from it is my current idea.

Or a LED display driver, but I'm thinking a LED display driver is probably overkill and more complicated than it's worth.

I also found chips like the ULN2803 which are darlington arrays, but I don't see the need for darlington pairs for simply switching things off and on.

Anybody have a better idea for this switching setup? Is there any IC I can look into that's just a bunch of transistors in parallel, for this kind of application?

Most small sensors consume less than 20mA so they can be powered directly from an Arduino pin.

How you do this depends entirely on the particular sensors involved and switching individual sensors may not actually work in the case of I2C and SPI devices.

You need to appreciate, and you will surely find out when you try it, that the digital pins of a device that is powered off become in effect shorted to ground, this is a problem for devices that share digital pins such as I2C or SPI devices.

There is also the significant issue that switching some devices on will trigger a brownout of the microprocessor so some means of slew control on the switched power lines is essential for reliability.

In addition I would consider some form of additional external watchdog timer essential so that the processor can be reset if the processor wakeup from sleep fails or there is a program crash or an I2C bus hang.