System Mode - Wifi w/o Cloud

I’m confused with the System Modes. Is there a way to differentiate connecting to the Wifi vs. connecting to the cloud?

I want to connect my Photons to my network but have cloud connectivity optional. If my internet connection goes down the devices should continue to run, connect to the network and post data to network based services (e.g. MQTT broker) even though the cloud is not available.

It seems that I can use Semi automatic or manual modes and call Particle.connect(). But what happens when it can’t connect to the cloud, does it return quickly and Particle.connected() just remains false?



only connects WiFi


connects to WiFi and cloud.

Thanks ScruffR for the quick response. I’ll give it a go.

How does Particle.connect() perform if it can’t connect to the Cloud? I’m trying to gauge if my code can be aware enough to support cloud connectivity if available, but only require wifi connectivity to execute normally.

Particle.connect() is non-blocking, so you just call it and can check for Particle.connected() (or use waitUntil(Particle.connected) / waitFor(Particle.connected, timeout)).
Just be aware not to call Particle.connect() again during an ongoing connection attempt. That would knock the connection back to the start and hence never let the device connect (or only very slowly).

In addition to manually controlling the connection I’d use SYSTEM_THREAD(ENABLED) to decouple the user application from the system thread.

Good evening ScruffR

Is there a difference in operation and power consumption of the photon when the system mode manual command is used instead of the wifi off commands? The docs did not specify any difference.
When the photon is put into manual mode is the wifi module switched off?

When you use SYSTEM_MODE(MANUAL) the device will start off with the WiFi module powered off and you to power it up on code and connect to WiFi and if needed to the Cloud.
So yes, as long you don’t power up the WiFi module the current draw will be less to start with.
But when the connection is established the demand will be the same.

And consequently also the opposite is true: Even in AUTOMATIC mode you can power down the WiFi module which will result in the same current demand.

1 Like

Thank you for clearing that up.