Please Choose Your Language
How To Wire Water Tank Level Sensor To PLC
Home » Blogs » How To Wire Water Tank Level Sensor To PLC

How To Wire Water Tank Level Sensor To PLC

Views: 0     Author: Site Editor     Publish Time: 2026-07-14      Origin: Site

Inquire

telegram sharing button
linkedin sharing button
pinterest sharing button
whatsapp sharing button
kakao sharing button
snapchat sharing button
facebook sharing button
twitter sharing button
line sharing button
wechat sharing button
sharethis sharing button

Wiring a water tank level sensor to a PLC starts with one question: what signal does the sensor provide?

A float switch or relay-output level switch connects to a PLC digital input as an open or closed contact. An NPN or PNP sensor also connects to a digital input, but its output type must match the PLC input circuit. A 4–20 mA or 0–10 V transmitter requires an analog input, while an RS485 sensor communicates through a compatible serial interface.

There is no universal wiring diagram for every water level sensor. Before connecting any wire, confirm the sensor's supply voltage, output type, wire definitions and normal switching state in its model-specific datasheet.

This guide explains the main wiring methods and then uses the XKC-Y25 non-contact liquid level sensor as a practical PLC integration example.

Key Takeaways

  • Identify whether the sensor provides a dry contact, NPN, PNP, analog or RS485 output.

  • Match an NPN sensor with a sourcing PLC input and a PNP sensor with a sinking PLC input.

  • Confirm whether an analog input supplies loop power or requires an external 24 VDC supply.

  • Do not assume that wire colors are identical across different brands or sensor models.

  • A point-level sensor detects whether liquid has reached one position; it does not automatically measure the full tank level as a percentage.

  • Keep signal cables away from motor, contactor and variable-frequency-drive wiring.

  • Test the sensor signal at the PLC input before allowing the program to operate a pump or valve.

  • For an XKC sensor, select the required output version before wiring; the XKC-Y25-V, NPN, PNP and RS485 versions are electrically different.

What You Need Before Wiring

Prepare the following information and equipment:

  • Sensor model number and datasheet

  • PLC model and input-module manual

  • Rated sensor supply voltage

  • Sensor output type

  • PLC input voltage and input topology

  • Suitable DC power supply

  • Multimeter

  • Terminal blocks and correctly rated cable

  • Shielded twisted-pair cable when required

  • Interposing relay or contactor for the controlled load

  • The actual tank, pipe and liquid for commissioning

Disconnect power before installing or changing wiring. Pumps, valves and heaters should remain isolated during the initial signal test. If the work involves a live industrial control panel, it should be performed by qualified personnel under the site's electrical safety procedure.

Step 1: Identify the Sensor Output

The sensor output determines which PLC terminal and input module should be used.

Sensor Output What the PLC Receives Required PLC Interface Typical Application
Dry contact or relay Open or closed circuit Digital input High-level alarm, low-level alarm
NPN transistor Output switches toward 0 V Sourcing digital input Point-level detection
PNP transistor Output supplies positive voltage Sinking digital input Point-level detection
High/low voltage output Defined voltage state Compatible digital or voltage input Equipment control-board integration
4–20 mA Current proportional to level Analog current input Continuous tank-level measurement
0–10 V Voltage proportional to level Analog voltage input Short-range continuous measurement
RS485/Modbus RTU Digital data RS485 communication port or module Networked status or measurement data

A digital point-level sensor answers a yes-or-no question: has liquid reached the sensor position? Continuous transmitters provide a changing value representing height, distance or pressure.

Do not connect a switching sensor to an analog input simply because both devices are described as “water level sensors.”

Step 2: Check the Supply Voltage and PLC Input

Confirm four items before making a connection:

  1. The sensor's rated supply voltage

  2. The PLC input's rated voltage

  3. Whether the PLC digital input is sourcing or sinking

  4. Whether the sensor output is NPN, PNP, relay, voltage, current or communication-based

Many industrial systems use 24 VDC, but not every sensor version accepts 24 V. Some models are designed for 5 V, 12 V or another specific range. Applying a convenient panel voltage without checking the datasheet can damage the sensor.

