Milesight UR32 4G Python Edge Computing

Milesight Edge Computing Python SDK Industrial Router June 2026

The Milesight UR32: Industrial Edge Computing for Python Developers

A 4G router that runs Python, reads RS485 sensors, fires digital outputs, and sends data to the cloud – without a separate edge server, without a Raspberry Pi, and without SD card corruption at 2am.

If you have been building remote monitoring or industrial automation projects with a Raspberry Pi and a USB 4G modem, you already know the real cost. It is not the hardware – it is the SD card that corrupts at a remote site three hours away. The watchdog script that silently fails. The USB modem that drops its driver after a power cycle. The enclosure you had to source separately.

The Milesight UR32 solves every one of those problems in a single DIN-rail device. It is an industrial 4G router with an embedded Python 3.7 SDK, a native RS485 port, galvanic-isolated digital I/O, dual SIM with automatic carrier failover, a hardware watchdog, and an operating temperature range of -40 to +70°C. Your Python application logic runs directly on the device. No separate edge server. No cloud dependency for local decisions.

Most people selling the UR32 describe it as an industrial cellular router. That framing is accurate but incomplete. For engineers who work in Python and need a reliable field device, it is a low-cost industrial edge computer with built-in 4G.

In short: the UR32 is what you get when you take a Raspberry Pi project that has been to a production field site and got badly burned, then rebuild it properly. Same Python. Completely different hardware story.

4G LTECat 4
Dual SIMAuto failover
RS485Modbus RTU/TCP
DIOGalvanic isolated
Python 3.7Embedded SDK
-40/+70°CRated temp
9-48V DCWide input
IP30DIN rail

Milesight UR32 vs Raspberry Pi: the honest industrial comparison

The Raspberry Pi is excellent for prototyping. It is not designed for unattended industrial deployment. Here is a direct comparison for a typical remote monitoring application – the kind where a site visit costs £300 and takes half a day:

Requirement Raspberry Pi 4 Milesight UR32
4G connectivity✗ USB modem or HAT, driver risk✓ Embedded Cat 4 modem
Dual SIM failover✗ Not possible✓ Automatic carrier switching
RS485 / Modbus✗ USB-serial adapter, latency✓ Native RS485 port
Galvanic isolated DIO✗ Bare GPIO, no isolation✓ Isolated DI + DO
Python runtime✓ Full Python 3.x + pip✓ Python 3.7 SDK
Hardware watchdog✗ Workarounds, unreliable✓ Built-in, automatic
Storage reliability✗ SD card corruption under power loss✓ Industrial flash + optional MicroSD
Operating temperature✗ 0 to +50°C✓ -40 to +70°C
Power input✗ 5V USB-C only✓ 9-48V DC wide input
Enclosure✗ Source and fit separately✓ DIN rail, IP30, wall mount
VPN built in✗ Software install and maintain✓ WireGuard, OpenVPN, IPsec
Remote management✗ Build your own✓ Milesight Development Platform
Modbus gateway mode✗ Custom script required✓ Firmware-level, no Python needed
DLMS / smart metering✗ Not supported✓ Native DLMS client

The summary: the Raspberry Pi wins on raw compute power and Python library depth. For any application where the device sits in a panel or cabinet and needs to run reliably for years without intervention, the UR32 wins on every dimension that matters operationally.

Python on the UR32: Modbus RTU to MQTT in practice

The Python SDK installs via the router web GUI under APP > Python > SDK Upload. Scripts run directly on the device and have access to the RS485 serial port, digital I/O, modem status, and network stack. A Modbus RTU to MQTT gateway – one of the most commonly searched industrial IoT requirements – is a short, readable script:

Python 3.7 – Milesight UR32 – Modbus RTU to MQTT (illustrative pattern)
# RS485 Modbus RTU sensor - read and publish to MQTT over 4G
import minimalmodbus
import paho.mqtt.client as mqtt
import json, time, logging

logging.basicConfig(level=logging.INFO)

