LTE models

Patron

Looking for a guide how to get started with LTE on Mervis IDE? Please see this tutorial, otherwise continue here.

Patron units are shipped with the Mervis OS pre-installed. If you do not want to use Mervis, you must first re-flash the OS on the unit.

This manual refers to the LTE series of Patron units - currently S167, M267 and M567.

  1. Insert a micro-sim supporting LTE data into the slot
  2. Connect to the unit via SSH
  3. Install the unipi-lte package:
    sudo su
    apt-get update
    apt-get install unipi-lte
    systemctl enable unipi-lte 
    reboot
  4. Check the status of the unipi-lte service using the command:
    systemctl status unipi-lte
    * unipi-lte.service - LED indication of embedded GSM/3G/LTE module status
        Loaded: loaded (/lib/systemd/system/unipi-lte.service; enabled; vendor preset: enabled)
        Active: active (running) since Thu 2023-07-20 07:57:07 UTC; 9min ago
      Main PID: 393 (python3)
        Tasks: 1 (limit: 796)
        Memory: 16.6M
        CGroup: /system.slice/unipi-lte.service
                `-393 python3 /opt/unipi/tools/unipi-lte.py

    If the operator uses the APN value internet and the SIM card is not protected by a PIN, there is no need to set anything and you can skip steps 5 to 7.

  5. Start editing the lte.conf file, e.g. with MidnightCommander:
    mc -e /etc/unipi/lte.conf
  6. If the SIM card is PIN protected, set the correct PIN and uncomment the line:
    pin: 1234 ;
  7. The APN setting is mandatory (if this line is missing or commented out, the LTE service is disabled). The first parameter IPV4V6 is mandatory, the second parameter is the APN and the correct value is determined by the operator, the default value is internet:
    apn: "IPV4V6","internet" ;
  8. Save and exit editing the file and restart the unit with the command:
    reboot

Be patient, registration to the mobile network can take several minutes. When registered, NET LED lights up.


  1. During normal operation, “Mobile network” LED indicators SIM, NET, INT should be ON while blinking SIG indicates signal strength. See LED Indicators table.
  2. In case of any problem, we recommend that you check the unipi-lte service log file. The log is described in detail in chapter Log File.
LED OFF ON Flashing
SIM LTE service (daemon) is not active
(disabled or not installed)
SIM is OK Slow - No sim inserted (or SIM corrupted)
Fast - wrong PIN
NET Not registered to LTE network Registered to network
SIG No signal Excellent signal Signal quality - faster ∼ better
INT No WAN access Unit online, backup active
(or single interface only)
Slow - connected via the primary WAN interface, backup inactive
Fast - connected via backup WAN interface

All LEDs flashing — LTE module is restarting.

  • for optimal signal strength it is necessary to use an external antenna installed in an open area (eg. outside any enclosures). An external antenna is included in the package of each LTE controller - during the purchase, you can choose between the default antenna with magnetic mount or a larger one with on-wall mount. Both antennas can be also purchased separately.
  • By default, Ethernet is set as the primary network interface and LTE as the backup interface. Changing the primary interface is possible in the configuration file in the PING section.
  • WAN connection availability is determined by ping to 8.8.8.8. The IP address and ping interval can be set in the configuration file in the PING section.

Configuration File

The lte.conf configuration file is available in the /etc/unipi/ directory. Editing the file is possible e.g. with MidnightCommander:

mc -e /etc/unipi/lte.conf

This file is divided into three sections, some settings (auto_keepon, autoswitch, Log File) are described in detail in separate chapters.

MAIN

pin: 1234 ; Uncomment and set it if SIM pin is active (ignored if SIM is not pin-protected).
apn: "IPV4V6","internet" ; APN (depends on your provider)
auth_method: 0 ; PPP Authentication: 0 - no auth.(default), 1 - PAP, 2 - CHAP (Axon only feature)
auth_user: ; Username for PAP/CHAP auth methods (Axon only feature)
auth_pass: ; Password for PAP/CHAP auth methods (Axon only feature)
usbmode: 2 ; 2(default) for CDC_ECM + 3x CDC_ACM, 3 for RNDIS + 1x CDC_ACM (Axon only feature)
oneshot: false ; LTE modem initialization only. Close ttyACM and exit the dameon. No LED handling! Default: FALSE.
reg_timeout: 120 ; In seconds
suspend_timeout: 43200 ; In seconds (e.g. 86400 = 24 hours),-1 = suspend forever (goes to HALT mode)
report_period: 86400 ; In seconds (e.g. 86400 = 24 hours)
auto_keepon: true ; Automatically up the LTE network interface if it goes down accidentally.
  • pin: if the SIM is protected by PIN code it is necessary to enter it here, if the SIM is not protected by PIN code just comment the line (with semicolon “;”)
  • apn: Access Point Name ; the first parameter IPV4V6 define the APN protocol, it is mandatory and must not be changed or deleted ; the second parameter is the APN, where the default value is the internet, this value can be different and is determined by the operator
  • auth_user: user name ; if authentication is required
  • auth_pass: user password ; if authentication is required
  • oneshot: performs only the initialization and then exits
  • reg_timeout: the time in seconds thet the modem attempts to register with the operator's network
  • suspend_timeout: delay between modem re-initializations, if an error occurs (default: 34200 seconds, i.e. 12 hours)
  • report_period: frequency with which the periodic report is written to the log (default: 86400 seconds, i.e. 24 hours)
  • auto_keepon: if an accidental disconnection occurs and is set to true, the connection is automatically restored ; this parameter is detailed in the auto_keepon chapter

The auth_method and usbmode parameters are not used and are present only for backward compatibility.

LOG

Logs are stored in the log file for debugging and possible troubleshooting. For a detailed description of the log file, see the Log File chapter.

path: /var/log/unipilte.log ; If not defined (commented), syslog is used instead of an user file
severity: info ; Severity threshold - debug, info, warning, error, cititical
logfile_size: 131072 ; Meaningless if syslog is used
  • path: location of the log file; if not defined, messages will be written to the syslog
  • severity: severity of the message to be logged
  • logfile_size: log file size

PING

active: True
primary_iface: eth0 ; Primary WAN interface. The LTE connection is always a backup one.
fail_threshold: 3 ; Default: 3
ip_eth: 8.8.8.8 ; Adress that the daemon pings to via ethernet interface
ip_lte: 8.8.8.8 ; Adress that the daemon pings to via lte interface
period: 4 ; Ping period given in 10 sec timesteps; 0 - every 10 sec
timeout: 2 ; Wait for pong in seconds
packetsize: 2 ; Payload size in ping packet
autoswitch: true ; MAIN/BACKUP iface switching - set false if LTE is the primary and the ONLY active interface

; Config file signature - do not modify it nor add any lines or whitespaces!
; c3c9959c716370b33d07652529503f6e
  • active: enable periodic ping retries to the configured addresses
  • primary_iface: primary network interface
  • fail_threshold: the number of times a connection is attempted before the device switches to the backup network interface
  • ip_eth: the address that the daemon is trying to ping over the ethernet network interface (eth0)
  • ip_lte: the address that the daemon is trying to ping over the lte network interface (wwan0)
  • period: time between contact attempts, 0 → 10s, 1 → 20s, 3 → 40s, etc. ; in 10s increments
  • timeout: time to wait for a response in seconds
  • packetsize: size of the ping sent in packets
  • autoswitch: enable/disable the autoswitch feature, set True to enable, False to disable, see Autoswitch feature for details

Autoswitch feature

When Autoswitch feature is enabled (default state), service unipi-lte automatically selects the default network gateway based on WAN availability on the primary/backup network interface. By default, the primary network interface is fixed Ethernet (eth0) and the LTE interface is the backup connection. The Linux routing table must always contain the default routing for both interfaces. If there is a need to switch between the primary and backup interfaces, the unipi-lte service will automatically increase/decrease the LTE interface metric.

In order to switch between the primary and backup interfaces, it is necessary that the metric values of all network interfaces are non-zero positive values.

  • IP address from the DHCP server: There is no need to set anything, as the (non-zero) metric is set by the DHCP client.
  • Static IP address: You must always set a non-zero metric value manually, as the default static routing is set to metric 0. Metric can be set in the network interface configuration file within etc/network/interfaces.d by inserting a constant, such as metric 5.
    For interface eth0, the contents of the file etc/network/interfaces.d/eth0 with static IP configuration will look something like this:
    # Example of static IP configuration for a unit on a LAN
    
    auto eth0
    iface eth0 inet static
      address 192.168.221.188
      gateway 192.168.221.1
      netmask 255.255.255.0
      dns-nameservers 192.168.221.1
      metric 5 # Non-zero positive value

The Autoswitch feature can be disabled in the configuration file in the PING section of the unipi-lte service. Feature is turned on/off by setting the values True/False.

Autokeepon feature

The auto_keepon feature is also available, which automatically enables the LTE network interface when it is accidentally disabled (e.g. by an ifdown command). In this case, the feature re-enables the interface (ifup) and updates the routing table entries. The feature is enabled by default and can be disabled in the configuration file in the MAIN section.

Log File

The log file is invaluable for debugging. By default, all relevant logs from unipi-lte are stored in /var/log/unipilte.log. The location and severity of the logs can be set in the configuration file in the LOG section.

Example of log file

2023-07-25 08:33:00,047 - INFO - unipi-lte version 0.36 from 2023-03-14 10:19:01 - Logging started..
2023-07-25 08:33:00,052 - INFO - Running on Patron series, model: S167
2023-07-25 08:33:01,067 - INFO - Created/corrected wwan0 iface file
2023-07-25 08:33:02,143 - ERROR - Incorrect or undefined password (PIN). Going to sleep...
2023-07-25 08:33:02,144 - WARNING - Daemon halted forever...must be restarted manually 3
2023-07-25 08:36:06,945 - INFO - Exiting after received signal 15
2023-07-25 08:36:18,065 - INFO - unipi-lte version 0.36 from 2023-03-14 10:19:01 - Logging started..
2023-07-25 08:36:18,071 - INFO - Running on Patron series, model: S167
2023-07-25 08:36:19,084 - INFO - Created/corrected wwan0 iface file
2023-07-25 08:36:20,597 - INFO - Pin resolved
2023-07-25 08:36:36,942 - INFO - Modem init complete
2023-07-25 08:36:37,546 - INFO - Registered to: O2.CZ Network type: 7 RSSI: 31 Sigqual: 99
2023-07-25 08:36:40,562 - INFO - WAN IP ADDRESS: 100.71.129.7 INTERFACE IP ADDRESS: 100.71.129.7
2023-07-26 08:36:18,370 - INFO - RSSI: (MIN 21, MAX 31, AVG 25), SIGQUAL: 99, NET-TYPES: ['7'], USED_MODES: {6} PING_COUNT: 1727 PING_SUCCESS_RATIO: 99.94
2023-07-26 21:55:06,956 - INFO - Ping failure threshold reached 3 on main eth0.Switching to backup wwan0...
2023-07-26 22:06:48,490 - WARNING - Routing table metric mismatch A (changed by other application?), re-setting... 203 202
2023-07-26 22:21:49,183 - WARNING - Routing table metric mismatch A (changed by other application?), re-setting... 203 202
2023-07-26 22:36:47,974 - WARNING - Routing table metric mismatch A (changed by other application?), re-setting... 203 202
2023-07-26 22:47:38,255 - INFO - Main interface eth0 becomes available, switching to it
2023-07-27 08:36:25,783 - INFO - RSSI: (MIN 17, MAX 31, AVG 23), SIGQUAL: 99, NET-TYPES: ['7'], USED_MODES: {4, 6} PING_COUNT: 1727 PING_SUCCESS_RATIO: 99.36
2023-07-28 08:36:33,574 - INFO - RSSI: (MIN 18, MAX 31, AVG 24), SIGQUAL: 99, NET-TYPES: ['7'], USED_MODES: {6} PING_COUNT: 1726 PING_SUCCESS_RATIO: 99.94
2023-07-29 08:36:41,673 - INFO - RSSI: (MIN 21, MAX 31, AVG 24), SIGQUAL: 99, NET-TYPES: ['7'], USED_MODES: {6} PING_COUNT: 1727 PING_SUCCESS_RATIO: 100.00
2023-07-30 08:36:49,334 - INFO - RSSI: (MIN 21, MAX 31, AVG 24), SIGQUAL: 99, NET-TYPES: ['7'], USED_MODES: {6} PING_COUNT: 1727 PING_SUCCESS_RATIO: 99.94
2023-07-31 08:36:57,165 - INFO - RSSI: (MIN 17, MAX 31, AVG 24), SIGQUAL: 99, NET-TYPES: ['7'], USED_MODES: {6} PING_COUNT: 1727 PING_SUCCESS_RATIO: 99.83

  • 2023-07-25 08:33:00: Initialization and start of connection
  • 2023-07-25 08:33:02: Error caused by wrong PIN
  • 2023-07-25 08:36:20: Correct PIN code entered
  • 2023-07-25 08:36:40: Connection to LTE network successfully established
  • 2023-07-25 21:55:06: eth0 network failure, Unipi device switching to backup LTE connection
  • 2023-07-25 22:47:38: eth0 network available again
  • 2023-07-2x 08:36:xx: Periodic report, the frequency of the report can be set with the report_period parameter in the configuration file in the MAIN section.

Disabling/Enabling NAT for LTE modem:

By default, NAT is enabled. To turn it off/on, you need to send a specific AT command to the modem via the virtual serial line:

  1. communication is possible via the virtual serial line /dev/ttyLTE_AT1 (e.g. by the minicom):
    minicom -D /​dev/​ttyLTE_AT1​
  2. then you need to send the string (AT disable command):
    AT+QCFG="​nat",​X

To disable NAT it is necessary to set parameter 1 instead of X, or parameter 0 to enable it.

After sending the command and exiting the minicom program, it is necessary to restart the modem for the settings to take effect. Restart is possible e.g. by unplugging/plugging the power supply of the controller.


Note: The string (AT command) must be entered in the exact format, including case sensitivity. A proven method is, for example, to copy the entire AT command string and then paste it into the terminal window running minicom.

Note on minicom: To exit the minicom, press the CTRL+A key combination, followed by the Q key, which brings up a dialog where you still need to confirm the exit.