> ## Documentation Index
> Fetch the complete documentation index at: https://instro.nominal.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Modbus TCP

> A connection type for [`ModbusDevice`](/library/protocols/modbus)

<Card title="Modbus TCP" horizontal href="/library/protocols/modbus/ModbusTCP">
  <img src="https://mintcdn.com/nominal/vd1fIohbHX0IE-nH/snippets/drivers/modbus/modbus-tcp/image.png?fit=max&auto=format&n=vd1fIohbHX0IE-nH&q=85&s=c8e9e4fa688c9fe9bda8949266937fc7" style={{ width: "100%", height: "100px", objectFit: "contain" }} noZoom alt="Modbus TCP" width="600" height="191" data-path="snippets/drivers/modbus/modbus-tcp/image.png" />
</Card>

Modbus TCP is a connection type for [`ModbusDevice`](/library/protocols/modbus), not a separate driver class: set `"transport": "tcp"` in the config's connection block, or pass a `ModbusTCPTransport` explicitly.

## Creating a [`ModbusDevice`](https://nominal-io.github.io/instro/protocols/modbus/#modbusdevice) over TCP

```python theme={null}
from instro.modbus import ModbusDevice

# connection block declared inline, e.g. { "transport": "tcp", "host": "192.168.1.100", "port": 502 }
device = ModbusDevice(config="my_device.json")
device.open()
```

Or with an explicit, shareable transport:

```python theme={null}
from instro.lib.transports import ModbusTCPTransport
from instro.modbus import ModbusDevice

transport = ModbusTCPTransport(host="192.168.1.100", port=502)
device = ModbusDevice(config="my_device.json", connection=transport, unit_id=1)
```

Parameters and methods specific to [`ModbusDevice`](https://nominal-io.github.io/instro/protocols/modbus/#modbusdevice) can be found in the [SDK](https://nominal-io.github.io/instro/).
