Component guide · Beginner · 10 min read
LJ12A3-4-Z/BX Inductive Proximity Sensor

Codes, Wiring and Code
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
The LJ12A3-4-Z/BX is the most common inductive proximity sensor: an M12 metal barrel that detects metal up to 4 mm away without touching it. It runs from 6 to 36 V and has an NPN normally-open output. The same LJ series comes in M4 to M30 sizes and NPN, PNP, normally-closed, 2-wire and AC versions, all decoded from the part code. Use it for end stops, counting and bed levelling.
Key specs at a glance
- Detects
- Metal only (steel best; aluminium and copper at shorter range)
- Range
- 4 mm (LJ12A3-4), 8 mm (LJ18A3-8), 10 mm (LJ24A3-10), 15 mm (LJ30A3-15), 1-2 mm (LJ4/5/6/8A3)
- Supply
- 6 to 36 V DC (Z types), 90 to 250 V AC (J types)
- Output
- NPN or PNP, open collector, up to 200-300 mA
- Wires
- Brown +V, blue 0 V, black output (3-wire); brown and blue only on 2-wire
- Housing
- Threaded metal barrel, IP65 to IP67
Models in this guide
These are alternatives. Pick the one that fits your project; you only need one.
Option 1LJ12A3-4-Z/BX Inductive Proximity Sensor NPN NO 4mm DC6–36V – M12 Thread₹170
Option 2LJ12A3-4-Z/BX Inductive Proximity Sensor NPN NO DC6-36V 4mm Range₹198
Option 3Inductive Proximity Switch LJ12A3-4-Z/BX₹154
Option 4LJ12A3-4-J/DZ / R12-4A2 Inductive Proximity Sensor NC, 4mm Detection, DC 6–36V, IP65, 1.2m Cable₹159
Option 5LJ12A3-4-J/EZ / R12-4A1 Inductive Proximity Sensor NO, DC 6–36V, 4mm Detection Range, IP65₹159
Option 6LJ12A3-4-Z/AX Inductive Proximity Sensor – NPN Output, 4mm Range, IP65, Metal Shell₹159
What the LJ12A3 proximity sensor is
The sensor makes an alternating magnetic field at its face. Metal in front of it absorbs some of that field, and the electronics switch the output.
Reading the code: LJ = inductive, 12 = M12 barrel, A3 = cylinder, 4 = 4 mm range, Z = DC (J = AC), and the last letters set the output: AX = NPN NC, BX = NPN NO, AY = PNP NC, BY = PNP NO, DX/EX = 2-wire DC NC/NO, DZ/EZ = 2-wire AC NC/NO. For an Arduino or ESP32, choose an NPN 3-wire type (BX or AX).
LJ12A3 proximity sensor pinout
The pins on the LJ12A3 proximity sensor and what each one does.
| Pin | Function |
|---|---|
| Brown | +V supply, 6 to 36 V DC (or AC live on J types) |
| Blue | 0 V / GND |
| Black | Output (3-wire types): NPN pulls to 0 V, PNP pulls to +V |
| LED | Lights when metal is detected |
- Brown
- +V supply, 6 to 36 V DC (or AC live on J types)
- Blue
- 0 V / GND
- Black
- Output (3-wire types): NPN pulls to 0 V, PNP pulls to +V
- LED
- Lights when metal is detected
Wiring the LJ12A3 proximity sensor
An NPN output only pulls the signal to ground, so the board's own pull-up sets the HIGH level: the Arduino sees 5 V, the ESP32 3.3 V, and the 12 V never reaches the pin. A PNP output switches +12 V and must go through a divider or an optocoupler. Never wire AC (J) types to a microcontroller.
| LJ12A3 proximity sensor pin | Arduino Uno | ESP32 |
|---|---|---|
| Brown | 12 V supply + | 12 V supply + |
| Blue | Supply - and Uno GND | Supply - and ESP32 GND |
| Black (NPN) | D2 with INPUT_PULLUP (5 V) | GPIO 27 with INPUT_PULLUP (3.3 V) |
- Brown
- Arduino Uno:
- 12 V supply +
- ESP32:
- 12 V supply +
- Blue
- Arduino Uno:
- Supply - and Uno GND
- ESP32:
- Supply - and ESP32 GND
- Black (NPN)
- Arduino Uno:
- D2 with INPUT_PULLUP (5 V)
- ESP32:
- GPIO 27 with INPUT_PULLUP (3.3 V)
Example code
With an NO (BX) sensor the input reads LOW when metal is present. For a 3D printer Z probe, connect black to the Z-min input and set the probe offset in firmware.
const int SENSOR = 2;
volatile unsigned long count = 0;
void hit() { count++; }
void setup() {
Serial.begin(115200);
pinMode(SENSOR, INPUT_PULLUP); // NPN output pulls LOW on metal
attachInterrupt(digitalPinToInterrupt(SENSOR), hit, FALLING);
}
void loop() {
static unsigned long last = 0;
if (count != last) {
last = count;
Serial.print("Count: "); Serial.println(count);
}
}Setup and tuning
the stated range is for mild steel; aluminium gives about 40 % of it, so test with your target.
shielded (flush) types can sit flush in metal; unshielded need clear space around the face.
12 or 24 V works best; at 5 V many will not switch reliably.
works on steel or steel-sheet beds, not on bare glass or aluminium at full range.
What you need
Shop this list20 of 20 found in our store · ₹4,748
Generic LJ12A3-4-Z/BX Inductive Proximity Sensor NPN NO 4mm DC6–36V – M12 Thread: the part this guide coversLJ12A3-4-Z/BX Inductive Proximity Sensor NPN NO 4mm DC6–36V – M12 Thread₹170
LJ12A3-4-Z/BX Inductive Proximity Sensor NPN NO DC6-36V 4mm Range: another version this guide coversLJ12A3-4-Z/BX Inductive Proximity Sensor NPN NO DC6-36V 4mm Range₹198
Inductive Proximity Switch LJ12A3-4-Z/BX: another version this guide coversInductive Proximity Switch LJ12A3-4-Z/BX₹154
Generic LJ12A3-4-J/DZ / R12-4A2 Inductive Proximity Sensor NC, 4mm Detection, DC 6–36V, IP65, 1.2m Cable: another version this guide coversLJ12A3-4-J/DZ / R12-4A2 Inductive Proximity Sensor NC, 4mm Detection, DC 6–36V, IP65, 1.2m Cable₹159
LJ12A3-4-J/EZ / R12-4A1 Inductive Proximity Sensor NO, DC 6–36V, 4mm Detection Range, IP65: another version this guide coversLJ12A3-4-J/EZ / R12-4A1 Inductive Proximity Sensor NO, DC 6–36V, 4mm Detection Range, IP65₹159
Generic LJ12A3-4-Z/AX Inductive Proximity Sensor – NPN Output, 4mm Range, IP65, Metal Shell: another version this guide coversLJ12A3-4-Z/AX Inductive Proximity Sensor – NPN Output, 4mm Range, IP65, Metal Shell₹159
Generic LJ12A3-4-Z/AY Inductive Proximity Sensor NPN NO, DC 6–36V, 4mm Detection, IP65: another version this guide coversLJ12A3-4-Z/AY Inductive Proximity Sensor NPN NO, DC 6–36V, 4mm Detection, IP65₹146
Generic LJ12A3-4-Z/BY Inductive Proximity Sensor – NPN NO Output, 4mm Range, 1.15m Cable: another version this guide coversLJ12A3-4-Z/BY Inductive Proximity Sensor – NPN NO Output, 4mm Range, 1.15m Cable₹349
LJ12A3-4-Z/DX Inductive Proximity Sensor NC, 6–36VDC, 4mm Detection Range: another version this guide coversLJ12A3-4-Z/DX Inductive Proximity Sensor NC, 6–36VDC, 4mm Detection Range₹349
LJ12A3-4-Z/EX Inductive Proximity Sensor 2-Wire DC NO, 4mm Detection, 6–36V, IP66: another version this guide coversLJ12A3-4-Z/EX Inductive Proximity Sensor 2-Wire DC NO, 4mm Detection, 6–36V, IP66₹159
LJ18A3-8-J/DZ / R18-8A2 Inductive Proximity Sensor NC, DC 6–36V, 300mA, 6.4mm Detection Range: another version this guide coversLJ18A3-8-J/DZ / R18-8A2 Inductive Proximity Sensor NC, DC 6–36V, 300mA, 6.4mm Detection Range₹209
Generic LJ18A3-8-J/EZ Inductive Proximity Sensor NO, DC 6–36V, 6.4mm Detection, Brass-Nickel Plated, IP65: another version this guide coversLJ18A3-8-J/EZ Inductive Proximity Sensor NO, DC 6–36V, 6.4mm Detection, Brass-Nickel Plated, IP65₹209
Generic LJ18A3-8-Z/AX Inductive Proximity Sensor NPN NC, DC 6–36V, 6.4mm Detection, Brass-Nickel Plated: another version this guide coversLJ18A3-8-Z/AX Inductive Proximity Sensor NPN NC, DC 6–36V, 6.4mm Detection, Brass-Nickel Plated₹329
Generic LJ18A3-8-Z/AY Inductive Proximity Sensor PNP NC, DC 6–36V, 6.4mm Detection Range: another version this guide coversLJ18A3-8-Z/AY Inductive Proximity Sensor PNP NC, DC 6–36V, 6.4mm Detection Range₹219
LJ18A3-8-Z/BX Inductive Proximity Sensor NPN NO, DC 6–36V, 8mm Range, IP54: another version this guide coversLJ18A3-8-Z/BX Inductive Proximity Sensor NPN NO, DC 6–36V, 8mm Range, IP54₹389
Generic LJ18A3-8-Z/BY Inductive Proximity Sensor PNP NO, DC 6–36V, 8mm Detection, IP65: another version this guide coversLJ18A3-8-Z/BY Inductive Proximity Sensor PNP NO, DC 6–36V, 8mm Detection, IP65₹379
LJ18A3-8-Z/DX Inductive Proximity Sensor, 2-Wire DC NC, 6–36V, 6.4mm Detection Range: another version this guide coversLJ18A3-8-Z/DX Inductive Proximity Sensor, 2-Wire DC NC, 6–36V, 6.4mm Detection Range₹185
Generic LJ18A3-8-Z/EX Inductive Proximity Sensor, 6.4mm Detection Range, 2-Wire DC NO, 10-36V, IP65: another version this guide coversLJ18A3-8-Z/EX Inductive Proximity Sensor, 6.4mm Detection Range, 2-Wire DC NO, 10-36V, IP65₹209
Generic LJ24A3-10-J/DZ / R24-10A2 Inductive Proximity Sensor AC NC, 10mm Detection, 90–250VAC, 400mA, IP65: another version this guide coversLJ24A3-10-J/DZ / R24-10A2 Inductive Proximity Sensor AC NC, 10mm Detection, 90–250VAC, 400mA, IP65₹299
Generic LJ24A3-10-J/EZ / R24-10A1 Inductive Proximity Sensor, AC NO, 90–250VAC, 400mA, 10mm Range, IP65, Brass-Nickel Plated Housing: another version this guide coversLJ24A3-10-J/EZ / R24-10A1 Inductive Proximity Sensor, AC NO, 90–250VAC, 400mA, 10mm Range, IP65, Brass-Nickel Plated Housing₹319
Alternatives and when to choose them
- Inductive and capacitive proximity sensors: how the types and outputs compare.
- Limit switches: mechanical end stops, cheaper and simpler.
- Hall effect sensor: detects magnets at low voltage.
Try it: Voltage divider calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Wiring a PNP output straight into a 3.3 V or 5 V pin.
- Powering it from 5 V and getting no switching.
- Expecting the full range on aluminium or copper.
- Connecting an AC (J) type to low-voltage electronics.
Frequently asked questions
What does LJ12A3-4-Z/BX mean?
M12 inductive sensor, 4 mm range, DC supply, NPN normally-open output.
Can I connect it to an Arduino?
Yes, an NPN type with the input's pull-up enabled. Power the sensor from 6 to 36 V.
Does it detect plastic or wood?
No, only metal. Use a capacitive sensor for non-metals.
NPN or PNP?
NPN for Arduino and most 3D printer boards; PNP for many European PLCs.
Can it work as a 3D printer Z probe?
Yes, on steel beds, with the output to the Z-min pin.
Parts for this guide
- ₹170View
- ₹198View
- ₹154View
- ₹159View
- ₹159View
- ₹159View
- ₹146View
- ₹349View
- ₹349View
- ₹159View
- ₹209View
- ₹209View
- ₹329View
- ₹219View
- ₹389View
- ₹379View
- ₹185View
- ₹209View
- ₹299View
LJ24A3-10-J/EZ / R24-10A1 Inductive Proximity Sensor, AC NO, 90–250VAC, 400mA, 10mm Range, IP65, Brass-Nickel Plated Housing₹319View
LJ24A3-10-Z/AX Inductive Proximity Sensor, NPN NC, 10mm Detection, 6-36VDC, IP65, Brass-Nickel Housing₹309View
LJ24A3-10-Z/AY Inductive Proximity Sensor PNP NC, 10mm Detection, 6-36VDC, 300mA, Brass-Nickel Housing, IP65₹289View- ₹359View
- ₹359View
LJ24A3-10-Z/DX Inductive Proximity Sensor, 2-Wire DC NC, 6–36VDC, 10mm Detection Range, Brass-Nickel Plated Housing₹269View
LJ24A3-10-Z/EX Inductive Proximity Sensor, 2-Wire DC NO, 6–36VDC, 10mm Detection Range, Brass-Nickel Plated Housing, IP65₹359View- ₹319View
- ₹389View
- ₹379View
- ₹389View
- ₹689View
- ₹529View
- ₹309View
LJ30A3-15-Z/EX Inductive Proximity Sensor, 15mm Range, 2-Wire DC NO, 6–36VDC, IP65, Brass-Nickel Plated₹359View- ₹379View
- ₹439View
- ₹709View
LJ4A3-1-Z/BY Inductive Proximity Sensor, PNP NO, 1mm Detection Range, 12-24VDC, IP65, Brass-Nickel Housing₹469View- ₹409View
- ₹389View
- ₹859View
- ₹829View
- ₹459View
- ₹389View
- ₹439View
- ₹499View
- ₹249View
- ₹369View
- ₹249View
- ₹259View
- ₹339View
- ₹359View
- ₹389View
- ₹298View
- ₹74View
- ₹28View
- ₹49View
Calculators
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.































