Quick Answer

M12 A-coded, 4-pin sensor connector: Pin 1 = brown = +V (L+) · Pin 2 = white = second output / NC / diagnostic · Pin 3 = blue = 0 V (L−) · Pin 4 = black = switching output (NO).
A 3-wire NPN or PNP sensor uses pins 1, 3 and 4 only. Always confirm against the pin drawing on the sensor label or datasheet, because 2-wire, analog and special-function sensors can differ.

What is the M12 A-coded pinout for a 3-wire or 4-wire sensor?

For DC proximity sensors, photoelectric sensors and other switching sensors, pins 1, 3 and 4 always carry supply and the main output. The wire colours on a moulded M12 cordset match the colours of a cable-version sensor, so a brown-blue-black wiring diagram reads the same whether the sensor has a fixed cable or a connector.

PinCordset wire colour3-wire DC (NPN / PNP)4-wire DC (NO + NC)IO-Link device (port class A)
1Brown (BN)+V supply (L+)+V supply (L+)L+ (24 V)
2White (WH)Not connectedOutput 2, NCDI / DO (extra switching channel)
3Blue (BU)0 V (L−)0 V (L−)L− (0 V)
4Black (BK)Switching output (NO or NC)Output 1, NOC/Q (IO-Link communication or switching output)
5 (5-pin only)Grey (GY)Not used / functional earthNot used / functional earthNot used in port class A

The NPN or PNP type does not change the pin numbers. An NPN output on pin 4 switches to 0 V when the target is present; a PNP output on pin 4 switches to +V. How each one connects to a sinking or sourcing PLC input is shown in NPN vs PNP proximity sensor wiring.

M12 A-coded 4-pin male connector face and wire colours Schematic face of a 4-pin M12 male connector on the sensor side: pin 1 brown +V upper right, pin 2 white upper left, pin 3 blue 0 V lower left, pin 4 black output lower right, with the coding key at the top. coding key 1 2 3 4 Male face, sensor side (5th pin centre, if fitted) Pin 1 · Brown · +V (L+) Pin 2 · White · NC / 2nd output Pin 3 · Blue · 0 V (L−) Pin 4 · Black · Output (NO)
Illustration: schematic M12 A-coded 4-pin male face (sensor side). The cable-side female socket is the mirror image. Confirm the drawing printed on the sensor label or datasheet before wiring.

What do A, B, D and X coding mean on an M12 connector?

Coding is a mechanical key and keyway that stops a connector being plugged into the wrong kind of circuit. Sensors and actuators use A coding; the others are for networks or power.

M12 codingTypical useCommon pin countsStandard
ASensors, actuators, DC power, IO-Link3, 4, 5, 8, 12IEC 61076-2-101
BFieldbus (e.g. PROFIBUS DP)5IEC 61076-2-101
DIndustrial Ethernet, 100 Mbit/s4IEC 61076-2-101
XIndustrial Ethernet, up to 10 Gbit/s8IEC 61076-2-109
K, L, S, TAC / DC power distribution4–5IEC 61076-2-111

A 4-pin A-coded cordset fits a 3-pin A-coded sensor plug, because the 3-pin version simply omits pin 2. A B-, D- or X-coded cable will not mate with an A-coded sensor.

How do you check an M12 pinout before wiring a sensor?

  1. Read the label or datasheet. Every SEGMENsensor part number has its M12 pin assignment on the label and in the M12 flush inductive proximity sensor datasheet (PDF).
  2. Identify the output code. In SEGMENsensor part numbers, NA / NB = NPN NO / NC, PA / PB = PNP NO / NC, NC / PC = NO + NC (4-wire), DA / DB = DC 2-wire NO / NC.
  3. Measure the supply. With the cordset plugged in, check brown (pin 1) to blue (pin 3) is within the supply range, 10–30 V DC for standard SGI-GP 3-wire models.
  4. Test the output. Bring a steel target inside the rated sensing distance and check that pin 4 (black) switches and the LED changes state.
