How to Wire Discrete DC Sensors to PLC - Part 2
In this blog post, you will learn how to wire a 3-wire DC sensor, like an inductive proximity sensor, to a PLC input card. You will also learn what a 3-Wire Discrete sensor is and recognize some of the common types of 3-Wire Discrete sensors.
DC sensors can be used to indicate the state of a device or a process to the PLC program. Knowing these input states can allow the PLC program to make decisions, such as, when to start or stop a conveyor motor.
In the diagram below, the Programmable Logic Controller, or PLC, is running a ladder logic program. The inductive proximity switch is connected to a PLC input card, and the logic program is written to sense the state of the switch.
For instance, when a box is placed on a conveyor at the “loading” position, the proximity switch senses the presence of the box and commands the conveyor motor to start to transport the box to the next inspection station.
So, let’s see how we can make this important discrete sensor input information available to a PLC program. In order to do this, we need to understand more about these discrete sensors and how they are wired to the PLC.
Discrete DC Sensors, or discrete Direct Current sensors, operate in a circuit with a battery or other power source, commonly known as a power supply. A power supply is placed in an electrical circuit to provide power to the connected devices, like proximity switches, or a motor.
DC power supplies are referred to by their voltage and capacity, indicated by how many amperes they can supply. The more amperes a power supply can deliver, the larger and more expensive they generally are. In DC PLC circuits, the power supply almost always supplies 24 Volts DC to the connected devices.
In the diagram below, a DC circuit is shown which turns on a motor when a proximity switch senses the presence of a part or an object in a specific location. The common trait of all discrete DC sensors is that they have exactly two operating states, “on” and “off”.
A discrete DC switch, as in this diagram, is “on” when an object is in proximity to the switch and its internal contact is “closed”, forming a complete circuit and allowing the flow of electrons.
When the object is moved away from the proximity sensor, its contacts are “opened” again, the circuit is broken, and the flow of electrons stops. The state of the switch is “off”.
Other common examples of discrete DC Sensors include many other types of proximity sensors, level switches, pressure switches, and photoelectric sensors.
If we want to monitor the state of a proximity sensor in the PLC, we would need to connect the three wires of the proximity sensor to a digital input card in the PLC.
When the proximity sensor does not sense a part nearby, the PLC would see the input state as “off”, or a 0. The circuit to/from the PLC input is “open” or not energized.
When a part moves in front of the proximity sensor, the PLC input senses the change in state, and transmits this data through a communication channel to the processor memory, or data table.
When the proximity sensor senses a part nearby, the circuit to/from the PLC input is “closed” or energized.
We could then write a PLC program, which resides in the memory of the PLC, to take some action, like starting a conveyor motor, when a part is near the proximity sensor.
Wiring a discrete DC sensor to a PLC input card is easy and straightforward. In this article, we will consider only devices that have three wires that need to be connected to the PLC digital input card. An example, an inductive proximity switch, is shown in the image below. In a separate article, we will consider some simpler “two-wire” devices.
For most PLC’s, the input cards must match the type of circuit that will be employed to interface the device to the PLC. For example, a discrete DC device must be wired to a discrete DC input card. A discrete AC device would require a discrete AC input card. In this article, we will consider only DC devices.
In order to connect a “three-wire” discrete DC device to the PLC, we will need to identify whether the device is an NPN or a PNP type.
NPN and PNP are two types of bi-polar transistors, which are simply solid-state switches. You should always check the manufacturer’s datasheet for the device you are going to connect to the PLC to make sure you know its configuration.
Note the each of these sensors has three sensor wires. Wire 3 (black wire) is always connected to the load, which is the terminal for an input on a PLC digital input card.
In this simplified diagram of an inductive switch, there are three wires: one brown wire, one blue wire, and one black wire.
The standard convention is that the brown wire is connected to the positive side of the power supply (+24 Volts DC), and the blue wire is connected to the DC common terminal of the power supply. This is the negative (-) terminal that is present on the power supply. The black wire is the output, or “load” wire, of the sensor. It gets connected to the PLC input terminal.
Earlier we said an NPN sensor was referred to as a “sinking” switch. This means that the “load”, which is the PLC input, is wired as shown in the diagram below.
Notice that +24 Volts DC is wired to the PLC module’s common terminal. In other words, when the switch changes state, it “sinks” the load to common, or ground.
For many PLC manufacturers, connection of NPN sensors requires a specific model number for the digital input card. Because NPN sensors are “sinking”, they require a “sourcing” type PLC input card.
A PNP sensor is referred to as a “sourcing” switch. This means that the “load”, which is the PLC input, is wired as shown in the diagram below. Notice that the blue “common” wire is connected to the PLC module’s common terminal. In other words, when the switch changes state, it “sources” or supplies +24 Volts DC to the PLC input.
For many PLC manufacturers, connection of PNP sensor wiring requires a specific model number for the digital input card. Because PNP sensors are “sourcing”, they require a “sinking” type PLC input card.
Because NPN sensors sink voltage and PNP sensors source voltage to the PLC input, NPN and PNP sensors should never be mixed on a PLC input card. Doing so can lead to an unsafe condition. In this diagram an NPN and a PNP sensor are both connected to the same PLC input card.
In the diagram below, an NPN and a PNP sensor are both connected to the same PLC input card.
Note that the common terminal has a wire from the NPN sensor with +24 Volts DC connected to a blue wire from the PNP sensor, which would short the power supply to ground.
Now, let’s see how 3-wire discrete DC sensors are connected to actual PLC I/O cards.
Below is a schematic of one model of Siemens SM321 digital input card, part number 6ES7321-7BH01-0AB0. It is a 16-channel 24VDC digital input card that is very popular in Siemens PCS7 and S7-300 PLC systems. This digital input card wiring scheme is similar to most digital input cards used in the process industries.
The SM321-7BH01 has twenty screw terminals to which the digital inputs are connected. As we saw previously, for 3-wire discrete DC sensors, each digital input channel requires the connection of three wires.
The SM321 card is constructed so as to accept only PNP-type sensors in a 3-wire configuration. Use of NPN sensors would require a different model of I/O card.
The SM321 card requires 24VDC power to perform several functions. First, the card itself requires power to light the status LED’s, perform diagnostics, and to communicate the card’s input statuses back to the PLC. Power to the card is supplied by a 24 Volt DC power supply connected to terminals 1 and 20.
Internally inside the SM321 card, this same 24 Volt DC power is connected to terminals 10 and 11. The power at terminal 10 supplies power for the top group of eight digital inputs, and the power at terminal 11 supplies power for the bottom group of eight digital inputs.
Let’s just focus on the top eight inputs, labelled as Input 0 through Input 7. In practice, the PLC input card channel connections, terminals 2 – 9 and 12 – 19, will be brought out to a terminal block. These marshalling connections, as they are called, allow the field wires to be more easily terminated in the control panel.
These terminals are represented by the letters A – H in the diagram below. The installer usually “pre-wires” the marshalling terminals, terminal 2 on the SM321-7BH01 card to terminal A, terminal 3 to terminal B, and so on.
Now, let’s connect a PNP inductive proximity switch from the previous example to the SM321 card. The eight marshalling terminals A-H, are wired to Channels 0 – 7, and are the “load” terminals in our discrete circuits.
+24 Volts DC will be obtained from Terminal 10. Terminal 20 is connected to the power supply DC common. For a PNP device, care must be taken to connect the brown to the +24 Volt DC terminal and the black wire to the PLC input channel terminal.
If we connect the proximity switch to PLC input channel 0, then the black wire will land on terminal A. Finally, the blue wire will be connected to the power supply DC common, terminal 20.
When the proximity switch senses an object nearby, the state of the switch will change, and the input channel to which the proximity switch is wired, will indicate an “ON” state. Both the electronics in the switch and the PLC card are powered by the same 24 Volt DC power supply.
To review, we have learned that there are many types of discrete 3-wire DC sensors that can be wired to a PLC input.
Some 3-wire devices are NPN, or “sinking” sensors, and some are PNP, or “sourcing” sensors. The difference is in how the device operates when the switch actuates.
PNP switches “source” 24 Volts DC to the black wire when the switch is activated. NPN switches “sink” DC common to the black wire when the switch is activated. Remember, in both cases, the black wire is connected to the PLC input channel terminal.
For most 3-wire devices, there is typically one brown wire, one blue wire, and one black wire.
A schematic of your specific DC digital PLC input card is required to determine how your specific device should be wired.
For a 3-wire PNP discrete input device, the brown wire will be connected to +24 Volts DC, the blue wire will be connected to DC common, and the black wire will be connected to the PLC digital input channel terminal.
Thank you so much for taking part of your day to be here. Leave a comment to let us know what you think and make sure to subscribe to our newsletter to get the latest content first.
Sending you so much love love and support,
The RealPars Team
How to Wire Discrete DC Sensors to PLC – Part 1
Join the Top 1% of Automation Engineers
Start Your 7-day Free TrialLearn from Industry Experts
With a 7-day trial, then €25/month