Measure the supply at the sensor terminals while the sensor is connected. A power supply may show the correct voltage without a load but drop below the required range once the circuit is operating.

How to Wire a Dry-Contact Level Switch

A mechanical float switch or relay-output sensor may provide a normally open, normally closed and sometimes common terminal.

For a typical 24 VDC sinking PLC input:

  1. Connect +24 VDC to one side of the dry contact.

  2. Connect the other side of the contact to the selected PLC digital input.

  3. Connect the digital-input common terminal to 0 V.

  4. Confirm whether the selected contact should close at high level or low level.

  5. Label the PLC input according to its real function, such as Tank_High_Level.

If the PLC input uses the opposite topology, follow the input-module diagram instead of applying this arrangement unchanged.

A normally closed circuit may be preferable for a critical interlock because a broken wire can produce the same safe-state response as an alarm condition. Whether this is appropriate depends on the control philosophy and risk assessment.

How to Wire a PNP Water Level Sensor

A PNP sensor sources positive voltage when its output is active. It is normally connected to a sinking PLC digital input.

A typical connection is:

  • Sensor VCC → +24 VDC

  • Sensor GND → 0 V

  • Sensor output → PLC digital input

  • PLC input common → 0 V

When the sensor activates, its output supplies positive voltage to the PLC input.

Confirm the PLC input threshold and the sensor's maximum output current. The sensor output is intended to signal the PLC; it should not normally power a pump, solenoid or contactor coil directly.

How to Wire an NPN Water Level Sensor

An NPN sensor switches its output toward 0 V when active. It is normally connected to a sourcing PLC digital input.

A typical connection is:

  • Sensor VCC → +24 VDC

  • Sensor GND → 0 V

  • Sensor output → PLC digital input

  • PLC input common → +24 VDC

When the sensor activates, the NPN transistor completes the input circuit toward 0 V.

If the available PLC input is incompatible with the sensor output, use an approved interface relay, signal converter or isolated input module. Do not attempt to change the topology by randomly swapping the power and signal wires.

How to Wire a 4–20 mA Level Transmitter

A 4–20 mA transmitter provides a continuous signal rather than a simple wet/dry state. The exact wiring depends on whether the transmitter is loop-powered and whether the PLC analog input supplies loop power.

Typical Two-Wire Loop-Powered Circuit

When using an external 24 VDC supply and a passive PLC current input, the circuit commonly follows this series path:

  1. +24 VDC supply → transmitter positive

  2. Transmitter negative → PLC analog input positive

  3. PLC analog input negative → 0 V supply

Because the current must pass through every component in the loop, an open connection anywhere in the circuit will stop the signal.

Three-Wire or Four-Wire Transmitter

A powered transmitter may have separate supply and signal terminals:

  1. Connect the specified power terminals.

  2. Connect the current output to the PLC analog input.

  3. Establish the required signal reference.

  4. Confirm whether the output is active or passive.

Do not assume that all 4–20 mA devices share the same circuit. Review both the transmitter diagram and the PLC analog-input manual.

Using a Resistor with a Voltage Input

If a PLC has only a compatible voltage input, a precision resistor may sometimes convert the current into voltage. For example, a 250 Ω resistor converts 4–20 mA into 1–5 V:

V=I×R

This method should only be used when the PLC accepts the resulting voltage range and the total loop resistance remains within the transmitter's allowable load.

How to Wire a 0–10 V Level Sensor

For a typical three-wire voltage-output sensor:

  • Supply positive → specified DC supply

  • Supply ground → 0 V

  • Signal output → PLC analog voltage input

  • PLC analog common → the required signal reference

Voltage signals are more sensitive to conductor resistance, ground-potential differences and electrical noise than current-loop signals. Keep the cable run short where possible and follow the manufacturer's grounding and shielding instructions.

Never connect a 0–10 V signal to an analog channel configured for current input.

How to Connect an RS485 Level Sensor

An RS485 sensor requires both physical wiring and communication configuration.

