How to configure a Muon to use ONLY cellular

Hey, how can we configure WiFi to be completely off on a muon?
There's a firmware that I never want it to use WiFi.
Using DeviceOS 6.2.0.

This is what I am doing, but I still see something turning on WiFi:

SYSTEM_MODE(SEMI_AUTOMATIC);

STARTUP(WiFi.off();)

void setup()
{
  Cellular.prefer();
  WiFi.off();
}

Logs:

0000000617 [system.nm] INFO: State changed: NONE -> IFACE_REQUEST_DOWN
0000000619 [system.nm] INFO: State changed: IFACE_REQUEST_DOWN -> IFACE_DOWN
0000000625 [system.nm] INFO: State changed: IFACE_DOWN -> DISABLED
0000001132 [net.en] INFO: No W5500 present
0000001133 [hal] INFO: Remove Ethernet interface
0000001136 [net.ifapi] INFO: Netif en2 deleted
0000001197 [system] INFO: Device 123987543789343434534534 started
0000001260 [hal] INFO: WiFi KM0 firmware initialization started   result=0 (RAM start=10006000 end=1001a000)
0000001265 [hal] INFO: WiFi KM0 firmware initialization completed result=0 (RAM start=10006000 end=10013bf8 reserved=00005000)
0000001286 [hal] INFO: rltk_wlan_set_netif_info: 0, 94:94:4a:07:15:48
0000001417 [hal] INFO: WiFi on
0000001756 [hal] INFO: WiFi off
0000002377 [system.nm] INFO: State changed: DISABLED -> DISABLED
0000002400 [comm] INFO: channel inited
0000002499 [mux] INFO: Starting GSM07.10 muxer
0000002500 [mux] INFO: Opening mux channel 0
0000002501 [mux] INFO: GSM07.10 muxer thread started
0000002507 [mux] INFO: Opening mux channel 1
0000002511 [system.nm] INFO: State changed: DISABLED -> IFACE_DOWN
0000002522 [system.nm] INFO: State changed: IFACE_DOWN -> IFACE_REQUEST_UP
0000002548 [net.ifapi] INFO: Netif wl4 state UP
0000002562 [mux] INFO: Mux channel 1 already opened
0000002565 [system.nm] INFO: State changed: IFACE_REQUEST_UP -> IFACE_UP
0000002582 [hal] INFO: rltk_wlan_set_netif_info: 0, 94:94:4a:07:15:48
0000002595 [net.ifapi] INFO: Netif pp3 state UP
0000002628 [mux] INFO: Opening mux channel 2
0000002720 [hal] INFO: WiFi on
0000002721 [ncp.rltk.client] INFO: rltkOff
0000003030 [hal] INFO: WiFi off
0000003031 [ncp.rltk.client] INFO: rltkOff done
0000003042 [hal] INFO: rltk_wlan_set_netif_info: 0, 94:94:4a:07:15:48
0000003174 [hal] INFO: WiFi on
0000003177 [ncp.rltk.client] INFO: Try to connect to ssid: cnd
0000003807 [net.ifapi] INFO: Netif pp3 link UP, profile=NONE
0000003810 [system.nm] INFO: State changed: IFACE_UP -> IFACE_LINK_UP
0000003815 [hal] INFO: DNS server list changed
0000003819 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0000003825 [hal] INFO: DNS server list changed
0000003830 [system] INFO: Cloud: connecting
0000003836 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000003842 [system] WARN: Failed to load session data from persistent storage
0000003850 [system] INFO: Discarding session data
0000004458 [system] INFO: Cloud socket=0, connecting to 52.5.139.123#5684 using if 4
0000004462 [system] INFO: Bound cloud socket to lwip if 4 ("pp3")
0000004468 [system] INFO: Cloud socket connected
0000004474 [system] INFO: Starting handshake: presense_announce=0
0000004479 [comm.protocol.handshake] INFO: Establish secure connection
0000004489 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=2
0000007909 [net.ifapi] INFO: Netif wl4 link UP, profile=cnd
0000007982 [hal] INFO: DNS server list changed
0000007984 [hal] INFO: DNS server list changed
0000008222 [comm.protocol.handshake] INFO: Sending HELLO message
0000008381 [comm.protocol.handshake] INFO: Handshake completed
0000008385 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000008389 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000009374 [comm] INFO: Sending TIME request
0000009380 [system] INFO: Send spark/device/last_reset event
0000009391 [system] INFO: Sending application DESCRIBE
0000009397 [system] INFO: Sending subscriptions
0000009399 [comm.protocol] INFO: Sending subscriptions
0000009485 [comm.protocol] INFO: Received TIME response: 1730585560
0000009506 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000010513 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000010523 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000010527 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000010533 [system] INFO: All handshake messages have been processed
0000010537 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000010543 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000010620 [comm.protocol] INFO: Received DESCRIBE request; flags: 0x04
0000010657 [system] INFO: Cloud connected
0000010665 [comm] INFO: Forcing a cloud ping

Thanks!

This should work - I've used similar code to force Ethernet.

#include "Particle.h"

SYSTEM_MODE(SEMI_AUTOMATIC);
SYSTEM_THREAD(ENABLED);

SerialLogHandler logHandler(LOG_LEVEL_ALL);

void setup() 
{

  Cellular.prefer();
  if (Cellular.isPreferred())
  {
  Log.info("Cellular is preferred");
  }
  WiFi.off();
  Log.info("WiFi powered down");
  Cellular.on();
  Log.info("Cellular ON");
  Cellular.connect();
  waitFor(Cellular.ready, 10000);
  Log.info("Cellular connected");
  delay(5000);
  Particle.connect();
  Log.info("Particle connected");
}

void loop() {

}

The idea behind ACM is to maintain a connection - at all costs, which means all the connectivity options need to be enabled to continue checking if they are valid paths.
We've logged a request for a more power conscious option that allows turning off cellular/WiFi etc.

1 Like

I understand. Is there a way to deactivate ACM today?
ACM for Advanced Connection Manager or so?

I think this works one time.
Now when the device goes to sleep, and it wakes up, it seems it's turning on WiFi again, which corresponds to ACM doing its job.

Thank you Chris.

Not right now, no. The primary use case was the first goal - permanent connectivity. The team is aware of the need for more control, but there is no timeline on feature expansion right now.

Which sleep mode are you using? Disconnecting before sleeping should help - with explicit calls to Cellular.connect() and Particle.connect() after. ACM will maintain the Particle connection - which is why it starts testing all connections when the device wakes up.

Semi-Auto honours the last state - don't recommend Manual at all - it's much better to place guardrails around Semi-Auto if you need more nuanced connection management.

I'm using ULTRA_LOW_POWER sleep mode in SEMI_AUTOMATIC.

I have calls similar to what you describe:

  Cellular.prefer();
  WiFi.off();

  Cellular.on();
  waitFor(Cellular.isOn, waitForCellularModemOn.count());
  Particle.connect();

I'm also interested in any recipe you might have or think might work if the device needs to wake up, read a sensor then go back to sleep without any connection to the cloud.
The connection will happen eventually when there are many readings.
Thanks!

If you turn off Cellular and WiFi before sleep they should remain off on wake until you manually turn them on again for STOP and ULP.

1 Like

Hey @rickkas7 and @no1089 ,

I found that I see less attempts for WiFi if I clear the WiFi credentials with:

WiFi.clearCredentials();

Thank you both.
Let me know if there are developments in this area.