Advice on using ATMega 328P as a periodic power switcher

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
mikecaptnkidd
 
Posts: 11
Joined: Wed Jan 16, 2013 7:29 pm

Advice on using ATMega 328P as a periodic power switcher

Post by mikecaptnkidd »

I have a fairly complicated Arduino Mega system with parallel battery/solar panel/charger systems, motor controllers, sensors, and a satellite modem. For power conservation, I'd like to have the whole thing completely powered down most of the time, waking up perhaps once an hour to work for a variable period of time, after which it requests to have the power shut down again.

I'm thinking that there's probably a way to run the ATMega 328P (http://www.adafruit.com/products/123) as a power controller for the main system. With the 328 always connected to the power supply, and with the main system normally off, the 328 could use the power_off sleep mode to minimize consumption. After the main system has been powered down for an hour, it could switch main power back on, the Arduino Mega and related systems would boot and do their work. When they're done, I'm hoping they could signal the 328 to cut off power.

My questions:

1) Does this seem practical?

2) If I run the 382 directly off battery power so that it might be getting < 3V at times, what's the easiest way to drop the clock speed or let it work reliably down to 2.5V? (AVR fuse settings? Reprogramming entirely? Some sort of external oscillator?)

3) What would you use for the actual switch? A transistor or MOFSET of some sort? A special purpose device? Total current draw is usually less than 1A and never more than 2A.

4) Is this logic outline the way you would attack it?
In the 328 chip:
Keep going to power-down sleep for 8 minute intervals, counting the cycles.
When enough cycles have gone by, put a signal line high to turn on the main system.
Hold that signal line high until the main system requests a power-down by pulling a different signal line high.
Power the main system down, start it all over again.
In the main system:
Power up, read state info from EEPROM or SD card
Do whatever work is required
Save state info
Signal the 328 to cut power.

5) If I wanted to main system to be able to set the 328 to different delay cycles, what's the best way to attack it? (Suppose I wanted sleep periods of 10 minutes, one hour, or six hours.) My first thought would be to just use 3 different "cut power" signal lines, one for each delay period.

6) What is the minimal set of external components/connections that I'd need to run the 328? Can it operate with just power and ground, or does it require oscillators or other support components?

Thanks for any feedback, including entirely different approaches if there's an easier way. I have never tried boot loader coding and I've never used AVRdude.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Advice on using ATMega 328P as a periodic power switcher

Post by adafruit_support_mike »

Your overall idea sounds fine.

Most Atmel microcontrollers are rated to operate down to 1.8v, though the maximum clock rate tends to be proportional to voltage.. 4MHz @ 1.8v, 10MHz @ 2.7v, 20MHz @ 4.5v. That doesn't put any constraints on your application, and in fact you'd want the lowest clock speed you could get to keep the power consumption low.

The microcontrollers have internal oscillators, so they can run with nothing more than VCC and GND, but you can really lower the power consumption by using an external 32kHz watch crystal. That increases the circuit complexity a little, but the datasheet has information on how to do it.

The sleep-wake-check strategy is a good one. It's a simple loop, so the code tends to be easy to write and debug.

For the overall power control you could use a mosfet, but for currents more than 100mA I tend to prefer relays. The ON resistance is extremely low, and it's hard to beat an air gap for OFF resistance. Reed relays are small, inexpensive, last forever, and can be driven directly from a microcontroller pin: http://www.mouser.com/ProductDetail/Mag ... o8CcT0Y%3d

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”