# RS485 instrument on /dev/ttyS1 (UR32 serial port)
sensor = minimalmodbus.Instrument('/dev/ttyS1', 1)
sensor.serial.baudrate = 9600
sensor.serial.timeout  = 1

# MQTT broker - AWS IoT, Azure, HiveMQ, EMQX, or self-hosted
BROKER = 'mqtt.your-broker.io'
TOPIC  = 'site/pumpstation1/telemetry'

client = mqtt.Client()
client.connect(BROKER, 8883)
client.loop_start()

while True:
    try:
        level_mm = sensor.read_float(1, functioncode=3)
        temp_c   = sensor.read_register(3, 1, functioncode=3)

        payload = json.dumps({
            'level_mm'  : round(level_mm, 1),
            'temp_c'    : temp_c,
            'timestamp' : time.time()
        })

        client.publish(TOPIC, payload, qos=1)
        logging.info(f'Published: {payload}')

    except Exception as e:
        logging.error(f'Read error: {e}')

    time.sleep(60)

That script runs on the UR32 itself. No laptop. No cloud VM. No separate edge server. The hardware watchdog restarts the device automatically if it locks up. Dual SIM keeps the MQTT connection live if one carrier has an outage. The MicroSD slot provides local data buffering if connectivity drops – write to file on publish failure, replay the buffer when connectivity resumes.

The edge-to-cloud data flow

The UR32 sits at the junction between field hardware and cloud infrastructure. The Python layer handles local decisions before any cloud involvement:

RS485 Sensor
UR32 Python layer
MQTT over 4G
AWS IoT / Azure / EMQX
Dashboard / SCADA
Digital Input
UR32 Python layer
Digital Output
+
SMS alert
+
MQTT alarm

Local decision-making means sub-second response for alarms and relay control with no dependency on cloud latency. Cloud connectivity provides visibility, logging, and remote configuration.

Fourteen industrial applications

Any application combining serial sensors or PLCs, cellular connectivity, and a requirement for reliability where site visits are expensive is a strong candidate:

Tank level monitoring

RS485 ultrasonic or pressure transmitter. Python polls on interval, publishes to cloud, triggers relay on alarm.

Water treatment telemetry

Flow, pH, turbidity meters via Modbus RTU. Bridges to SCADA over MQTT or Modbus TCP without a separate converter.

Remote PLC diagnostics

Transparent RS485 or Modbus gateway to PLC. Engineer connects via WireGuard VPN over 4G without a site visit.

Solar inverter monitoring

Inverters with Modbus RTU. Python reads generation and fault data, forwards to energy management platform.

Generator monitoring

Generator controllers via RS485. Python reads run hours, fuel level, fault codes. SMS and MQTT alert on alarm.

EV charger connectivity

4G uplink for OCPP. DIO monitors charger status relay. Python handles fault detection and heartbeat monitoring.

BESS / grid storage

Dual SIM on separate MNOs for resilience. DNP3 SCADA over TCP. GPS NTP sync. NIS compliance capable.

Cold storage alarms

Temperature probes via Modbus. DI monitors door and power-fail contacts. MQTT alarm on threshold breach.

Smart metering / DLMS

Native DLMS client – ideal for substation automation, smart meter data collection, and grid monitoring.

Agricultural irrigation

Soil moisture sensors via RS485. Python evaluates threshold and controls valve relay via digital output.

Building management

BMS controllers with Modbus. UR32 as cellular gateway where fixed broadband is unavailable or as WAN backup.

Environmental monitoring

Air quality, weather, noise sensors on RS485. Python pre-aggregates readings before cloud publish.

Fuel tank monitoring

Level probe on RS485. Python calculates consumption rate locally and pushes metrics to fleet dashboard.

Pump station automation

Read pump run signals via DI, control start/stop via DO, publish operational data via MQTT.

Solution Finder

Find your problem. Find the answer.

Engineers searching for industrial Python gateways, Modbus converters, cellular telemetry devices, and Raspberry Pi alternatives all arrive at the same hardware. Here is how the UR32 maps to the most common requirements.

I need to read RS485 sensors and send data to the cloud over 4G

