Phipps Electronics

Order within the next 

FREE SHIPPING OVER $199

50,000+ ORDERS

WORLDWIDE SHIPPING

SSL SECURED

Using the Inductive Proximity NPN Sensor LJ12A3-4-Z/BX with Arduino

Contents

Introduction

In this tutorial, we will learn about the LJ12A3-4-Z/BX sensor, what is an inductive proximity sensor and we will build a simple project using the LJ12A3-4-Z/BX sensor and an Arduino.

Inductive Proximity NPN Sensor LJ12A3-4/BX

The LJ12A3-4-Z/BX Module will be our main component for this tutorial. This module has a stainless steel threaded body with 3 wires for connection. Figure 1 shows the module as seen in fritzing.

Figure 1: LJ12A3-4-Z/BX Inductive Proximity NPN Sensor

Pin Out

The LJ12A3-4-Z/BX module has three wires.

Wire ColourDescription
Brown+5V
BlackOutput
BlueGND

What is an Inductive Proximity Sensor?

An inductive proximity sensor uses current-induced magnetic fields to detect nearby metal objects.

Project - Arduino Metal Detector

Our project will use the LJ12A3-4-Z/BX sensor and turn on a relay when it detects a metal object nearby.

Componentns

For this project, we need the following components:

  • Arduino Uno board (1 pc.)
  • LJ12A3-4-Z/BX Inductive Proximity NPN Sensor (1 pc.)

Wiring Diagram

The LJ12A3-4-Z/BX module pins are connected to the Arduino Uno board as follows:

Component PinUNO Board Pin
Brown+5V
BlackA0
BlueGND

Code

Below is the Arduino sketch for our project. I have added comments to explain important parts of the code. Save the code proximity_sensor.ino and upload it to your Arduino board.

				
					// Arduino and proximity sensor
void setup ()
{
Serial.begin(9600); // initialize serial
}
void loop ()
{
Serial.print("Analog pin: "); // display analog values to serial
Serial.print(analogRead(A0));
}
				
			

Project Test

Apply power to your Arduino Uno board and open the Serial Monitor in the Arduino IDE. Arduino will read the input from the inductive proximity sensor and display the value in the serial monitor. A value greater than 250 means metal is detected.

SUBSCRIBE FOR NEW POST ALERTS

Subscribe to be the first to know when we publish a new article!
List Subscriptions(Required)

POPULAR POSTS

Scroll to Top