Electron data usage

@BDub Update: Electron code shown above (just changed to publish every 30 min rather than every min) continues to publish very well over 12 hr period (one missing publish out of the 24 expected). :grinning: But again, I don’t know whether this success is due to turning off LTO or moving from 0.4.9 to develop or both. Unfortunately, I forgot to unplug the usb cable so didn’t get a sense of battery usage yet. :sob:
Needless to say, I’m very happy with the increased reliability!

That’s good to hear, and we do recommend compiling with COMPILE_LTO=n. System parts are compiled that way.

Because you don’t have some of the latest changes, when you wake up from sleep, since the modem is being turned off, it will have to go back through a longer blinking green cycle connecting back to the cell network and cloud before it can publish. Is that what you are seeing?

@BDub
3 seconds white then
20 seconds green blinking then
3 seconds cyan breathing

Cool, makes sense. When you try again with 0.5.0, you should be able to wake right up from Stop mode sleep and publish immediately.

1 Like

@BDub Over the past 2.5 hrs, instead of the VCell and SoC data, all I’m getting now is spark/device/app-hash notifications, which occur at times I should otherwise be getting the battery info publish message. The app-hash is the same every time. Without any intervention from me, it went from reliable publish events to just the app-hash messages. The docs say app-hash is sent after flashing, which doesn’t apply here. Any idea what’s happening?
I should mention that the rgb led behavior is exactly the same as when I was getting the coded publish event.

Further update. Remained stuck in spark/device/app-hash land past 4 hrs so I woke it up by momentarily grounding WKP. This produced spark/device/app-hash notices only. I plugged in the usb cable and tried the wakeup. Another spark/device/app-hash. I removed the battery and woke it up. Another spark/device/app-hash. Only when I removed both the battery AND usb and then reconnected both usb and battery did I manage to get it publishing upon momentarily grounding the WKP pin - though not reliably at first (6 successful out of 9 awakenings) despite the electron displaying the apparently correct rgb led sequence.
The publish message reports VCell and SoC and is reporting “4.07 97.18” now that it’s publishing again ( also the red led if off so it’s not sensing a need to charge) so it doesn’t appear that it ran out of power…
Any thoughts, anyone?

To rule out other issues, can you try leaving your Electron on instead of going to sleep. Just create a if (millis() - lastTime > 30*60) { } block to publish your data from and see how that does.

Will do. But we need to keep in mind it started to fail after about 16-17 hrs…

Here’s what I’ll run:

#include "application.h"

FuelGauge fuel;

char publishStr[20];
uint32_t lastTime = 0;

void setup() {
//  pinMode(WKP, INPUT_PULLUP);
}//setup()

void loop() {
  sprintf(publishStr, "%.2f %.2f", fuel.getVCell(), fuel.getSoC());
//  Particle.publish("e1", publishStr,60,PRIVATE);
//  System.sleep(WKP, FALLING, 1800); //30 min
if ((lastTime + 1800000) <= millis()){
  lastTime = millis();
  Particle.publish("e1", publishStr,60,PRIVATE);
 }
}//loop

Sounds good, and I’d like to propose a change that will help avoid wrapping errors, and also publishes on boot.

#include "application.h"

FuelGauge fuel;

char publishStr[20];
uint32_t lastTime = millis()-(1800*1000UL);

void setup() {
}

void loop() {
  sprintf(publishStr, "%.2f %.2f", fuel.getVCell(), fuel.getSoC());
  if (millis() - lastTime > 1800*1000UL) {
    lastTime = millis();
    Particle.publish("e1", publishStr, 60, PRIVATE);
  }
}

OK, I just flashed your change.

@Bdub , @bpr Hey guys I have a Electron just sitting here and little time to play with it so I figured I would flash this code and see if I saw the same issues.

I just flashed Bdub’s code above and here is the first publish event I received after the first flashing the Electron over 3G cellular which worked perfectly.

Should the App Hash be showing up with every publish along with the Battery Voltage and SOC Readings? I don’t see that when publishing from the Photon.

Never mind the 2nd update only shows the battery status info as desired.

So it looks like that Hash info is only sent when the device first connects to the cellular network. And this is the extra data that occurs when you wake the cellular module from Deep Sleep instead of sleep it looks like.

@BDub, the always on (No stop mode sleep) electron test produced very good results every 30 minutes, usually exactly to the second, from 4:09pm Calif time through the night until 11:09a
m today, then my the dashboard stopped recording events, until I restarted in on returning home from work this evening and found it still publishing. I’m assuming the reported dashboard problem, rather than the electron, was the cause of the stoppage. I had also setup a particle subscribe e1 mine log window but that shutdown at the same time. I think we can assume it’s a stop mode sleep interaction as @RWB also found enter link description here

That’s good to hear! Also I’ll update you with my test :smile: I’ve been running my posted code above since yesterday on battery alone on my U260 (3G) and just saw another publish come through. "name":"e1","data":"3.44 1.28" At 1.28% charge, I decided now would be a good time to plug it back in to charge it up again :wink:

System.sleep(SLEEP_MODE_DEEP, 150);

Seems to be a stable sleep mode that so far allows all Publishes go through.

System.sleep(D0,RISING,150);

Causes Publishes to go missing, its hit and miss from my testing.

FYI

@RWB yes this is what I see too. And according to the Billing and Usage window, the difference in data usage is HUGE between stop mode (hardly registers at all!) and deep sleep (dramatically higher usage) as @BDub pointed out earlier, so getting stop mode working is a big deal.

Good to know.

I have been checking my data usage all day but it’s not updating every hour. It’s been showing 0.04 MB all day so I’m guessing I’ll see a large data increase tomorrow. I have no idea what to expect.

I noticed this too. In 24 hours I went from 0.11 MB used without a sleep mode to 0.70MB used the next 24 hour period. @BDub said an upcoming update will do away with having to re-handshake with the cell tower after wakeup. That’s your likely culprit.

My data is only updating every 24 hours it looks like. Hope it gets back to the 1 hour updates soon.

When exactly is this Re-handshake happening? After reconnecting from sleep state?

Yes, that’s what I was told, here: Electron Solar Kit Charging Indicator?

What are you using to trigger wakeup? Are you doing it remotely?

I ask because I’m wanting include a way to to remotely wake the device for a reflash if needed. At the moment I built in a millis() non-blocking delay window to reflash, not optimal.