Typical connections include:

  • Sensor power positive and negative

  • RS485 A and B communication conductors

  • Signal reference or shield when specified

During installation:

  • Maintain A-to-A and B-to-B polarity.

  • Use shielded twisted-pair cable.

  • Use a daisy-chain bus rather than star wiring.

  • Give each device a unique address.

  • Match baud rate, parity, data bits and stop bits.

  • Install termination and biasing according to the network design.

  • Keep the communication cable away from high-current wiring.

The PLC must have an RS485 port or compatible communication module and must support the sensor protocol. RS485 describes the electrical interface; it does not by itself define the data format.

How to Wire an XKC Water Level Sensor to a PLC

XKC offers different liquid-level sensor configurations, so the complete model number must be confirmed before wiring. The XKC non-contact liquid level sensor range includes models for flat tanks, pipes, compact containers and different controller interfaces.

For a practical example, the XKC-Y25 non-contact liquid level sensor is an externally mounted capacitive point-level sensor for compatible non-metallic containers. It is available in four output versions:

XKC-Y25 Version Output Typical PLC Connection
XKC-Y25-V High/low voltage output Compatible digital or voltage input
XKC-Y25-NPN NPN switching output Sourcing digital input
XKC-Y25-PNP PNP switching output Sinking digital input
XKC-Y25-RS485 RS485 communication PLC RS485 port or module

The available supply voltage also depends on the selected version. The XKC-Y25 product information lists a 5–24 VDC range for the V version, separate 5–12 VDC and 24 V options for NPN and PNP versions, and a 24 VDC RS485 version with a 12 V customized option. Check the actual label and manual instead of assuming that every Y25 accepts the same supply.

XKC-Y25 Wire Definitions

The XKC-Y25 documentation identifies the conductors as:

  • Brown: VCC

  • Blue: GND

  • Yellow: signal output

  • Black: signal-selection wire

This differs from the frequently encountered brown/blue/black three-wire arrangement. On the XKC-Y25, the yellow wire is the output and the black wire is used to select signal logic. Therefore, a generic three-wire color diagram should not be applied to this model.

Connecting the XKC-Y25-NPN Version

For the industrial-voltage NPN version:

  1. Connect brown to the specified positive DC supply.

  2. Connect blue to 0 V.

  3. Connect yellow to a compatible sourcing PLC digital input.

  4. Connect the PLC input common as required by its wiring diagram.

  5. Set the black signal-selection wire only as described in the XKC manual.

  6. Test both dry and detected-liquid states before enabling the control program.

The XKC documentation uses the black wire to select normally open or normally closed behavior. Leaving it open or connecting it to ground changes the output logic on supported versions. Insulate the wire when the manual requires it to remain open; do not connect it to an unused PLC terminal without a defined purpose.

Connecting the XKC-Y25-PNP Version

For the industrial-voltage PNP version:

  1. Connect brown to the specified positive DC supply.

  2. Connect blue to 0 V.

  3. Connect yellow to a compatible sinking PLC digital input.

  4. Connect the PLC input common according to the module diagram.

  5. Configure the black signal-selection wire according to the required normal state.

  6. Verify the PLC input in both liquid-present and liquid-absent conditions.

Connecting the XKC-Y25-RS485 Version

The XKC-Y25-RS485 communicates through Modbus RTU. Its manual specifies a default serial configuration of 9600 baud, 8 data bits, no parity and 1 stop bit.

Before commissioning:

  • Confirm the exact power and RS485 conductor definitions.

  • Connect A and B to the corresponding PLC communication terminals.

  • Configure the PLC as the Modbus master.

  • Set a unique sensor address.

  • Confirm the communication parameters.

  • Read the documented liquid-state register.

  • Check the response with and without liquid at the sensing point.

The RS485 version communicates point-level status and related signal data. It should not be described as a continuous tank-height transmitter unless the selected product explicitly provides continuous measurement.

Install the Sensor Before Final PLC Testing

Correct wiring does not compensate for incorrect physical installation.

