Network selection

Here we will discuss how to perform:

  • Operator selection

  • Check current network

  • Check available networks

Operator selection

To force a SIM to a network, we can use the following AT command:

AT+COPS=<mode>,<format>,<operator>

Here <mode> determines if the network selection is done automatically or forced to a network specified in <operator> using the format specified in <format>.

Possible values for <mode> are as follows:

<mode>

Meaning

Actions

0

Automatic selection (<operator> field is ignored)

SIM will connect to any operator

1

Manual selection (<operator> field is mandatory)

SIM will only connect to the operator specified

2

Deregister from network

SIM will not connect to any operator

3

Sets the <format> for the read command +COPS? (<operator> field is ignored)

No attempt to connect/ disconnect

4

Manual selection, if possible (<operator> field is required). Switches to automatic (<mode>=0) if manual selection fails

SIM will attempt to connect to the operator specified and switch to any operator if that fails.

Possible values for <format> are as follows:

<format>

Meaning

0

<loperator> Long format alphanumeric (E.g. T-Mobile USA)

1

<soperator> Short format alphanumeric (E.g. TMO)

2

<noperator> Numeric (E.g. 310260) which is the Country and Network code (MCC, MNC)

The <operator> can be retrieved from the result of a AT+COPS=? to check available networks.

Some examples below of how to perform operator selection in various modes/ formats.

// Manual network selection with Long format alphanumeric format
AT+COPS=1,0,"TMO"
OK 

// Manual network selection with Short format alphanumeric format
AT+COPS=1,1,"T-Mobile USA"
OK 

// Manual network selection with Numeric format
AT+COPS=1,2,"310260"
OK 

// Deregister from network
AT+COPS=2
OK

Check current network

To check the network registration status of the SIM, we can use the following AT command:

AT+COPS?

This command returns the current <mode> and currently selected operator. If operator is not selected the <operator> and <format> are omitted. The results of the command could be as follows:

<mode>

Meaning

0

Automatic selection, registered to network if <operator> and <format> are present

1

Manual selection, registered to network if <operator> and <format> are present

2

Deregistered from network

4

Manual selection, if possible, registered to network if <operator> and <format> are present

Examples below:

// Registered to GSM network with automatic operator selection
AT+COPS?
+COPS: 0,0,"AT&T"
OK 

// Registered to GSM network with manual operator selection
AT+COPS?
+COPS: 1,0,"AT&T"
OK 

// Not registered to GSM network
AT+COPS?
+COPS: 2
OK

Check available networks

To scan and report visible networks the network registration status of the SIM, we can use the following AT command:

AT+COPS=?

This command returns a list of quadruplets, each representing an operator present on GSM network followed by a list of supported modes and formats.

The quadruplet consists of:

+COPS: <status>,<loperator>,<soperator>,<noperator>

where the status carries the following meaning:

Status

Meaning

0

Unknown

1

Available

2

Current

3

Forbidden

Examples below:

// Currently on AT&T and T-Mobile is available
AT=COPS=?
+COPS: (2,"AT&T","AT&T","310410"),(1,"T-Mobile USA","TMO","310260"),(0,1,4),(0,1,2)
OK 

// Currently on AT&T and T-Mobile is forbidden
AT=COPS=?
+COPS: (2,"AT&T","AT&T","310410"),(3,"T-Mobile USA","TMO","310260"),(0,1,4),(0,1,2)
OK

Last updated