Another SLEEP_MODE_DEEP Question

Hi All,

I have had some trouble with power consumption with some of my electrons.

All are set outside with the same hardware, solar panels, ect.

However some of them seem to drain the battery very quickly, while others operate with no problem at all. These systems are no more than 50 ft form one another, all oriented in the same direction and angle to charge their battery.

Before I determine the issue to be related to hardware with some of these devices I would like to see if software might be an issue. All are running the same code.

Here is the main loop below.

void loop(void){
if( (Time.minute() == 59)) {
digitalWrite(led, HIGH);
resetvals();
readSensors()
sendData();
digitalWrite(led, LOW);
System.sleep(SLEEP_MODE_DEEP, (55)*60); //enter sleep mode for 55 min
}

Is it possible that my (55)*60 is having some negative effect? Or does that matter?

The electrons seem to go into deep sleep mode (even the ones that are running down the battery). I have not yet used a multimeter on any of them.

Thanks!

Could it be that these devices have some difficulty getting a connection after the wake?
If they should take more than 4 minutes to connect, you may miss the crucial minute 59 and the device may stay connected for another hour before it enters deep sleep again.

1 Like

That could be a possibility. How would I go about checking that?

In the past when I have turned them on I see the devices connect within 3 min but I know that doesn’t mean that connection time is always consistent.

Thanks @ScruffR

You could add another condition that ensures a timeout for the case you miss that minute
e.g.

  if (Time.minute() == 59 || millis() > 600*1000) 

This will ensure that your device won't stay awake for more than 10 minutes (providing your code runs at all :wink:)

Thanks for the advice.

I was looking at Device Vitals and noticed some inconsistencies. Could you explain what the parameters shown below represent?

image

image

image

Obviously there is one device that has great difficulty connecting and the uptime suggests that it frequently missed its sleep time and stayed awake.

Try moving that device just a few meters (or swap place with a good one), wiggle the antenna connector a bit, reseat the SIM.
Try the device detached from any circtuitry in Safe Mode or a dedicated test application.
You can also flash the cloud debug firmware and have a look at the log - and maybe post it here.

I’ll look into that. Thank You.

One odd thing is that I have not missed any data (I looked at the timestamps on the site where I am publishing data) which suggests that the electron is connecting and entering the if( (Time.minute() == 59)) loop which should trigger the sleep mode.

Any thoughts?

Thanks

I forgot to clarify that the sendData(); subroutine is what sends my data, therefore since my data is sent it suggests that the if( (Time.minute() == 59)) statement is entered

In that case the long up-time could be an indicator that the device isn’t staying asleep but may wake early due to some signal on the WKP pin.
To test the theory and counteract this you could use

System.sleep(SLEEP_MODE_DEEP, 55*60, SLEEP_DISABLE_WKP_PIN);

Thanks @ScruffR

When I enter the above sleep code I get a

“‘SLEEP_DISABLE_WKP_PIN’ was not declared in this scope”

error message.

Is there something additional that I need to add to my code for the code to work?

I am using the Desktop IDE and my electrons are running 0.7.0 firmware.

Thanks,

Zach

That command requires 0.8.0 or later.
I’d update to 1.0.0

I see. Is there a workaround for that command in 0.7.0? or a way to update an electrons firmware remotely?

Some of my devices are in NJ (I’m in CO) so I can’t physically access them