Detecting SIM card

Device is Xbee3 LTE-M cell modem.

Does the AT interface provide any way to determine / infer if a SIM card is inserted or not? Some modems provide this info, but I didn’t see anything like this in the User Guide.

Even if such a query isn’t available directly, can the SIM card status (present or not) be inferred from another command, and if so, how long does it take for the command to reflect the status? Or said another way: let’s say that querying the IMEI returns an empty string with no SIM card inserted (I’m just making this up, I don’t know how it behaves…) – how long from when the SIM card is removed until this can be detected or inferred.

My client is using these devices in a somewhat rough environment and they are worried about the SIM card coming loose (or not being fully inserted) and being able to detect this.

Thanks!

I don’t believe DIGI modems have AT commands to detect SIM insertion.

IMEI comes from the u-blox module, with or without a SIM inserted. Reading ICCID can take 30-sec to a minute in my experience. I suppose you can build a logic to warn your customer to check SIM card if you can’t read the ICCID in two minutes.

This is very helpful. Thank you very much for taking the time to write such a helpful reply!

No, there is not a command that can tell if a SIM Card is installed or not. But using the S# command will allow you to read the ICCID of the SIM card if it is installed. I would suggest trying to read this value at about 1 min after booting or powering up the module. The command will respond with just a if there was nothing provided.

Thank you Eric. Per your recommendation and acpie360’s as well, it seems that a periodic read of the ICCID is probably the best / easiest way to infer SIM card presence.

I plan on running some tests to get an idea of how “quickly” the SIM card removal / insertion is detectable, when I get a chance I’ll post back. From what I’ve seen just messing around, it’s not instantaneous, so it’s good to know roughly how much time elapses before the ICCID query reflects the card status.

Thanks again acpie360 & Eric.

For what it’s worth, since I said I come back and follow up with my findings…

It looks like (from my testing) that when the modem is booted up without a SIM card, and then the SIM is inserted, it looks like within a minute or so, the modem detects the SIM card (based on the results of reading out the ICCID periodically and then inserting the card & seeing when the ICCID appears)

On the flip side, from what I can tell, there is no way to detect a removed SIM card, it seems that when the card is popped out, even if the modem “knows” or “sees” this, it just keeps running with the settings from the SIM card that was last inserted. I left it running for like 30 mins after popping the SIM card out and the ICCID continued to read out properly.

Summary :

  • Inserted SIM card (post-boot) is detected eventually and used (typically within 60 seconds but this is empirical)
  • Removing SIM card during operation appears to have no negative effect on the modem