Short answer

The first useful question is not 'which pin is pin one?' It is 'which M12 coding is this?' A-coded connectors are common around sensors and actuators, while D-coded and X-coded versions are commonly used for Ethernet-related connections.

PNP sensor to PLC input wiring diagramA three-wire PNP sensor sends positive voltage to a PLC input.PNP / SOURCING OUTPUTSENSOR3-wire DCPLC INPUTsinking / common −I0.0+24 V / brownsignal / black0 V / blue Original diagram · Signal Field Guide / field note connectors

What to look for

A visual keyway is a starting clue, not proof. Count the contacts, inspect the coding, and compare the connector's pin assignment with the device manual. Two connectors can share a thread size while serving completely different signals.

For intermittent faults, inspect the mating face, the cable exit, and the strain relief. A connector that works on the bench can open under vibration when the cable is pulled sideways by its own weight.

FIELD CASE / REASONING PATH

When the symptom appears in the plant

A maintenance team replaced a damaged photoelectric sensor on a conveyor. The new sensor had an M12 connector, but when plugged in, it immediately shorted out the machine's 24V power supply. The original sensor was a proprietary model with a non-standard pinout (power on Pin 2), while the replacement used the standard IEC pinout (power on Pin 1). The team had to rewire the mating cordset to match the new standard sensor.

DIAGNOSTIC SEQUENCE

Five checks before replacement

  1. Identify the connector coding (A-coded is standard for sensors, D-coded for Ethernet, etc.) to ensure physical compatibility.
  2. Consult the datasheets for both the sensor and the mating cordset to verify the pin-to-wire color mapping.
  3. Use a multimeter to measure the voltages on the female cordset pins before plugging in a new device.
  4. Check standard A-coded pinouts: Pin 1 (Brown) is +24V, Pin 3 (Blue) is 0V, Pin 4 (Black) is Normally Open output, and Pin 2 (White) is Normally Closed output.
  5. Inspect the connector pins and sockets for physical damage, pushed-in pins, or corrosion caused by liquid ingress.
PRACTICAL NOTES

Never assume the wire colors inside a generic cable exactly match standard industrial conventions without verifying.

Over-tightening M12 connectors can damage the O-ring and compromise the IP rating, leading to intermittent shorts.

Keep a cheat sheet of standard M12 and M8 pinouts inside your tool bag.

BEFORE YOU REPLACE THE PART

Bench checklist

  • Confirm the supply at the device terminals.
  • Confirm the meter is in the correct mode and position.
  • Confirm the input range matches the signal type.
  • Confirm the reference/common is intentional.
  • Record the reading before changing the wiring.

Reference families

  • IEC 61076-2-101 Standard
  • Sensor Connectivity Guides

Always verify the current edition and the exact device manual for the installation.

READ THE PRIMARY MATERIAL

Official references

These links point to standards bodies, industry organizations, or manufacturer documentation. Standards landing pages may require purchase or institutional access.

This note is an educational reference, not a substitute for the equipment manual, site procedures, or qualified electrical work.