Without external Internet, Particle won't run

Hard to come up with a good topic for this one, but here’s the problem:

I have a Particle photon that I have set up to connect to an internal WiFi network only. If the WiFi Access Point does NOT have external connectivity, the photon never comes up. As soon as I turn on external connectivity, the photon runs normally. As soon as I turn off external internet access, and reboot the photon, it refuses to connect to even the local WiFi.

void setup() {
delay(2000);
 Serial.begin(115200);
 Serial.println("No Cloud! Not using Particle.");
 Particle.disconnect();
 delay(2000);
 Serial.print("Connecting to WiFi ... ");
//wifi debug stuff
 if(WiFi.hasCredentials()){
    Serial.println("Found credentials");
    WiFiAccessPoint ap[5];
    int found = WiFi.getCredentials(ap, 5);
    for (int i = 0; i < found; i++) {
        Serial.print("ssid: ");
        Serial.println(ap[i].ssid);
        Serial.print("security: ");
        Serial.println(ap[i].security);
        Serial.print("cipher: ");
        Serial.println(ap[i].cipher);
    }
}
delay(2000);
WiFi.connect();
Serial.println("Starting up...");

If external Internet is not available, I never even see the “No Cloud!” message. It’s as if there is something even before the setup() is called that requires a connection to the Particle Cloud.

The problem is, I cannot guarantee that the AP will always have external internet access when a Photon is turned on, and I still need them to connect.

What’s going on here? And is there any way to bring a Photon online without having Internet Access?

You probably want to use SYSTEM_THREAD(ENABLED).

In the default AUTOMATIC SYSTEM_MODE with threading off, setup and loop are not run unless cloud connected.

Using any of the non-default modes (system thread enabled, SEMI_AUTOMATIC, or MANUAL) allow setup and loop to run all the time.

https://docs.particle.io/reference/firmware/photon/#system-thread

4 Likes