How to Connect a Photoelectric Sensor to a PLC for Motor Control: A Step-by-Step Guide for Automation Engineers

1. Understanding the Photoelectric Sensor Output Types

Before wiring, identify your sensor’s output type: NPN (sinking) or PNP (sourcing). Most industrial PLCs prefer PNP sensors for positive logic. For example, an Autonics BUP-30S (PNP) outputs +24V when triggered, while an NPN version outputs 0V. Check the sensor datasheet for voltage range (typically 10-30VDC) and current rating (usually 100-200mA). Ensure the sensor is set to NO (Normally Open) if you want the motor to run when an object is detected, or NC (Normally Closed) for fail-safe operation.

2. Wiring the Sensor to the PLC Input Module

Connect the sensor’s brown wire to +24VDC and blue wire to 0VDC (ground). For a PNP sensor, connect the black (output) wire to the PLC digital input pin (e.g., I0.0 on Siemens S7-1200). For NPN, connect the output wire to the PLC input pin, but also ensure the PLC input is configured for sinking mode. Use a shielded cable if the sensor is near motor drives to avoid electrical noise. Verify the wiring with a multimeter: when the sensor detects an object, the voltage between black and blue should be +24V (PNP) or 0V (NPN).

How to Connect a Photoelectric Sensor to a PLC for Motor Control: A Step-by-Step Guide for Automation Engineers-1

3. Programming the PLC Ladder Logic for Motor Control

In your PLC programming software (e.g., Siemens TIA Portal or Rockwell Studio 5000), create a simple ladder logic rung. Use the input from the sensor (I0.0) to energize a motor relay output (Q0.0). For example:

How to Connect a Photoelectric Sensor to a PLC for Motor Control: A Step-by-Step Guide for Automation Engineers-2

- | I0.0 | | ( ) Q0.0 |

This means when the sensor is activated (NO contact closes), the motor starts. Add a start/stop button in series or parallel for manual override. For safety, include a normally closed emergency stop (E-stop) in series with the sensor.

How to Connect a Photoelectric Sensor to a PLC for Motor Control: A Step-by-Step Guide for Automation Engineers-3

4. Adding Time Delays and Interlocks for Reliability

To prevent rapid motor cycling due to flickering sensor signals, insert a timer in the program. For instance, use a TON (Timer On Delay) with a 0.5-second delay before the motor starts. Also, add a seal-in contact: once the motor starts, a normally open contact from Q0.0 holds the circuit active, even if the sensor signal drops briefly. If the sensor fails, add an alarm output (e.g., Q0.1) to notify the operator.

5. Connecting the PLC Output to the Motor Starter

The PLC output (Q0.0) typically drives a relay or contactor coil. Wire the PLC output’s common (COM) to +24VDC and the output pin to the relay coil. The relay contacts then switch the motor’s 3-phase power through a contactor. Use a 24VDC relay with a flyback diode across the coil (cathode to +24V) to protect the PLC output from voltage spikes. For larger motors, use a PLC output module with isolated outputs to avoid ground loops.

6. Testing and Troubleshooting Common Issues

Power up the system and test with a target object. If the motor doesn’t start, check:

- Sensor alignment: Use a reflective tape or adjust the sensitivity pot.

- PLC input status: Monitor I0.0 in the software—should be 1 when object is present.

- Output wiring: Ensure Q0.0 LED is on when the ladder logic is true.

If the motor runs erratically, add a shielded cable or a ferrite bead on the sensor line. For noise issues, use a PLC input filter (e.g., 10ms debounce time) in the hardware configuration.