Hi. I'm trying to make my atmega328p use as little current as possible while in sleep mode. I don't need any functions at all while it's sleeping, I only need it to be able to wake up with an interrupt.
Right now I'm using the Power-down mode and at first the power consumption went down to about 790uA. I then turned off the ADC which brought it down to about 380uA, but this is still a far stretch from the TYP 0.1uA given in the datasheet. I'm supplying it with 5V, but I will supply it with 3V when my circuit is complete. I'm using a 16Mhz crystal and I know reducing voltage and clock speed will reduce power consumption, but I'm guessing that the clock speed isn't relevant during sleep mode as it is turned off, right?
Reading the datasheet I see that turning off, ADC, analog comparator, brown-out detector, internal voltage reference, watchdog timer and on-chip debug system will further reduce the power consumption. The analog comparator should not be operational in this sleep mode anyway, and I haven't enabled the internal voltage reference, so I don't think that's an issue either. If I understood correctly, the watchdog timer is disabled by default by the arduino bootload, right? I still tried to disable it, but it didn't have any effect on the current draw. I also tried disabling the born-out detection as this can draw quite a bit of current, but my code seems to have no effect:
MCUCR |= (1<<BODS) || (1<<BODSE);
MCUCR |= (1<<BODS);
MCUCR |= ~(1<<BODSE);
sleep_mode();
This is what the datasheet says. Enable both BODS and BODSE, then enable BODS and disable BODSE, then enter sleep within four clock cycles. This has no effect on the power consumption.
I'm also a little unsure about the fuses in this thing. I think I know what they do, but can they be changed in the code like this? Or do I need a new bootloader to change the fuses? Why is my atmega328p drawing this much current?