“rs485 to cloud gateway” / “rs485 4g iot gateway”

The UR32 has a native RS485 port with Modbus RTU/TCP gateway mode built into the firmware – no Python required for basic polling and forwarding. The Python SDK adds threshold alerts, data aggregation, and payload formatting for any cloud endpoint.

I want a Modbus to MQTT gateway with 4G connectivity

“modbus to mqtt gateway” / “modbus rtu mqtt bridge” / “mqtt gateway rs485”

This is the UR32’s core use case. RS485 Modbus RTU instruments connect directly to the serial port. Python reads registers, formats JSON, and publishes to any MQTT broker – AWS IoT Core, Azure IoT Hub, HiveMQ, EMQX, or self-hosted Mosquitto. Milesight provide working AWS IoT example scripts.

I need an industrial alternative to a Raspberry Pi for field deployment

“raspberry pi industrial alternative” / “industrial raspberry pi replacement”

The UR32 is the direct answer. Same Python runtime, no SD card corruption, no USB modem driver failures, no sourcing an enclosure. Hardware watchdog, -40 to +70°C rating, 9-48V DC input, DIN rail mount, dual SIM. Built-in VPN replaces the OpenVPN install you maintain on the Pi.

I need to run Python logic at the network edge without a cloud dependency

“edge computing gateway python” / “industrial python controller” / “python at the edge”

The UR32 Python SDK runs scripts locally on the device. Threshold decisions, relay control, alarm logic, and data pre-processing all execute on-device with sub-second latency. Cloud connectivity provides visibility and remote management, not operational dependency.

I need a Python automation gateway for industrial control

“python automation gateway” / “industrial python gateway” / “programmable iot gateway”

The Python SDK exposes the RS485 port, digital I/O, modem, and network stack to your scripts. Read sensors, evaluate logic, trigger outputs, send alerts, and publish telemetry – all from a single Python application running on the device in the field.

I need to connect a PLC remotely over 4G

“4g plc remote monitoring” / “remote plc access cellular” / “plc remote diagnostics 4g”

The UR32 provides a transparent Modbus gateway or a direct WireGuard VPN tunnel to the PLC over 4G. Engineers connect to the PLC from any location as if on the local network. Dual SIM keeps the tunnel live across carrier outages.

I need a remote telemetry gateway for sensor data over cellular

“remote telemetry gateway” / “remote telemetry over 4g” / “cellular telemetry device”

RS485, digital input, and Ethernet all feed into the Python layer. Data is formatted locally and published via MQTT or HTTP(S). The MicroSD slot provides local buffering when connectivity is intermittent.

I need a 4G edge computing device for IoT deployments

“4g edge computing device” / “edge computing 4g router” / “iot edge gateway 4g”

The UR32 combines cellular connectivity and edge compute in a single device. The NXP industrial-grade processor handles Python application logic for typical telemetry workloads. Wi-Fi (AP or client mode) and two Ethernet ports extend LAN connectivity at the deployment site.

Can MQTT run natively on a cellular router?

“mqtt on cellular router” / “mqtt gateway with 4g” / “can mqtt run on a router”

Yes – on the UR32. The firmware includes MQTT client mode for the serial port without any Python. The Python SDK adds a full MQTT client for custom publish/subscribe logic. Digital inputs can trigger MQTT messages directly via firmware configuration.

I need to connect Modbus RTU instruments to AWS IoT or Azure IoT Hub

“modbus to aws iot” / “modbus azure iot” / “rs485 to aws”

Milesight provide Python SDK example scripts specifically for AWS IoT Core integration. Azure IoT Hub uses the same MQTT pattern. The Python script handles Modbus polling, payload formatting, and MQTT publish with TLS certificates loaded onto the device.

I need an industrial IoT edge gateway that runs custom application code

“industrial iot edge gateway” / “programmable industrial gateway” / “iot gateway with sdk”

The UR32 is fully programmable via Python SDK – not a locked-down black box. Custom Python applications have access to all hardware interfaces. The Milesight Development Platform provides remote application deployment and management across a fleet.

