Electron Timeout Issues!

I am using a third party sim card and when the Electron first connects it works and flashes fine but after 5 mins or so nothing will communicate to the Electron, flashing OTA or doing API commands.

The Electron has three bars and still connected to the tower.

1 Like

Bunp, any idea on what this issue is about, the electron is basically dead with in five minutes.

And I have the same problem with third party sim card, with SIM Particle works great.
I do not know what the problem is. I will try with an operator who uses Particle for roaming in my country so we’ll see whether it is maybe a problem.

Whether it is 2G or 3G version? If the same happens with Particle SIM card?

It’s the 3G version, I do not have the particle Sim setup, since I want to use the SMS function with the third party sim.

Just chiming in, I have the identical issue. Since the SIM I am using (t-mobile) belongs to another device, I assumed that T-mobile was cutting the data after a few minutes. I’ve even tried three different APNs for the carrier, all the same result. Interestingly, if I publish to the cloud every 15 seconds or less, I never lose connectivity. I have enough data available with the carrier that this wouldn’t be a problem, but it’s not the solution.

Particle SIM works fine.

@Jamesrdorn Whether in your country Particle uses T-mobile for roaming or another network?

I tried with SIM card from T-mobile operator used for roaming in my country but the same problem occurs.
The method of sending the Publish every 45sec contributes to the connection is not lost.But why this does not occur with sim cards from Particle? With other cards need in some way keep alive function.
It would be good to engage in discussion and engineers from Particle.

ping @mdma , @BDub1

I’m using t-mobile as a contracted provider for the electron, I do not want for a publish to keep alive tho.

Can we get some attention to this? Is there anything we can do to debug this problem?

Yes, to debug, can you tell us does the problem go away if you publish data every 4 minutes? It could be the teleco is destroying the UDP connection after a 5 minute timeout. On particle sims, this timeout is 24 minutes, so the firmware pings the server every 23 minutes.

I am learning how to program the electron. How i do a 4min publish loop to keep alive.

Hi @mdma,

It looks like the most reliable keepalive time is approximately 60 seconds. At 90 seconds, the first interval works, but fails on the second.

Are there any other steps that can be taken to increase this time?

I would just hate to forget to include it for devices deployed in the field.

Hi @mdma ,
Even if used as TCP communication with another server, the communication with Particle Cloud lost if not used Publish.
Also lost communication with TCP server if the interval greater than 45s.
Experimental I got somewhere during the 45S for the interval.
It would be good to make API which can be set interval for keep alive.

Right - the UDP IP/port mapping that the cellular network establishes and later tears down with inactivity is independent of any separate TCP connection. We will be adding an API to set the ping timeout for the UDP cloud connection, at least as an intermediate solution while we look to find ways to make these connections persistent.

3 Likes

Excellent. I hope you will quickly solve it :slight_smile:

This looks like it would solve the issues im having with the electron currently also regarding the timeout

There is a PR for this feature here https://github.com/spark/firmware/pull/913

2 Likes

Excellent,
Maybe someone will need. While being out a new version of firmware this is my solution.

#include "cellular_hal.h"
// This #include statement was automatically added by the Spark IDE.
#include "application.h"

STARTUP(cellular_credentials_set("internet", "internet", "t-mobile", NULL));
long previousMillis = 0;      
long interval = 45000;        
void setup() {

}

void loop() {

keep_alive();

}

void keep_alive()
{
    unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > interval) {
    
    previousMillis = currentMillis;  
    
     if (Particle.connected()) 
     {
         Particle.publish("P");
     }
    
  }
}
1 Like

How has your keep_alive code been working out so far? I kinda have same problem here in Thailand but using your code doesn’t seem to fix it here. Thanks!