While I try and fathom out this problem myself, I thought I would post here to see if anyone has any ideas.
I am trying to put my Atmega328P IC to Sleep using the LowPower.H library and calling this function at the end of the program loop to put the Atmega to sleep for 16 seconds at a time.
// LOW POWER SLEEP FUNCTION - PUTS THE SYSTEM TO SLEEP WHEN NOT IN USE TO SAVE POWER!
void sleepTime(){
for (int i = 0; i < 2; i++) {
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); //PowerDown
}
}
However, this isn't working as expected...
When I first power up my project, I get a really low current consumption of around 190uA. On my Multimeter, I can see the Atmega periodically waking and going back to sleep with a momentary increase in current consumption to around 2 - 4mA before it drops back to 190uA when it goes back to sleep.
The problem comes when the Atmega has to do something and then go back sleep. What happens here is, the Atmega wakes up, performs its task but then instead of dropping back to using 190uA, it sits drawing more like 4mA - almost like it isn't going back to sleep except I can still see the multimeter fluctuating every 16 seconds indicating the sleep function is being called but it doesn't seem to be working as effectively.
I thought it might be down to pin states but I've checked and I am setting all the pins back to their starting states after the atmega performs it's actions and goes back to sleep so I'm at a loss.
Anyone else experienced this?
Thanks!