What sits between a basic router and a full industrial PC for edge computing?

“edge gateway vs industrial pc” / “raspberry pi vs ipc vs router”

The UR32 sits precisely in that gap. An IPC gives more compute but costs significantly more and adds complexity. A standard industrial router gives connectivity but no application layer. The UR32 gives Python programmability, 4G, RS485, DIO, and industrial durability at a price point justifiable for individual deployed units.

I need a Python gateway for IoT sensor data collection

“python gateway for iot” / “python iot data gateway” / “python sensor gateway”

The UR32 Python SDK is designed for this exact pattern: read sensor data via RS485 or digital inputs, apply local logic, forward to cloud or SCADA. Scripts persist across reboots, restart automatically, and are manageable remotely via the Milesight Development Platform.

I need dual SIM on separate networks for resilient IoT connectivity

“dual sim industrial router” / “multi network iot gateway” / “dual sim 4g router uk”

The UR32 carries two SIM slots with automatic carrier failover. For critical applications – BESS sites, substations, utility infrastructure – SIMs from two different MNOs provide genuine network diversity without dropping active sessions.

Frequently asked questions

Can a 4G router actually run Python?

On standard industrial routers, no. On the Milesight UR32 and UR35, yes. Milesight provide a Python 3.7 SDK that installs via the router web GUI and gives scripts direct access to the device’s serial port, digital I/O, modem, and network interfaces. This is not a common feature at this price point.

How does the Python SDK install on the UR32?

Through the web GUI under APP > Python > SDK Upload. Upload the device-specific SDK package, select storage (internal flash or MicroSD), install, then upload your Python application scripts via the same interface. Full installation guidance is in the Milesight IoT support portal.

What Python libraries are available on the UR32?

The SDK ships with core libraries for serial communication, MQTT (paho-mqtt), JSON handling, and Milesight’s hardware abstraction layer for the modem and I/O. Additional pure-Python libraries can typically be packaged with your application. Libraries requiring C extensions may not be available – confirm specific dependencies with Milesight support before committing to a design.

Does the UR32 support Node-RED as well as Python?

No. Node-RED on the Milesight range is available on the UR75 and UF51 routers, and on the UG56/UG65/UG67 LoRaWAN gateways. The UR32 and UR35 use Python as the edge programming environment. If you need Node-RED, the UR75 is the correct router.

What cloud platforms does the UR32 work with?

The Python SDK is cloud-agnostic. Any MQTT broker works: AWS IoT Core, Azure IoT Hub, Google Cloud IoT, HiveMQ, EMQX, or self-hosted Mosquitto. Milesight provide AWS IoT example scripts. HTTP(S) API support covers REST-based platforms. The Milesight Development Platform sits alongside whichever cloud platform you use for data.

What is the difference between Milesight DeviceHub and the Milesight Development Platform?

DeviceHub is the predecessor – focused on fleet management, remote configuration, and firmware updates. The Milesight Development Platform is the current system and adds API integration, remote Python application deployment, and the Beaver IoT open-source platform for dashboards. For new deployments, the Development Platform is the right choice. See the full guide on IoT Portal.

Is a fixed IP SIM recommended for UR32 deployments?

For any deployment where you need inbound connectivity – remote VPN access, SCADA polling from the cloud side, SSH access for diagnostics – a fixed IP SIM removes significant complexity. Without a fixed IP, all connections must be initiated from the device side. See fixedipsimcard.co.uk for a full comparison of private APN options.

How does the UR32 handle connectivity loss in the field?

The dual SIM switches carriers automatically on connectivity loss. The hardware watchdog restarts the device if it locks up. Python scripts restart automatically after reboot. The MicroSD slot provides local data buffering – write locally when MQTT publish fails and replay the buffer when connectivity resumes. Between these three mechanisms, field deployments can be genuinely self-healing.

Milesight UR32 – UK stock, next-working-day delivery

Multiple RS485, Wi-Fi, GPS, and PoE configurations available. UK-based technical support for specification and deployment queries.

Leave a Comment