Create and configure a LTE object. See __init__ for params of configuration.
from LTE import LTE lte = LTE()
This method is used to set up the LTE subsystem. Optionally specify
carrier name. The currently available options are:
carrier name
'att'
'verizon'
'standard'
'docomo'
'kddi'
'telstra'
'tmo'
'verizon-no-roaming'
'3gpp-conformance'
cid is the connection id. Most operators use cid=1 except Verizon which uses cid=3 when using a Verizon issued SIM card
cid
mode is LTE.CATM1 or LTE.NBIOT. If not specified, modem will use current setting
mode
baudrate is the speed with which the modem is operating. Default is 115200bps
baudrate
debug. True or False, display additional debugging output
debug
Disables LTE modem completely. This reduces the power consumption to the minimum. Call this before entering deepsleep. Optional parameter reset was added for compatibility with legacy code and is not used
Enable radio functionality and attach to the LTE network authorised by the inserted SIM card. Optionally specify:
band
None
1,2,3,4,5,8,12,13,17,18,19,20,25,26,28,66 or 71
bands
apn
LTE.\_\_init()\_\_
LTE.connect()
type
IP
IPV4V6
Returns True if the cellular mode is attached to the network. False otherwise.
True
False
Returns True if the cellular mode is attached to the network. False otherwise. Same as lte.isattached() and provided for compatibility with legacy scripts
lte.isattached()
Gracefully detach the modem from the LTE-M network and disable the radio functionality.
Start a data session and obtain and IP address. Optionally specify a CID (Connection ID) for the data session. The arguments are:
LTE.__init()__
LTE.attach()
Returns True if there is an active LTE data session and IP address has been obtained. False otherwise.
End the data session with the network.
Send an AT command directly to the modem. Returns the raw response from the modem as a string object. You can find the possible AT commands here.
If a data session is active (i.e. the modem is connected), you will need to lte.pppsuspend() and lte.pppresume around the AT command.
lte.pppsuspend()
lte.pppresume
Example:
lte.send_at_cmd('AT+CEREG?') # check for network registration manually (sames as lte.isattached())
Optionally the response can be parsed for pretty printing:
timeout
wait_ok_error
AT+SQNINS
wait_ok_error=True
check_error
Perform a hardware reset on the cellular modem. This function can take up to 5 seconds to return as it waits for the modem to shutdown and reboot.
Suspend PPP session with LTE modem. this function can be used when needing to send AT commands which is not supported in PPP mode.
Resumes PPP session with LTE modem.
If no parameter is specified, return the current operating mode (0 for LTE.CATM1 and 1 for LTE.NBIOT) If new_mode is specified, switches the modem into the specified operating mode. Use LTE.CATM1 or LTE.NBIOT Example: lte.mode(new_mode=LTE.CATM1)
new_mode
lte.mode(new_mode=LTE.CATM1)
The modem will reset and switch to the new operating mode
Turn the LTE modem power on. Will optionally wait until the modem answers with OK.
Turn off power to the LTE modem. Will gracefully shut down the LTE connection unless force=True is used.
Check if a SIM card is present and readable
Returns True if the lte module is powered on, otherwise false
Removes unnecessary line feed and OK/ERROR output from a modem response before printing the response on the REPL
Removes unnecessary line feed and OK/ERROR output from a modem response before returning the resp
This function allows reading unsolicited responses from the modem. These are responses sent by the modem without being requested using lte.send_at_cmd(). The response can be formatted with lte.return_pretty_response and lte.print_pretty_response if desired.
lte.send_at_cmd()
lte.return_pretty_response
lte.print_pretty_response
Function will raise an exception if the modem is in active ppp mode.
Function will return a tuple of IP address information from the PPP stack
LTE.CATM1
LTE.NBIOT