For an external capacitive sensor such as the XKC-Y25:

  • Mount it against a compatible non-metallic tank or pipe wall.

  • Keep the sensing face firmly against the surface.

  • Avoid an air gap between the sensor and container.

  • Do not place metal between the sensing face and liquid.

  • Avoid ribs, joints, brackets and irregular wall sections.

  • Keep the sensing point away from severe turbulence when possible.

  • Test with the actual container material, wall thickness and liquid.

The XKC-Y25 is designed for point detection through compatible non-metallic walls. It should not be attached directly to the outside of a metal tank and expected to detect through the metal. A different sensor technology or an appropriately designed external sight tube may be required.

Program the PLC Logic

After the electrical input operates correctly, define what each state means in the PLC.

Point-Level Control

A single sensor can provide:

  • Low-level alarm

  • High-level alarm

  • Overflow warning

  • Dry-run protection

  • Refill request

For automatic filling, two sensors are usually more informative than one:

  • Low-level sensor: requests filling

  • High-level sensor: stops filling

The PLC should retain the fill command after the level rises above the low sensor and stop only when the high sensor is reached. This prevents the pump or valve from cycling repeatedly around one switching point.

Input Filtering

Liquid movement can cause rapid state changes near a sensor. Use an appropriate input delay or timer so the level must remain in the new state for a defined period before the PLC accepts it.

The delay must be short enough to respond safely. An excessive delay on an overflow input can defeat the purpose of the alarm.

Analog Scaling

For a transmitter configured so that 4 mA represents the minimum level and 20 mA represents the maximum level:

Level (%) = [(Measured current in mA − 4) ÷ 16] × 100

Use the transmitter's configured lower and upper range values rather than assuming that 4 mA always means an empty tank.

A level transmitter measures height or distance. For a horizontal cylindrical tank, conical tank or irregular vessel, level percentage does not equal volume percentage. The PLC may require a tank-specific conversion table.

Fail-Safe Logic

Consider how the system should respond to:

  • Broken sensor wire

  • Loss of sensor power

  • Impossible high/low sensor combination

  • Analog signal below or above its valid range

  • RS485 communication timeout

  • Pump running without an expected level change

  • High-high level alarm

  • Low-low level condition

Where overflow or dry running could create a serious hazard, use an independent protective device instead of relying entirely on one sensor and one PLC program.

Commissioning Procedure

Commission the input before allowing the PLC to control equipment.

  1. Isolate the pump, valve, heater and other outputs.

  2. Verify the sensor model and supply voltage.

  3. Inspect every terminal against the wiring diagram.

  4. Power the sensor and measure its supply voltage.

  5. Place the liquid below the sensing point.

  6. Record the local indicator, sensor output and PLC input state.

  7. Raise the liquid above the sensing point.

  8. Confirm that all three states change correctly.

  9. Repeat the rise-and-fall test several times.

  10. Verify normally open or normally closed logic.

  11. Test PLC timers, alarms and interlocks.

  12. Reconnect the actuator and perform a supervised operating cycle.

  13. Document the final wiring, addresses, input states and program tags.

If the sensor indicator changes but the PLC input does not, investigate the output topology, input common, wiring and PLC configuration. If neither the indicator nor output changes, check the installation and sensor operation. The detailed water level sensor testing guide explains how to separate sensor, wiring and controller faults.

Cable Routing, Shielding and Grounding

Industrial panels may contain VFDs, contactors, relays and motor cables that generate electrical interference.

Good installation practices include:

  • Use twisted-pair cable for analog and RS485 signals.

  • Use shielding where required by the sensor and PLC manuals.

  • Route sensor cables separately from motor and mains wiring.

  • Cross power cables at approximately 90 degrees when separation is impossible.

  • Avoid sharing signal returns with high-current loads.

  • Use surge protection where long outdoor cables are exposed.

  • Follow the site grounding design for shield termination.

  • Do not connect shield conductors randomly at multiple points.

Single-point shield grounding is commonly used to reduce low-frequency ground-loop problems, but the correct method depends on the plant's EMC and grounding design.

Troubleshooting Table

