3rd-party SIM cards

The Particle Electron comes with a SIM card that allows easy and often inexpensive 2G or 3G cellular access.

Sometimes, however, you may want to use a different mobile provider. You may need to transfer large amounts of data, which may be cheaper on another provider, or you may need to use the Electron in a country that's not supported by the Particle SIM. Fortunately, the Electron can easily be used with 3rd-party SIM cards.

The E Series does not have a SIM card slot and cannot use a 3rd-party SIM card. It uses a M2FF embedded SIM card, which is basically a regular SIM card in a small SMD form-factor and soldered to the board.

The Boron has both a M2FF embedded SIM card (the default) and a nano SIM card slot for a 3rd-party SIM card. You need to tell the device which one you want to use, however.

Select the type of cellular device you have:

Several of the steps below require the Particle CLI, so if you haven't installed it yet, you should do so now. The instructions are at the top of CLI page.

All SIMs, including 3rd-party SIMs, must be activated. The method for activating varies by carrier; you might do this from a web site or with a phone call. If you're using the SIM that was in your phone, it's already activated. Being activated or not is part of the state of the SIM and doesn't depend on what device it's being used in.

Activation is different than claiming an Electron or other Particle device, which adds the device to your account. Claiming is discussed below.

About ICCIDs

Every SIM card has an ICCID ("integrated circuit card identifier") that uniquely identifies the card. The number is usually 19 or 20 digits long and is usually printed on the card, though some carriers only print part of the number on the card.

Assuming your phone accepts nano-sized SIM cards (iPhone 5 and later, for example), your phone can show the ICCID. On the iPhone, it's in Settings - General - About - ICCID.

The location varies on Android phones, and sometimes it's called the SIM ID or SIM Number instead of ICCID. There are other numbers like the IMSI and IMEI that are different, and shorter.

You can also easily find out the ICCID using the Particle CLI. Connect the Electron by USB to your computer. Hold down the MODE button until the main status LED blinks blue, then release. Issue the command:

particle identify

About SIM PINs

The Electron and Boron do not currently support SIM cards with a PIN. If your SIM card requires a PIN, even if it's 0000, you must remove the PIN before it will work in the Electron.

The easiest way to remove a SIM PIN is from a phone. On the iPhone, it's in Settings - Phone - SIM PIN.

Finding your APN

The APN ("Access Point Name") specifies how the Electron should connect to the Internet. The setting varies by carrier, and sometimes by country. If you're searching Google for your APN, be aware that some carriers may list separate WAP APN or MMS APNs; you want to use the Generic or Internet APN.

There is no set structure to an APN. Here are some examples: broadband, internet, three.co.uk.

If you have set your APN correctly the Electron should proceed through the normal states: breathing white, blinking green, blinking cyan, fast blinking cyan, and finally to breathing cyan, even before you've claimed the Electron. In fact, the Electron must be in breathing cyan to complete the claiming process.

Some carriers may also require a username and password. Note those, if they are required, as well.

Select the type of cellular device you have:

Claiming an Electron or Boron manually

Once your device is breathing cyan after successfully setting the APN, you can claim it.

You'll need the device ID of your device. You can get it by putting the device in listening mode, blinking dark blue, by holding down the MODE button until the main status LED blinks blue, then issuing the CLI command:

particle identify

The device ID is different from your SIM ICCID.

Claiming from Particle Build (Web IDE)

Click the devices icon in the lower left corner of the Particle Build https://build.particle.io window.

Particle Build Devices Icon

At the bottom of your list of devices is Add New Device button. Click that and enter the device ID.

Claiming from Particle Dev (Atom IDE)

Using Particle Dev on Windows or Mac, select Claim Device... from the Particle menu and enter the device ID.

Claiming from the CLI

With the device in breathing cyan mode, issue the CLI command:

particle device add YOUR_DEVICE_ID

About keep-alive

When mobile devices, including phones and the Electron and Boron, connect to the Internet they share a connection through their mobile carrier, similar to how multiple computers in your home share a connection through your home router.

When the device sends data to the Particle cloud, the carrier also opens up a reverse channel to allow the Particle cloud servers to send data back to the device.

(Technically speaking, the device sends UDP data out, and the carrier creates port forwarding to a UDP listening port on the device to get data back.)

These return data channels take up resources on the carrier network, so they like to clean up the unused ones to free up the resources. The Particle SIM has an unusually long timeout of 23 minutes. Most carriers use a timeout of between 30 seconds and several minutes.

When the return channel is freed, the device will continue to breathe cyan, because it doesn't know that it has occurred. Also, it will still be able to send data to the cloud, so things like Particle.publish will work, and will also restart the return channel if it has been cleaned up.

The problem is that without a working return channel the following things don't work properly:

  • Subscriptions using Particle.subscribe sending data to the device
  • Calling Particle functions on the device
  • Getting the value of Particle variables on the device
  • OTA code flash

If you're using a 3rd-party SIM card you almost certainly will need to use the Particle.keepAlive() function. It's typically added to setup and the parameter is in seconds.

void setup()
{
    // Set the keep-alive value for 3rd party SIM card here
    Particle.keepAlive(120);
}

Each keep-alive ping uses 122 bytes of data, so you want to make it as long as possible for it to work with your carrier.

One way to determine the correct interval is to run the Tinker firmware on your device with the APN set. Reset the device then wait an interval before using a Particle function like:

particle call YOUR_DEVICE_NAME digitalWrite "D7=HIGH"
particle call YOUR_DEVICE_NAME digitalWrite "D7=LOW"

Find the longest interval where the calls still work, and that's what you should set as your keep-alive. It's usually between 30 seconds and several minutes.

For the Electron, also note that the keep-alive settings is only in device OS 0.5.0 and later, so if you have the original factory default firmware 0.4.8 you'll need to upgrade the Device OS.

In Device OS 0.6.2 through 0.8.0-rc.3, there is an issue where the Particle.keepAlive value does not stay properly set. The workaround is as follows:

Create a global variable, such as:

bool hasSetKeepAlive = false;

And add this to your loop:

    if (Particle.connected()) {
        if (!hasSetKeepAlive) {
            hasSetKeepAlive = true;
            Particle.keepAlive(120);
        }
    }
    else {
        hasSetKeepAlive = false;        
    }

Basically, you need to set the keep alive only after successfully connected to the Particle cloud, and every time you've disconnected.

More troubleshooting tips

Blinking Blue

If, when you power on the Electron, it's blinking dark blue (listening mode blue), the most common cause is that the SIM is loose. Try removing it and putting it back in again.

Or you can try to either gently lift the little metal prongs that contact the SIM with a pin (with power off and SIM card removed) or push down on the little metal holder to get a better contact.

Stuck on blinking green

If the Electron or Boron never progresses past blinking green, it probably can't contact a cellular tower. There are several possible reasons for this:

  • No coverage on the required band. For example, you have a 2G Electron but no 2G coverage. 2G coverage may be different than 3G, 4G or LTE coverage.
  • No coverage from the selected carrier/SIM.
  • Incompatible Electron (U260 when you need a U270 for example)
  • No LTE Cat M1 service for Boron LTE
  • Antenna problem

Also note that the 2G Electron is not supported in Japan, Australia, Korea, and Singapore, and has limited coverage in some parts of the United States. Other countries may phase out 2G as well, this is often referred to as "2G Sunset."

Blinking magenta

Blinking magenta is safe mode, and is an entirely different problem than connectivity. You can find more about safe mode in this post.