How to Integrate LoRaWAN Sensor Data into Your SCADA, PLC or BMS via Modbus TCP
Short Answer
SCADA systems, PLCs and building management systems poll; LoRaWAN sensors push. The bridge between them is a Modbus TCP server that holds a register image: the latest value from every sensor, with a timestamp and a freshness flag, updated each time an uplink arrives. The control system polls that server exactly as it would poll any Modbus TCP device, over the OT network, with no change to its tags, alarms or trends.
The chain is:
- LoRaWAN sensors transmit to a gateway.
- The network server (ChirpStack, running on the gateway or on a site server) decrypts and decodes each uplink and publishes JSON over MQTT.
- A small service subscribes to that MQTT feed and writes each value into holding registers on a Modbus TCP server it hosts. Node-RED on the gateway is the usual tool.
- SCADA, the PLC or the BMS polls the Modbus TCP server on port 502 and maps the registers to tags.
- Downlinks, if needed, run the other way: the PLC writes a “requested set-point” register, the service sends a downlink, and the “applied” register updates when the device confirms.
Everything that follows is how to design and build steps 3 to 5 so the control room gets reliable, fresh, correctly typed data.
Why SCADA Can’t Poll a LoRaWAN Sensor Directly
A Class A LoRaWAN sensor sleeps between its own transmissions and listens for only a few seconds afterwards. A SCADA master expects a reply within a second of asking. The two models don’t meet: the sensor can’t be asked, it can only be heard.
That’s why every workable integration is a cache. The sensor reports when it reports; the cache stores the value; SCADA reads the cache whenever it likes. The only design question that matters is making sure SCADA can tell a fresh value from a stale one, which is the subject of the register map below.
(A transparent LoRaWAN link that pretends to be a serial cable to the sensor fails the timing test; see Transparent Mode vs Polling Mode.)
Choosing the Door: Modbus TCP, OPC UA, MQTT or BACnet
Modbus TCP is the lowest common denominator, which is why this post centres on it, but it isn’t always the right door.
| Control system | First choice | Alternative |
|---|---|---|
| Legacy SCADA (WinCC, Citect, FactoryTalk) | Modbus TCP | OPC UA |
| Modern SCADA (Ignition, AVEVA) | MQTT (Sparkplug B) or OPC UA | Modbus TCP |
| PLC (Siemens S7, Delta, Mitsubishi, Schneider) | Modbus TCP | Vendor protocol via gateway |
| BMS (Honeywell, JCI, Siemens Desigo) | BACnet/IP | Modbus TCP |
| Historian or MES | OPC UA or MQTT | REST |
| Energy management software | Modbus TCP or MQTT | REST |
Node-RED has nodes for all four, so the same gateway-side flow can expose a Modbus TCP server, a BACnet/IP device and an OPC UA server at once if different systems need them. The MQTT side, including what the sensors actually speak, is covered in MQTT vs HTTP for IoT Sensors.
Designing the Register Map
Give every sensor a fixed block of holding registers, and put freshness and quality in the block alongside the value. A block of 10 registers per sensor is enough for most:
| Offset | Register | Type | Content |
|---|---|---|---|
| +0 | Value 1 | INT16 ×10 | Temperature, 0.1 °C |
| +1 | Value 2 | UINT16 ×10 | Humidity, 0.1 %RH |
| +2 to +3 | Value 3 | FLOAT32 ABCD | Optional, e.g. kWh |
| +4 to +5 | Timestamp | UINT32 | UTC seconds of last uplink |
| +6 | Age | UINT16 | Seconds since last uplink |
| +7 | Status | Bitfield | Bit 0 stale, bit 1 alarm, bit 2 low battery |
| +8 | RSSI | INT16 | dBm |
| +9 | Battery | UINT16 | Percent |
Sensor 1 starts at register 0, sensor 2 at 10, and so on; 100 sensors use 1,000 registers of the 65,536 available. Rules that save arguments later:
- Pick one convention for types and keep it: scaled integers (×10, ×100) are the safest across old PLCs; float32 in ABCD order if the SCADA team prefers engineering units directly. Don’t mix within a site.
- Document the map as the SCADA tag list, with address, type, scaling and units, before any code is written. The same document is the test plan.
- Reserve space for new sensors and for per-sensor set-point registers.
- Use unit IDs if the SCADA team wants one “device” per building or per zone; the server can serve several unit IDs.
- Time stamps in UTC, converted in SCADA; the sensor’s own timestamp is more useful than the arrival time when batches arrive late.
The Stale-Data Problem
The biggest risk in any poll-over-push integration is a value that looks live and isn’t. A sensor dies, a gateway loses power, and the register still holds last Tuesday’s temperature while SCADA shows green.
Three mechanisms, use all three:
- An age register, incremented every second by the bridge and reset on each uplink. SCADA alarms when age exceeds two reporting intervals.
- A stale bit in the status word, set by the bridge when age passes the threshold, so a single tag can drive quality in SCADA (and OPC quality if you expose OPC UA).
- A heartbeat register for the bridge itself: a counter that increments every second. If it stops, the bridge is down, which is a different alarm from a sensor being down.
What happens upstream during outages, and why the gateway with a built-in network server keeps the image updated when the internet drops, is in What Happens When a LoRaWAN Gateway Goes Offline?
Building It on the Gateway with Node-RED
Macnman gateways run ChirpStack and Node-RED on board, so the whole bridge lives at the site edge, on the OT network, with no cloud dependency. The flow has four parts.
1. Subscribe to uplinks. An MQTT-in node on the gateway’s broker, topic application/+/device/+/event/up. Each message is the decoded uplink JSON; the decoded values are in the object field, the device in deviceInfo.devEui, the signal in rxInfo.
2. Map device to block. A function node holds the device-to-register mapping and writes the values into flow context:
// Device-to-block map: DevEUI -> base register
var MAP = flow.get("map") || {
"70b3d57ed0061234": { base: 0, name: "coldroom1" },
"70b3d57ed0061235": { base: 10, name: "coldroom2" }
};
var dev = msg.payload.deviceInfo.devEui.toLowerCase();
var obj = msg.payload.object || {};
var cfg = MAP[dev];
if (!cfg) return null;
var regs = flow.get("regs") || new Array(1000).fill(0);
var b = cfg.base;
regs[b+0] = Math.round((obj.temperature || 0) * 10) & 0xFFFF; // INT16 x10
regs[b+1] = Math.round((obj.humidity || 0) * 10) & 0xFFFF; // UINT16 x10
var ts = Math.floor(Date.now() / 1000);
regs[b+4] = (ts >>> 16) & 0xFFFF; // UINT32 hi
regs[b+5] = ts & 0xFFFF; // UINT32 lo
regs[b+6] = 0; // age reset
regs[b+7] = (obj.alarm ? 2 : 0) | ((obj.battery < 15) ? 4 : 0); // status bits
regs[b+8] = (msg.payload.rxInfo && msg.payload.rxInfo[0].rssi) & 0xFFFF;
regs[b+9] = obj.battery || 0;
flow.set("regs", regs);
msg.payload = { base: b, values: regs.slice(b, b + 10) };
return msg;3. Serve Modbus TCP. A Modbus flex-server node (from node-red-contrib-modbus) listening on port 502, with its holding-register array fed from the flow context. A second function on a 1-second inject increments every block’s age register, sets the stale bit when age exceeds the threshold, and bumps the bridge heartbeat register.
4. Handle downlinks (optional). A Modbus write from the PLC to a “requested set-point” register raises an event; a function node builds the downlink with the device’s encoder and publishes to application/{id}/device/{devEUI}/command/down; when the device’s next uplink confirms the value, the “applied” register is updated. The PLC compares requested and applied, which is the read-back pattern from Remote Control of RS485 Devices with LoRaWAN Downlinks.
If the site prefers a server to the gateway, the same flow runs on a small Linux box or a VPS with Node-RED, or as a Python service using a Modbus TCP server library subscribed to the same MQTT topics. For a multi-site rollout, a central Node-RED with one unit ID per site is the common shape.
Worked Example: Cold Store with Existing SCADA
Eight cold rooms, each with a MacSync LTS X1 temperature and humidity sensor; two sub-panel energy meters on a MacSync LX1 RS485 converter; a WinCC SCADA that already polls the chiller PLC over Modbus TCP.
- A Setu LX indoor gateway mounts in the plant room on the OT VLAN, Ethernet to the SCADA switch, 4G as fallback for the cloud dashboard.
- ChirpStack on the gateway decodes the ten devices; Node-RED hosts the Modbus TCP server on port 502.
- Register map: cold rooms at blocks 0–79 (10 registers each), energy meters at 100–139 (20 each, with kWh and demand as float32 ABCD), bridge heartbeat at 500.
- SCADA adds ten tags per cold room from the map, with alarms on temperature and on age > 1,800 s (two 15-minute intervals).
- The chiller set-points stay where they were, in the PLC. LoRaWAN carries measurements in; nothing safety-related runs over the radio.
Commissioning took the SCADA integrator an afternoon, because nothing on the SCADA side was new. The cold chain compliance side of the same site, including why the age alarm matters to an auditor, is in Cold Chain Temperature Monitoring in India.
Testing Before SCADA Connects
- Poll the server from a laptop with a Modbus polling tool: read block 0 and confirm values match the dashboard, scaling and word order included.
- Unplug a sensor and watch its age climb and the stale bit set at the threshold.
- Stop the bridge and confirm the heartbeat register freezes.
- Pull the gateway’s Ethernet and confirm the local server keeps updating from the on-board network server.
- Hand the SCADA team the map and let them build tags against the live server, then compare three sensors against the instruments’ displays.
For the field side of the same test, the sensor and converter checks are in How to Connect a Modbus RS485 Sensor to LoRaWAN.
Security on the OT Network
Modbus TCP has no authentication, so the server’s safety comes from where it sits.
- Put the gateway’s Ethernet interface on the OT VLAN and allow port 502 only from the SCADA and PLC hosts.
- Keep the gateway’s cloud backhaul (4G or a separate interface) off the OT VLAN; the gateway bridges data, not networks.
- Make the register image read-only unless downlink control is required; if it is, restrict writable registers to the requested-set-point block and log writes.
- Treat the register image as a data diode in practice: nothing on the OT side can reach the sensors or the cloud through it except the defined set-point path.
- Change the gateway’s default credentials, keep Node-RED’s editor on an admin login, and update firmware on a schedule.
Mistakes We See
No age register. The classic silent failure: SCADA shows a dead sensor as healthy for days.
Mixed data types. Half the map scaled integers, half floats; the SCADA team spends a day on word order.
Polling the cloud. A register image in the cloud dies with the internet; host it on the gateway or the site server.
Transparent mode as a “serial cable” to SCADA. Times out; see the transparent-mode post.
Set-points over the radio with no read-back. Use requested and applied registers.
The gateway on the IT network. Then 502 is open to the office, or blocked to SCADA. OT VLAN, firewall rule, done.
The Gateway Is the Integration
Macnman designs and manufactures LoRaWAN hardware in India with the control room in mind. The Setu LX indoor and MacLink Gen-2 outdoor gateways run ChirpStack and Node-RED on board with Ethernet, Wi-Fi and dual-SIM 4G, so the Modbus TCP register image lives on the plant network and survives an internet outage. The LoRaWAN sensor range and the MacSync LX1 converter feed it with published decoders, and the LoRaWAN controller range takes set-points back out. The main site’s versus pages compare each with the alternatives.
Integrating with a specific SCADA, PLC or BMS? Tell us the system, the sensor count and the protocol it prefers, and a product engineer will send a register map and a Node-RED flow to start from within one working day: contact Macnman. To prove it against your SCADA before a rollout, the pilot kit ships sensors and a gateway ready to join.
Frequently Asked Questions
How do I get LoRaWAN sensor data into SCADA?
Run a Modbus TCP server that holds a register image of the latest values, updated from the network server’s decoded uplinks (typically via MQTT into Node-RED on the gateway). SCADA polls that server as a normal Modbus device and maps the registers to tags. Include a timestamp and an age register per sensor so stale values are detected.
Can a PLC read LoRaWAN sensors directly?
No. LoRaWAN sensors push data on their own schedule and can’t be polled. The PLC reads a register image on a Modbus TCP server that the LoRaWAN system keeps updated.
Where should the Modbus TCP server run?
On the gateway or a site server on the OT network, so the PLC and SCADA keep receiving data when the internet is down. Macnman gateways run ChirpStack and Node-RED on board for this.
How do I detect stale data in SCADA?
Give each sensor an age register that the bridge increments every second and resets on each uplink, plus a stale bit in a status word. Alarm when age exceeds about two reporting intervals. Add a bridge heartbeat register to tell a dead bridge from a dead sensor.
Should I use scaled integers or floats in the register map?
Either, but one convention per site. Scaled integers (×10, ×100) work on every PLC; float32 in ABCD word order is convenient for SCADA packages that handle it. Document the choice in the tag list.
Can SCADA send set-points to LoRaWAN devices?
Yes, through a requested-value register that the bridge turns into a downlink, and an applied-value register updated when the device confirms. Class C devices respond in seconds; Class A devices after their next uplink. Keep safety functions local to the PLC.
What about a BMS that speaks BACnet?
Expose the same data as BACnet/IP objects from Node-RED or a protocol gateway; BMS platforms generally prefer BACnet to Modbus. The register-image logic and the age flag carry over unchanged.
Does this work with OPC UA?
Yes. Node-RED and most IoT platforms can expose the same values as OPC UA nodes with quality flags, which modern SCADA and historians prefer.
How many sensors can one register image hold?
A Modbus TCP server offers 65,536 holding registers per unit ID; at 10 registers per sensor that’s thousands of sensors, far beyond one gateway’s radio capacity. Use unit IDs to split by zone if the SCADA team prefers.
Is Modbus TCP secure enough?
It has no authentication, so place the server on the OT VLAN, restrict port 502 to the SCADA and PLC hosts, keep the image read-only unless writes are needed, and keep cloud backhaul on a separate interface.
