LTE Examples

The following tutorial demonstrates the use of the LTE CAT-M1 and NB-IoT functionality on cellular enabled SG modules.

For F1 Starter Kit purchaser, a pre-registered SIM card is provided in the F1 Starter Kit. In case you would like to use your own SIM card, please make sure that your SIM card is registered and activated with your carrier.

This page discusses the usage of the LTE modem in more detail:

General remarks

To check the current modem firmware, you can use the following commands:

from LTE import LTE
lte = LTE()
print(lte.send_at_cmd('ATI1'))

To check whether the LTE connection has establised, you can use one of the following commands:

from LTE import LTE
lte = LTE()
print(lte.isconnected()) #if True is returned, that means LTE connection is established

Note: the first time, it can take a long while to attach to the network.

SG SIM card

For F1 Starter Kit purchaser, a pre-registered and pre-setup SIM card is placed inside the SIM card slot on the F1 Starter Kit.

There is pre-stored value in each SIM card for use. The SIM card is suppose to support nominal development/evaluation and operating under nominal IoT application data usage. In case you need to implement data-heavy applications or would like to have batch deployment of LTE-enabled devices, please contact SG sales representative for enquiry and special discussions.

 

LTE Connectivity check

To check whether the LTE connection has establised, you can use one of the following commands:

from LTE import LTE
lte = LTE()
print(lte.isconnected()) #if True is returned, that means LTE connection is established

LTE Mode check and LTE Mode switching

For F1 Starter Kit pre-registered and pre-setup SIM card, suppose the LTE mode is well setup for the users base on purchasing order.

In case you are using your own SIM card, and would like to check the current LTE mode(Cat-M1 or NB-IoT) and swtich your LTE mode (Cat-M1 or NB-IoT), you can use the following commands:

from LTE import LTE
lte = LTE()
lte_mode = lte.mode() # Return current mode
if lte_mode == LTE.CATM1:
    print(‘Modem is in CAT-M1 mode!’)
if lte_mode == LTE.NBIOT:
    print(‘Modem is in NB-IoT mode!’)

# The below will automatically reset the modem
lte.mode(LTE.CATM1) # switch to CAT-M1
lte.mode(LTE.NBIOT)  # switch to NB-IoT

Note: If you are using your own SIM card and would like to change LTE mode, please check carefully with your network service provider whether the LTE mode you would like to change is supported or not.

Custom APN setting

In case you are using your own SIM card with different service provider, the APN (Assess point name) should be changed and set correctly.

Below please find the command for setting custom APN:

from LTE import LTE
import time
lte = LTE()
lte.attach(apn=’iot.1nce.net’) #use 'iot.1nce.net' if you use SG SIM card, change to another apn according to your ISP if you use your own SIM card
while not lte.isattached():
    time.sleep(1)
lte.connect()
while not lte.isconnected():
    time.sleep(1)