@Mquist I have been trying to achieve this deep sleep target current as well.It appears as though the issue of the current being unstable when in sleep mode is dependent on whether the Electron has connected to the cloud before shutting down. So your issue above with starting SYSTEM_MODE(SEMI_AUTOMATIC);, or in my case MANUAL is not the point, the problem will go away if you do a full Particle.connect() and then shut down.
I realise in your case, and in mine this is not a good thing because we do not want to waste power connecting to the cloud when we may just be coming up every so often to check a sensor and see if we need to connect to the cloud. The deep sleep runs the code from the start so there is no way of avoiding the connection to the cloud.
I have experimented with System.sleep(A7,CHANGE,60); and the instability of the sleep current is solved by ensuring that a cloud connection is made once, then because coming back from sleep and not deep sleep does not start the program from the beginning it is possible to avoid the cloud connection. In this case the sleep current is stable every time the unit goes to sleep. I suspect this would be so with deep sleep also, it just needs that one connection to the cloud and then the current is stable.
But why? @BDub , you seem to be a keeper of all wisdom, what is it that the Electron needs from the cloud to stop it wanting to do something extra and cause fluctuating sleep current?
@rickkas7 in order to reduce the Electron current to around the 2.7mA in sleep mode I had to turn off the battery charging and flashing red led as per your helpful post Disabling the Electron red charging LED when not using the LiPo
I also seemed to have to set the pulldown on all inputs on the Electron which were ‘floating’ when in sleep mode. This did significantly lower the sleep current, seems to make no difference in deep sleep but normal sleep it does.
I can confirm in my case it has nothing to do with the resistance of the current meter, I get the same results on high and low range and it is a very good meter.
However, no matter what I try, I cannot get deep sleep current down to fractions of a milliAmp. It stubbornly refuses to drop below the 2.7mA, which is roughly what it is in ordinary sleep mode. I have pulled apart the circuitry surrounding the Electron, cutting tracks and measuring currents to the peripherals and the 2.7mA is all being consumed in the Electron.
I will keep on trying but I suspect that @rickkas7 simple code above
void setup() {
}
void loop() {
System.sleep(SLEEP_MODE_DEEP, 30L);
}
does not work on an Electron with 0.5.3 firmware
Thanks for any help. You guys back at HQ are fantastic.