Inductive Proximity Sensor interfacing
with Arduino, Node MCU and ESP32
An inductive sensor is a non-contact type of sensor, helpful in the detection of metallic objects. It can sense ferrous as well as non-ferrous materials. The sensing range is up to 100 mm. There are mechanical switches such as bump switches which are contact detection switches. This means if the object is in touch with the switch, then only it will operate. Over a period of time there will be wear and tear and we need to replace the switch.
This is not the case in the inductive sensor. Inductive proximity sensors have solid-state assembly – no moving parts. They work on proximity basis and as such there will be no physical contact and hence no wear and tear consequently offering a long life.
Working principle of most of the inductive sensors is almost similar. There will be an LC oscillator inside a tube like structure which produces electro-magnetic field. When any metal piece cuts into the magnetic field oscillations dampen due to eddy currents produced in the metal piece. This change in amplitude is gauged to trigger NPN or PNP transistor.
The trigger circuit is normally a Schmitt trigger. It monitors the amplitude of an oscillator. If the oscillator’s amplitude reaches a predetermined level, the trigger circuit gives the signal to the output circuit to switch-ON the output. This gives a perfect square wave which can be read by Arduino controller.
Advantages of Inductive Proximity Sensors
- Contactless sensing.
- High switching rate.
- Long-life as no moving parts are there.
- Easy installation.
- Disadvantages of Inductive Proximity Sensors
- Can sense only metal.
- Range detection limitation. The maximum detection range is 100mm.
Since these proximity sensors have inductance in them, we cannot power them using Arduino power supply as inductance may release high energy at times which can destroy Arduino. Further the voltage requirements of inductive proximity sensor is much higher typically about 12 volts though the specification says 6 to 36 volts DC external power supply. Ground Pin of this external power supply and Arduino board must be tied together to avoid circulating current.
Inductive Proximity Sensor interfacing with Arduino:
Output of the sensor may be connected to any digital pin 7 or analog pin as the output toggles between 0 and 5 when the sensor detects the object. We need to connect two LEDs one green to indicate power on condition which is connected to Digital Pin 2. The red LED and buzzer are connected to Pin 3 and Pin 4 to indicate when the object is detected by proximity sensor. We have connected 220 ohms current limiting resistors in series with Red LED, Green LED and Buzzer other end of which is tied together and connected to Arduino ground.
Application 1: When the object is detected the Arduino Pin 7 gets change in status and this should be used to pull the Pin 12 High which would trigger the relay which in turn switches the bulb On. Instead of using 230volt bulbs we are using 12volt DC bulbs as they are safer.
Application 2: When the object is detected the Arduino Pin 7 gets change in status and this should be used to pull the Pin 12 High which would trigger the counter each time the Pin 12 changes status. This would give us the count of number of objects passing on the conveyer belt.
Inductive Proximity Sensor interfacing with Node MCU:
Output of the sensor may be connected to any digital pin GPIO7 or Analog pin ADC0 as the output toggles between 0 and 1 when the sensor detects the object. We need to connect two LEDs one green to indicate power on condition which is connected to Digital Pin GPIO2. The red LED and buzzer are connected to Pin GPIO3 and Pin GPIO4 to indicate when the object is detected by proximity sensor. We have connected 220 ohms current limiting resistors in series with Red LED, Green LED and Buzzer other end of which is tied together and connected to Node MCU ground.
Application 1: When the object is detected the Node MCU Pin GPIO7 gets change in status and this should be used to pull the Pin GPIO12 High which would trigger the relay which in turn switches the bulb On. Instead of using 230volt bulbs we are using 12volt DC bulbs as they are safer.
Application 2: When the object is detected the Node MCU Pin GPIO7 gets change in status and this should be used to pull the Pin GPIO12 High which would trigger the counter each time the Pin GPIO12 changes status. This would give us the count of number of objects passing on the conveyer belt.
Inductive Proximity Sensor interfacing with ESP32:
Output of the sensor may be connected to any digital pin GPIO7 or analog pin as the output toggles between 0 and 1 when the sensor detects the object. We need to connect two LEDs one green to indicate power on condition which is connected to Digital Pin GPIO2. The red LED and buzzer are connected to Pin GPIO3 and Pin GPIO4 to indicate when the object is detected by proximity sensor. We have connected 220 ohms current limiting resistors in series with Red LED, Green LED and Buzzer other end of which is tied together and connected to ESP32 ground.
Application 1: When the object is detected the ESP32 Pin GPIO7 gets change in status and this should be used to pull the Pin GPIO12 High which would trigger the relay which in turn switches the bulb On. Instead of using 230volt bulbs we are using 12volt DC bulbs as they are safer.
Application 2: When the object is detected the ESP32 Pin GPIO7 gets change in status and this should be used to pull the Pin GPIO12 High which would trigger the counter each time the Pin GPIO12 changes status. This would give us the count of number of objects passing on the conveyer belt.