SymptomLikely causeWhat to do
LED off, no outputSupply on wrong pins, or cordset not fully screwed inCheck +V on pin 1 (brown) and 0 V on pin 3 (blue); tighten the coupling nut
LED switches, PLC sees nothingNPN sensor on a sourcing input or PNP on a sinking inputMatch output type to PLC input common (see wiring guide)
Signal only on white wireNC or second output used instead of pin 4Move the PLC input to the black wire (pin 4), or order the NO version
Cordset will not plug inDifferent coding (B, D or X) or M8 vs M12 threadUse an A-coded M12×1 cordset

Which SEGMENsensor sensors come with an M12 connector?

The Q4 suffix in a SEGMENsensor part number means an M12 connector; C2 means a 2 m fixed cable. The pin assignment above applies to the 3-wire and 4-wire examples below. DC 2-wire and analog-output models use their own assignment, shown on their datasheets.

Part numberHousing / mountingSensing rangeOutputPins usedSeries page
SGI-GP12S-040PA-Q4M12, flush4 mmPNP NO, 10–30 V DC1, 3, 4M12 flush
SGI-GP12S-040NA-Q4M12, flush4 mmNPN NO, 10–30 V DC1, 3, 4M12 flush
SGI-GP12S-040PC-Q4M12, flush4 mmPNP NO + NC, 10–30 V DC1, 2, 3, 4M12 flush
SGI-GP18S-050PA-Q4M18, flush5 mmPNP NO, 10–30 V DC1, 3, 4M18 flush
SGI-GP30S-100PA-Q4M30, flush10 mmPNP NO, 10–30 V DC1, 3, 4M30 flush
SGI-HP12S-015PA-Q4-L69M12, flush, high pressure1.5 mmPNP NO, 10–30 V DC1, 3, 4High-pressure series
SGI-AO12S-040I-Q4M12, flush, analog0.5–4.0 mm4–20 mA, 18–30 V DCSee datasheetAnalog output

For a 4–20 mA loop, the 4–20 mA loop resistance calculator checks whether the supply can drive the cable and PLC input. Mounting choice is covered in flush vs non-flush proximity sensors, and the full range is on the inductive proximity sensor page.

To get a quotation, send the housing size, flush or non-flush mounting, sensing distance, output code, M12 connector or cable, supply voltage and estimated annual volume. Qualification samples of 1–5 pcs ship in 5–7 working days; production lead time and MOQ are confirmed with the quotation. Trade terms are FOB China with 100% T/T in advance, and we reply within 24 hours.

Frequently Asked Questions

Pin 1 is the positive supply (+V, L+). On a standard M12 cordset it is the brown wire. For standard SEGMENsensor SGI-GP 3-wire sensors the supply is 10–30 V DC.

Pin 4, the black wire, carries the switching output on 3-wire NPN and PNP sensors. Pin 1 (brown) is +V, pin 3 (blue) is 0 V, and pin 2 is not connected.

Pin 2 carries a second signal: the NC output on a 4-wire NO + NC sensor, a diagnostic or alarm output on some sensors, or the extra DI / DO channel on IO-Link devices. On a plain 3-wire sensor it is not connected.

A coding is used for sensors, actuators, DC power and IO-Link. D coding is a 4-pin layout for 100 Mbit/s industrial Ethernet. The keyways are different, so the two cannot be plugged together.

Yes, if both are A-coded. Pins 1 to 4 line up, and the grey pin 5 wire of the cable is left unused. A 4-pin cable on a 5-pin sensor works only if the sensor does not need pin 5.

Choose a part number ending in Q4, which means M12 connector. For example, SGI-GP12S-040PA-Q4 is an M12 flush, 4 mm, PNP NO sensor. Qualification samples of 1–5 pcs ship in 5–7 working days; production lead time and MOQ are confirmed with the quotation.