Symptom Likely Cause What to Check
PLC input never turns on Wrong NPN/PNP pairing, no power, incorrect common Sensor output type, input topology, supply voltage
PLC input is always on Reversed logic, black signal-selection wire set incorrectly, excess sensitivity Normal state, model manual, dry-state output
Sensor LED changes but PLC input does not Incorrect DI wiring or input configuration Output wire, input common, input voltage threshold
Input flickers near the switching level Turbulence, loose mounting, insufficient filtering Mounting contact, sensor position, PLC input timer
Sensor works away from the tank but not when installed Wall too thick, metal obstruction, air gap, unsuitable container Container material, wall thickness, mounting surface
4–20 mA reading remains at zero Open loop, reversed polarity, missing loop power Loop voltage, series wiring, AI configuration
Analog value fluctuates EMI, grounding problem, unstable supply Shielding, cable route, signal reference
RS485 sensor does not respond A/B reversed, address conflict, wrong serial settings Polarity, address, baud rate, parity and termination
Pump does not stop at high level Incorrect PLC logic, high sensor not detected, output device fault DI state, program sequence, relay or contactor
High and low sensors report an impossible combination Reversed tags, wiring fault or sensor-position problem Physical positions, input labels, normal logic

Conclusion

To wire a water tank level sensor to a PLC correctly, identify the signal type first and then match it to the appropriate PLC input. Dry contacts, NPN, PNP, 4–20 mA, 0–10 V and RS485 interfaces require different circuits and PLC configurations.

For an XKC non-contact liquid level sensor, the full product version is especially important. The XKC-Y25-V, NPN, PNP and RS485 models provide different interfaces, and the yellow output wire and black signal-selection wire should be connected only according to the relevant manual.

After wiring, test the sensor on the actual tank and liquid, verify the electrical output at the PLC and commission the control logic with pumps and valves isolated. This sequence prevents incorrect input matching, nuisance alarms and unsafe pump operation.

FAQ

Can a Water Level Sensor Be Connected Directly to a Pump?

A sensor output should not normally carry pump current. Connect the sensor to a PLC, suitable level controller or interface relay, and use a correctly rated contactor or motor starter to switch the pump. The final circuit should include the required overload and safety protection.

Can an XKC-Y25 Measure the Exact Percentage of Water in a Tank?

No. The XKC-Y25 is a point-level sensor. It detects whether liquid is present at its mounting position. Multiple point sensors can identify low, medium and high thresholds, but continuous percentage measurement requires a suitable continuous-level transmitter.

Can I Use One Sensor for Both Pump Start and Stop?

It is possible to create hysteresis or timed logic around one sensor, but separate low- and high-level sensors provide clearer start and stop thresholds for many tank-filling applications.

What Happens If an NPN Sensor Is Connected to a PNP-Only PLC Input?

The PLC input may not change state correctly. Use a compatible input module or an approved interface relay or signal converter. Do not change sensor polarity in an attempt to convert NPN into PNP.

Why Does the Sensor Work but the PLC Shows the Opposite State?

The PLC tag may interpret an active-low signal as active-high, or the sensor may be configured for normally closed rather than normally open operation. Check the measured output and normal state before inverting the signal in software.

Can a Non-Contact Capacitive Sensor Detect Through a Metal Tank?

Not directly through the metal wall. Capacitive through-wall detection is intended for compatible non-metallic materials. For a metal tank, consider another sensing technology or a properly designed non-metallic external measuring section.

Does Every XKC Sensor Use the Same Wire Colors?

No. Wire definitions, supply ranges and output behavior depend on the model and version. The XKC-Y25 example in this article must not be applied automatically to another XKC product.


SUBSCRIBE TO OUR NEWSLETTER

QUICK LINKS

PRODUCT CATEGORY

CONTACT US

WhatsApp:
+8618138228327
Tel:
+86-181-3822-8327
Add:
11th Floor No.48 Xinyu Rr, Xinqiao Community, Xinqiao Street, Bao'an, Shenzhen, China
Copyright © 2026 Shenzhen XingKeChuang Technology Co., Ltd. All Rights Reserved. | Sitemap | Privacy Policy