How to setup the third party SIM

I am trying to setup the third party SIM to use Electron.
But I can not find the method to enter the UserID and Password for cellular proveider APN.
Can I enter the UserID and Password in “You have a non-Particle SIM card” page?
https://setup.particle.io/

If you have already configured to work with Electron Particle SIM then just flash program with the following configuration:

// EXAMPLE - an AT&T APN with no username or password in AUTOMATIC mode

#include "cellular_hal.h"
STARTUP(cellular_credentials_set("broadband", "", "", NULL));

void setup() {
  // your setup code
}

void loop() {
  // your loop code
}

For more information see the following link. https://docs.particle.io/reference/firmware/electron/#setcredentials-

I understand to use the third party SIM when it is necessary to download the firmware that APN information was set at, and to write in it at a device, is it right?

Sort of.

You need the code outlined by @developer_bt in each of your applications - not only once

Thanks.
I tried this code.

#include "cellular_hal.h"
STARTUP(cellular_credentials_set("APN", "", "", NULL));
void setup() {
}
void loop() {
}

My Electron goes flashing green forever.
I thought it must have a USERID and PASSWORD for APN.

So I tried this code.

 #include "cellular_hal.h"
STARTUP(cellular_credentials_set("APN", "USERID ", "PASSWORD ", NULL));
void setup() {
}
void loop() {
}

My Electron goes flashing green forever.

So I tried this code.

SYSTEM_MODE(MANUAL);
int DoCommand( const char* command )
{

     ...
     int ret = Cellular.command(cb, resp, 256, buf);
     ...
}
void setup() {
}
void loop() {
            
    Cellular.on();
    ...
    DoCommand("AT+CGATT?");           // reset
    DoCommand("AT+UPSDA=0,0");        // reset
    DoCommand("AT+CMEE=2");           // Set the verbose error result codes 
    DoCommand("AT+CREG=1");           // Enable the network registration URC. 
    DoCommand("AT+UPSND=0,8");        // PSD profile status: if the profile is active the return value is 1, 0 otherwise
    DoCommand("AT+UPSD=0,0");         // 0 Proticol IPv4
    DoCommand("AT+UPSD=0,1,\"APN\"");         // 1 APN
    DoCommand("AT+UPSD=0,2,\"USERID\"");      // 2 User Name
    DoCommand("AT+UPSD=0,3,\"PASSWORD\"");    // 3 Password
    DoCommand("AT+UPSD=0,6,2");               // 6 authentication 2=CHAP
    DoCommand("AT+UPSD=0,7,\"0.0.0.0\"");     // 7 IP Address 0.0.0.0 = dynamic

    if( DoCommand("AT+UPSDA=0,3") != RESP_ERROR )   // activate
    {
        WaitURC("+UUSPDA:");
    }
    for( int i = 0; i < 60; i ++ )
    {
        int ret = DoCommand("AT+UPSND=0,0"); // IP address: dynamic IP address assigned 
                                             //during PDP context activation;
        if(ret == RESP_OK ) break;
            delay(1000);
        }
    }
    ...
}

Worked well.
But after a few days, I got following error when using the compile and download.

Error: 500. Please try again later. If the issue persists, please report to hello@particle.io. 

I thought that the cause of this error was caused by a fact that the registration to a cloud of SIM was not completed.
But the setup page does not have Field inputting a USERID and PASSWORD.

So I do not use the web site to register the third party SIM.
Do you have tasted whether works with Particle SIM?
Whether the card is factory-sized to nano or later you have the cut?
I had also a problem with incorrectly cut card resulting in a flashing green and then enters into listening mode.

Yes I have tested,my Electron is working well with Particle SIM.
The size in third party SIM is nano,I haven’t cut.

Would you mind posting your WaitURC() function

The function sends a CRLF, and waits for a response.

int WaitURC( char* waitText )
{
    char *buf = "\r\n";
    ...   
    for(int i = 0; i < 10; i ++)
    {
        ret = Cellular.command(cb, resp, 256, buf);
        if ( ret == RESP_OK )
        {
            if( strncmp(resp, waitText, strlen(waitText)) == 0)
            {
                break;
            }
        }
        delay(1000);
    }
    return(ret);
}

Thanks.

1 Like