← How-Tos
electronics 1 days ago ◑ 3 views ◯ 4 min read

Replacing Obsolete Industrial PLC I/O with an ESP32 and Modbus TCP Bridge

esp32plcmodbusmodbus tcpindustrial automationi/o replacementdin rail

Older industrial machines keep running for decades, but their PLC I/O cards don't always survive that long. When a 20-year-old discrete I/O module dies and the original manufacturer has discontinued the part โ€” or wants four figures for a replacement that's just a relay and a handful of optocouplers โ€” an ESP32 bridging the gap over Modbus TCP is often a faster, cheaper, and more maintainable fix than hunting eBay for a surplus card. This isn't a replacement for the PLC itself; it's a way to keep a working PLC's control logic intact while modernizing the failed I/O layer underneath it.

Where This Approach Fits

This technique makes sense when:

It does not fit replacing an entire PLC CPU, high-speed motion/servo I/O, or any safety-rated I/O (emergency stop circuits, light curtains, safety relays) โ€” those require certified hardware, not a hobbyist bridge, full stop.

Parts and Topology

The ESP32 runs a Modbus TCP server (slave) using a library such as ModbusIP_ESP8266/ESP32 or eModbus, exposing your discrete inputs, discrete outputs, and any analog channels as standard Modbus registers โ€” discrete I/O as coils, analog as holding registers. The PLC (or an HMI, or a SCADA package like Ignition) then polls the ESP32 exactly as it would poll any other Modbus TCP I/O rack, because from the network's point of view, that's exactly what it is.

Register Mapping: Keep It Boring and Documented

The biggest long-term risk with a bridge like this isn't the hardware โ€” it's a future technician (possibly you, in two years, having forgotten the details) not knowing what any given register means. Build the map deliberately:

Modbus AddressFunctionField Signal
Coil 0โ€“7Discrete Inputs 1โ€“824VDC sensors, limit switches, etc.
Coil 100โ€“107Discrete Outputs 1โ€“8Relay-driven 24VDC loads
Holding Reg 0โ€“3Analog Inputs 1โ€“44โ€“20mA loop, scaled to engineering units in firmware

Print this table and tape it inside the cabinet door. Label-maker tape on the terminal block, matched to the same numbering, turns a confusing bridge into a transparent one โ€” this matters far more than any amount of firmware polish.

Reliability Considerations

Safety

This is a maker-grade solution for maker-grade stakes โ€” a hobby CNC's limit switches, a shop's non-safety status indicators, a home automation tie-in to an old building system. It is not appropriate anywhere a failure could hurt someone: machine safety circuits, anything on an E-stop chain, or any application where your local electrical code or industrial safety standards (NFPA 79, etc.) require certified, listed hardware. If you're not certain which category your application falls into, treat it as the safety-critical one and don't substitute a hobby board for certified I/O.

Done carefully, with a clearly documented register map and a sane fail-safe default, this kind of bridge has kept more than one otherwise-obsolete machine running for the cost of an ESP32 and an afternoon, instead of a four-figure replacement card that may not even still be manufactured.