ESP32 Inductive Proximity Sensor Metal Detection Project
The ESP32 Inductive Proximity Sensor Metal Detection project is a simple and powerful way to detect metallic objects using an ESP32 microcontroller. Inductive proximity sensors are widely used in industrial automation, object detection systems, and manufacturing units for reliable metal detection without physical contact.
In this tutorial, you will learn how to interface an inductive proximity sensor with ESP32, understand how metal detection works, and run a simple program to detect metallic objects using the Serial Monitor.
What is an Inductive Proximity Sensor?
An inductive proximity sensor is a non-contact sensor used to detect metallic objects. It works by generating an electromagnetic field. When a metal object enters this field, it changes the sensor’s output signal.
Unlike ultrasonic or IR sensors, inductive proximity sensors only detect metal objects, making them ideal for industrial and automation applications.
How ESP32 Inductive Proximity Sensor Metal Detection Works
The ESP32 Inductive Proximity Sensor Metal Detection system works as follows:
- The inductive sensor generates an electromagnetic field.
- When a metal object comes near the sensor, the field is disturbed.
- The sensor output changes (HIGH or LOW).
- The ESP32 reads this signal.
- The ESP32 prints “Metal Detected” on the Serial Monitor.
This contactless detection makes the system reliable and long-lasting.
Components Required
To build this ESP32 Inductive Proximity Sensor Metal Detection project, you need:
- ESP32 Development Board
- Inductive Proximity Sensor (e.g., LJ12A3-4-Z/BX)
- External Power Supply (if required by sensor)
- Resistors (for voltage divider if needed)
- Jumper Wires
Inductive Proximity Sensor Pinout
Most common 3-wire inductive proximity sensors have:
| Wire Color | Function |
|---|---|
| Brown | VCC (6V–36V depending on model) |
| Blue | GND |
| Black | Output Signal |
⚠ Important: Many industrial inductive sensors output 12V or 24V, so you must use a voltage divider before connecting to ESP32 (which supports only 3.3V logic).
Circuit Connection for ESP32 Inductive Proximity Sensor Metal Detection
| Inductive Sensor | ESP32 |
|---|---|
| Output (via voltage divider) | GPIO 27 |
| GND | GND |
| VCC | External Supply |
Once connected properly, the ESP32 can detect metal objects safely.

ESP32 Code for Inductive Proximity Sensor Metal Detection
Below is the working code for metal detection:
#define PROX_SENSOR 27
#define LED 2
void setup() {
Serial.begin(115200);
pinMode(PROX_SENSOR, INPUT);
pinMode(LED, OUTPUT);
Serial.println("ESP32 Inductive Proximity Sensor Metal Detection Started");
}
void loop() {
int sensorState = digitalRead(PROX_SENSOR);
if(sensorState == LOW) {
Serial.println("Metal Detected");
digitalWrite(LED, HIGH);
}
else {
Serial.println("No Metal Detected");
digitalWrite(LED, LOW);
}
delay(500);
}
Serial Monitor Output
When running the ESP32 Inductive Proximity Sensor Metal Detection system, you will see:
ESP32 Inductive Proximity Sensor Metal Detection Started
No Metal Detected
No Metal Detected
Metal Detected
Metal Detected
No Metal Detected
The built-in LED will glow when metal is detected.
Applications of ESP32 Inductive Proximity Sensor Metal Detection
The ESP32 Inductive Proximity Sensor Metal Detection project can be used in:
- Industrial automation
- Conveyor belt metal detection
- Machine part counting
- Metal object sorting systems
- Smart factory applications
- Security systems
Because the sensor works without contact, it has a long lifespan and high reliability.
Advantages of Inductive Proximity Sensors
Some key benefits include:
- Contactless metal detection
- High durability
- Resistant to dust and dirt
- Fast response time
- Suitable for harsh environments
These features make the ESP32 Inductive Proximity Sensor Metal Detection system ideal for industrial projects
Conclusion
The ESP32 Inductive Proximity Sensor Metal Detection project demonstrates how easily metal objects can be detected using an inductive sensor and ESP32. This project is perfect for students, hobbyists, and engineers interested in automation and IoT systems.
With minor modifications, you can extend this project to build:
- Industrial metal sorting systems
- Smart automation controllers
- Object counting machines
- IoT-based factory monitoring systems

Leave a Reply
You must be logged in to post a comment.