Hi,
I have an Atmega328p on the breadboard, and it runs with a crystal at 8mhz.
I have the multimeter in serial and i can clearly see the mA. The problem is that when I use one of these two commands they doesn't make any differce to the mA consuption:
I'm here, i unsoldered the led from the 5v to 3.3v converter and I don't know why now the LowPower.h works, with the LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); the consuption drops to 10.65mA with this code:
#include "LowPower.h"
void setup(){
pinMode(9, OUTPUT);
delay(15000); //for upload codes
}
void loop(){
digitalWrite(9, HIGH);
delay(500);
digitalWrite(9, LOW);
delay(2500); //check how many mA is using in idle
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
}
Yup. No schematic = no sensible insight into the situation.
Who knows? Crystal ball is at the repair shop so I have to improvise.
May I suggest breadboarding just the microcontroller with a crystal & decoupling caps (around crystal + Vcc) and trying to get just that down to the lowest power consumption possible. Then optimize the other peripherals for low power usage. Currently you have no clue what is consuming power and how much of it.
I noticed that when the myRadio.write comes, the mA goes up to 14mA for 10 seconds (i think beacuse it is slow to transmit and block the whole code while loading) and after that i could count 24 seconds of deep sleep using 11 mA.
Btw, i was thinking, is there a function that disables all the modules?
For example, when i start the bme280 library, with bme.begin();, is there a way to sleep the component? i was thinking like a module_stop() and module_resume() but not from the library of the bme280, directly from the Atmega328p, like a sleep_cpu() or something like that
And that is why i sent the image
Btw i found the commands myRadio.powerDown() and myRadio.powerUp() for the nrf24l01, and I gain 0.2 mA, better than nothing...
obviously I set the transmit power to the minimum:
myRadio.setPALevel(RF24_PA_MIN);
and i'm still searching for the sleep of the bme280... or a command that sleeps all modules