Tethering
Tethering is a feature in Device OS 6.2.0 that allows another device to communicate with the Internet using a Particle B-Series SoM cellular modem. This can be used from a Raspberry Pi, for example, to allow it to access the Internet through the Particle B-SoM cellular device.
Requirements
LTE Cat 1 cellular module
This features requires a LTE Cat 1 cellular module, available on these SKUs.
SKU | Description | Modem | Region | Gen | Lifecycle |
---|---|---|---|---|---|
B504MEA | B-Series LTE CAT-1/3G (NorAm, EtherSIM), [x1] | EG91-NAX | NORAM | 3 | GA |
B504MTY | B-Series LTE CAT-1/3G (NorAm, EtherSIM), [x50] | EG91-NAX | NORAM | 3 | GA |
B524MEA | B-Series LTE CAT-1/3G/2G (Europe, EtherSIM) [x1] | EG91-E | EMEAA | 3 | GA |
B524MTY | B-Series LTE CAT-1/3G/2G (Europe, EtherSIM), Tray [x50] | EG91-E | EMEAA | 3 | GA |
You cannot use a LTE Cat M1 module, such as the B404X, Boron 404X, or M404.
Serial connection
Tethering uses a UART serial connection between the other device (such as a Rasbperry Pi) and the Particle device. Hardware flow control (RTS/CTS) is recommended, as is using a high baud rate. 921600 baud works well.
All current Particle devices have 3.3V logic on UART ports, so if your other device is a 5V device, it would need level shifters. Raspberry Pi devices are 3.3V.
PPP support
Over this serial connection PPP (point-to-point protocol) is used. This allows the other device to get an IP address and use features like TCP, UDP, and DNS to transmit data to and from the Internet.
It is not restricted to using the Particle cloud, but it cannot establish permanent listening sockets for TCP or UDP because these are not supported by the cellular networks.
Note that the other device must support PPP, so you cannot use this for devices like Arduino that do not support PPP over UART serial as a network connection.
Data usage
Tethering can use a very large amount of cellular data. Caution should be used with the existing Particle data plans as you can easily exceed your allowed cellular data limit.
Contact sales if you have a need for higher data allowances.
Application firmware
In order to use tethering, it must be enabled:
For information about the Tether
class, see the Device OS API reference.
TCP and UDP
It is possible to use TCPServer, TCPClient, and UDP to communicate between the other device and the Particle device over TCP or UDP over the tethering connection.
When binding listening connections, or making an outgoing connection or sending packets,
an optional nif
specifies the network interface to use. This can be Tether
for the
tethering interface.
Particle M.2 breakout
If you are using the M.2 breakout board or M.2 evaluation board with the B504 and B524, you will be using these pins on the expansion header.
SoM custom board
If you are using your own custom board you will be using these pins on the B504 and B524 B-Series SoM.
Pin | Pin Name | Description | Interface | MCU |
---|---|---|---|---|
36 | TX / D9 | Serial TX, GPIO | Serial1 TX | P0.06 |
38 | RX / D10 | Serial RX, GPIO | Serial1 RX | P0.08 |
40 | D3 | SPI1 MOSI, Serial1 CTS, GPIO, Wire1 SCL | Serial1 CTS | P1.01 |
42 | D2 | SPI1 SCK, Serial1 RTS, PWM, GPIO, Wire1 SDA | Serial1 RTS | P1.02 |
Raspberry Pi
If using a Raspberry Pi as the other device, you must configure it to establish a PPP connection over its serial port instead of Ethernet or Wi-Fi.
- Be sure to cross TX ↔ RX and CTS ↔ RTS between the Pi and the B-SoM. For example, the Particle TX connects to the Pi RX.
- Be sure the GND pin is connected between the Pi and the B-SoM.
- Do not connect 3V3 or 5V between the Pi and B-SoM!
- You may connect the Pi 5V to Particle device VIN if you are powering the Particle device from the Pi hat connector.
Serial connections - Raspberry Pi 5
The setup script, below, uses UART0 for the tethering connection on the Raspberry Pi 5.
Pi Pin Num | Pi GPIO | Pi Function | ↔ | Particle Name | Particle Function |
---|---|---|---|---|---|
8 | GPIO14 | UART0_TX | RX | Serial1 RX | |
10 | GPIO15 | UART0_RX | TX | Serial1 TX | |
36 | GPIO16 | UART0_CTS | D2 | Serial1 RTS | |
11 | GPIO17 | UART0_RTS | D3 | Serial1 CTS | |
6 | GND | GND |
If you wish to use a different port, the following ports are available on the Raspberry Pi 5.
Serial connections - Raspberry Pi 4
Pi Pin Num | Pi GPIO | Pi Function | ↔ | Particle Name | Particle Function |
---|---|---|---|---|---|
27 | GPIO0 | UART2_TX | RX | Serial1 RX | |
28 | GPIO1 | UART2_RX | TX | Serial1 TX | |
3 | GPIO2 | UART2_CTS | D2 | Serial1 RTS | |
5 | GPIO3 | UART2_RTS | D3 | Serial1 CTS | |
6 | GND | GND |
If you wish to use a different port, the following ports are available on the Raspberry Pi 4. Note that you should not use UART0 as it does not support flow control.
Setup script - Raspberry Pi
The script below makes it easy if you are using Debian 12 "bookworm" for 32-bit or 64-bit ARM on a Raspberry Pi 4 or Raspberry Pi 5.
Download and run this script on your Raspberry Pi:
bash enable-tethering.sh
This script:
- Disables the linux serial console on the USART needed for tethering
- Enables a USART with flow control on the USART pins
- Disable sany PPP options, create default options for the new tty PPP device
- Adds udev rules for the new PPP tty device
- Scans for the modem in modem manager
- Creates a connection to the modem using NetworkManager
Manual setup - Raspberry Pi
If you prefer to set up the connection manually, these notes may be helpful.
Manual Linux setup notes