Go Down

Topic: Atmega328 powered by 3.7v lipo (Read 18075 times) previous topic - next topic

trendski

Pravas: that solar charger is cool - thanks 8) for the tip

Craig Turner, blog: http://gampageek.blogspot.co.uk/ It helps with my learning if I write things down, esp. for others to follow (constructive comments welcomed to improve)

trendski

#16
Feb 09, 2012, 04:14 pm Last Edit: Feb 09, 2012, 05:11 pm by trendski Reason: 1
Hi Nick,

I've got the fuses on the 328 set to minimise Power consumption except I am using the 8MHz internal (I still have the external 8MHz as well for reasons mentioned earlier).

Voltage set at 3.7v and current during sleep is 5.1uA - yippee. I'm well chuffed, only 18.87uW in sleep mode as per your code sample

I am using a minimalist board Cisesco XINO http://proto-pic.co.uk/xino-basic-for-the-atmel-atmega-series-and-arduino/. NB I also dumped the power LED.

Code: [Select]
#include <avr/sleep.h>
#include <avr/wdt.h>

const byte LED = 13;

void flash ()
 {
 pinMode (LED, OUTPUT);
 for (byte i = 0; i < 10; i++)
   {
   digitalWrite (LED, HIGH);
   delay (50);
   digitalWrite (LED, LOW);
   delay (50);
   }
   
 pinMode (LED, INPUT);
   
 }  // end of flash
 
// watchdog interrupt
ISR (WDT_vect)
{
  wdt_disable();  // disable watchdog
}  // end of WDT_vect

void setup () { }

void loop ()
{

 flash ();
 
 // disable ADC
 ADCSRA = 0;  

 // clear various "reset" flags
 MCUSR = 0;    
 // allow changes, disable reset
 WDTCSR = _BV (WDCE) | _BV (WDE);
 // set interrupt mode and an interval
 WDTCSR = _BV (WDIE) | _BV (WDP3) | _BV (WDP0);    // set WDIE, and 8 seconds delay
 wdt_reset();  // pat the dog
 
 set_sleep_mode (SLEEP_MODE_PWR_DOWN);  
 sleep_enable();

 // turn off brown-out enable in software
 MCUCR = _BV (BODS) | _BV (BODSE);
 MCUCR = _BV (BODS);
 sleep_cpu ();  
 
 // cancel sleep as a precaution
 sleep_disable();
 
 } // end of loop


I tried setting the internal Oscillator fuse to 128KHz but the sketches didn't work.

But anyway I'm happy with <6uA when using the Internal 8MHz osc. [I wonder why the sketches don't work though?]

I am also getting 3.6v out of the output Pins, when set to high and the 328 is awake, so that should be enough to operate an SD card,

Cheers

PS

NuElectronics SD shield is working
Craig Turner, blog: http://gampageek.blogspot.co.uk/ It helps with my learning if I write things down, esp. for others to follow (constructive comments welcomed to improve)

Go Up