Call Phone +8618073152920 Hotline: +8618073152920
Call Phone +8618073152920
English
CONTACT US/ CONTACT US
Consumer hotline +8618073152920
Changsha Zoko Link Technology Co., Ltd.

Email:Arvin@niubol.com

WhatsApp:+8615367865107

Address:Room 102, District D, Houhu Industrial Park, Yuelu District, Changsha City, Hunan Province, China

Position:Home >> Blogs >> Technical Support

Technical Support

How to Connect RS485 Sensors to PLCs, RTUs, Arduino and ESP32

Time:2026-09-07 16:27:28 Popularity:335

Quick Answer

To connect RS485 sensors to PLCs, RTUs, Arduino or ESP32, first provide the correct physical interface and sensor power, then configure a Modbus RTU client to read the model's registers. A PLC with a compatible RS485 port may connect directly at the bus level. A microcontroller UART normally needs an external RS485 transceiver with compatible logic voltage and transmit-direction control.

NiuBoL data collector for reviewing sensor port assignments and acquisition functions

Choose the host interface before connecting A and B

Connecting an RS485 sensor involves reliable differential signaling and correct interpretation of the returned data. The host changes how those tasks are implemented. A serial connector, an analog input and an Ethernet socket are not substitutes for one another, even when all belong to the same controller.

Available host interfaceHardware pathSoftware requirement
PLC or RTU with RS485Compatible bus terminals and correctly powered sensorModbus RTU client/master function configured for the sensor
PLC with Ethernet onlyCompatible serial gateway if the sensor remains RS485Supported Ethernet protocol and a defined mapping to the serial device
Controller with only 4-20 mA inputsSuitable analog-output sensor version or an active conversion deviceAnalog scaling and fault handling; no direct Modbus polling through the analog input
Arduino or ESP32 UARTLogic-compatible RS485 transceiver, plus sensor supplySerial configuration, direction control and Modbus request/response handling
Computer for bench testingSuitable USB-to-RS485 adapter and separate sensor power where requiredRead-only Modbus test client using the delivered register definition

A gateway must support the required protocol conversion; a passive cable adapter cannot turn Modbus registers into a 4-20 mA signal. Similarly, a serial gateway that only transports raw bytes is not necessarily a Modbus TCP-to-RTU gateway. Match the function to the host's actual capability before ordering it.

Where a complete acquisition device is preferable to custom firmware, review the NiuBoL data collector options against the required sensors and destination. The presence of several terminal blocks does not establish which ports support RS485, analog inputs or pulse counting. Obtain the specific port assignment and supply arrangement for the selected device.

Connect RS485 sensors to a PLC or RTU

Verify that the chosen port supports the required two-wire RS485 connection and Modbus RTU client operation. Some ports have selectable electrical modes; others need an optional communications module. Wire the sensor bus conductors according to the terminal definitions and provide DC power within the sensor's operating limits. Do not use an analog input as a substitute for a serial port.

Configure baud rate, data bits, parity and stop bits to match the sensor. Start with one device on a short bench connection. Poll one documented read block and inspect both the raw register words and the engineering value. In the PLC program, observe the communication function's busy, done and error states; repeatedly triggering a new request before the previous one completes can create avoidable timeouts.

The displayed register number and the protocol offset may differ. A table may label a holding register 40001 while the request uses offset 0x0000. Enter the form expected by the PLC function, not whichever number looks familiar. Also distinguish signed integers, unsigned integers and multi-register floating-point values. The sensor's data definition decides the interpretation.

Give every device on a shared segment a unique supported address. Configure duplicate factory addresses one device at a time before joining the bus. Do not allow a computer test tool and the production PLC to poll the same conventional single-client segment simultaneously; intermittent replies can otherwise be mistaken for bad sensors.

Arduino and ESP32 need more than a serial cable

A UART TX/RX pair carries logic-level signals, not the differential RS485 bus signal. Connect the UART through a suitable transceiver. Check the supply and logic levels of the actual board and transceiver module, including the voltage returned to the MCU receive pin. Arduino is a platform name, not a universal electrical specification; the classic UNO R3 uses 5 V logic, while other boards differ.

For an ESP32 design, use a transceiver arrangement compatible with its 3.3 V logic and the exact board's pin limits. Do not assume that a module powered from 5 V has a safe receive output for a 3.3 V MCU. An isolated interface may be appropriate where grounding conditions or field wiring require it; isolation must include the intended signal and power arrangement rather than only an isolated label on one component.

Two-wire half-duplex communication requires the driver to release the bus after transmission so the sensor can reply. With manual direction control, the sequence is: enable transmit, send the complete request, wait for the final bit to leave the UART, then enable reception. Emptying a software buffer is not necessarily the same as completing physical transmission.

The ESP32 UART documentation describes half-duplex RS485 operation using an external bus driver and direction control. This facility does not by itself implement the sensor's Modbus register interpretation. Use a suitable Modbus client library and configure it for the selected UART and transceiver arrangement.

Keep sensor power separate from logic-level assumptions

The fact that an MCU can exchange data does not mean that it can power the probe. For example, the NBL-WQ-EC-S salinity sensor requires a 12-24 VDC supply. Its RS485 data pair must not be connected to a GPIO as though it were a logic-level serial signal, and its supply must not be applied to the MCU's UART pins.

NBL-WQ-EC-S integration itemSpecificationBench-test use
Power12-24 VDC; 0.2 W at 12 VUse an appropriate supply and verify voltage at the sensor.
OutputRS485 Modbus RTUUse an RS485-capable host interface, not a direct UART connection.
Default serial format9600 baud, 8 data bits, no parity, 1 stop bitCheck whether the delivered unit retains these settings.
Measurement read blockFunction 0x03; start offset 0x0000; four 16-bit registersRead the measurement and temperature values with their decimal-place fields.
Salinity range and resolution0-70.0 PSU; 0.1 PSUVerify unit and scale rather than labeling the result conductivity.
Accuracy+/-1.5% FS; temperature +/-0.5 degrees CKeep measurement uncertainty separate from correct data decoding.

The four-register arrangement above is a model-specific example, not a common map for every NiuBoL sensor. With a value word of 258 and a decimal-place count of 1, division by 10 gives 25.8. Use the parameter's defined unit and verify the signed interpretation of temperature separately. Do not hard-code one decimal place merely because the first sample happens to use it.

NBL-WQ-EC-S salinity probe for a powered RS485 Modbus bench test

Move a known-good read from the computer to the host

During debugging, first verify the sensor on a computer using USB-to-RS485. Record the device address, serial format, function, start offset, register count and raw reply. Then disconnect the test client and transfer those settings to the PLC or MCU. This separates a sensor or wiring problem from the host program without changing several variables at once.

Keep initial tests read-only. Do not try calibration, address changes or a factory reset simply because a read timed out. A communication fault is not evidence that measurement calibration is wrong, and a reset can remove settings needed for the application. Configure any necessary changes using the exact model procedure after basic communication is understood.

Observed failureCheck firstUseful evidence
No reply from any hostSensor supply, conductor identification, address and serial settingsMeasured voltage and the exact transmitted request
Computer works, PLC failsPort mode, client role, offset convention and request sequencingPLC function status and raw register buffer
Computer works, MCU failsLogic levels, TX/RX mapping and transmit-enable release timingUART settings and a trace of request and response timing
Reply is valid but value is wrongData type, decimal scale, word order and unitRaw words beside the calculated engineering value
Failures begin after adding devicesAddress conflicts, bus topology, power and polling scheduleResults with devices connected individually and then together

For field wiring, use the termination, biasing, reference-conductor and protection arrangement appropriate to the bus design and equipment. Do not install a terminating resistor at every sensor indiscriminately. Route and protect the cable for the electrical environment, and check supply voltage under operating load rather than only with the probe disconnected.

For commissioning or technical support, send NiuBoL the sensor version, host model, interface module, wiring diagram and a raw request/reply capture. Include whether the same probe works through USB-to-RS485. That information makes it possible to distinguish hardware, serial configuration and register decoding without guessing from a screenshot of the final value.

NiuBoL online salinity sensor with its own model-specific register interpretation

Project Decision FAQ

Q1. Does NiuBoL provide an Arduino library for every RS485 sensor?

Do not assume a dedicated library is included. The required starting point is the delivered sensor's Modbus definition and wiring information. A suitable standard Modbus client library can handle transactions, while the application still needs the correct register map, scale and error handling.

Q2. What should be done if A and B appear reversed?

Check the endpoint definitions and conductor labels with power removed before changing wiring. A/B naming conventions can differ between devices. Do not randomly swap supply and signal wires; first establish which pair is the RS485 bus.

Q3. Why does the MCU transmit a request but miss the reply?

Check whether the transceiver remains in transmit mode or switches too early and truncates the request. Also inspect UART assignment, receive logic voltage and timeout handling. A correct-looking request in a software log does not prove that the full frame reached the bus.

Q4. Can the PLC read a digital sensor through an analog input?

Not directly. Select a compatible analog-output sensor version or an active conversion device with the required scaling and fault behavior. Confirm that the chosen sensor actually offers that output; the existence of an RS485 version does not imply an analog option.

Q5. How long should software wait after sensor power-up?

Use the startup and measurement requirements for the delivered model. Distinguish communication readiness from measurement stabilization. Mark values invalid until the necessary conditions are met instead of applying one guessed delay to every sensor type.

Q6. Can more sensors be added without changing the program?

Only if the host configuration already supports their addresses, register maps and polling needs. Check supply capacity and cycle time as well. Each new parameter needs the correct unit, validity handling and destination tag, even when the physical bus connection is unchanged.

Summary

Connect RS485 sensors to PLCs and microcontrollers by proving the electrical path first, then the transaction and finally the engineering value. Keep a known-good bench read, use model-specific register definitions and test faults as well as normal values. For the underlying frame and register concepts, see the RS485 Modbus RTU communication guide.

Related recommendations

Sensors & Weather Stations Catalog

Agriculture Sensors and Weather Stations Catalog-NiuBoL.pdf

Weather Stations Catalog-NiuBoL.pdf

Agriculture Sensors Catalog-NiuBoL.pdf

Water Quality Sensor Catalog-NiuBoL.pdf

Related products

Tell us your requirements, Let's discuss more about your project.we can do more.

Name*

Tel*

Email*

Company*

Country*

Message


online
Contacts
Email
Top
XHow to Connect RS485 Sensors to PLCs, RTUs, Arduino and ESP32-Technical Support-Automatic Weather Stations_Industrial, Agricultural, Water & Environmental IoT Monitoring Solutions—NiuBoL

Screenshot, WhatsApp to identify the QR code

WhatsApp number:+8615367865107

(Click on WhatsApp to copy and add friends)

Open WhatsApp

The WhatsApp ID has been copied, please open WhatsApp to add consultation details!
WhatsApp