How Eddy-Current Inductive Position Sensors Work
An inductive position sensor measures linear or rotary displacement by generating a high-frequency alternating electromagnetic field via an internal coil. When a conductive target (like a steel shaft or aluminum plate) enters this field, it induces circulating eddy currents on the target's surface. These eddy currents generate their own opposing magnetic field, which alters the coil's impedance—specifically dropping its inductance and increasing its effective resistance.
Unlike Hall effect sensors that require a permanent magnet, or optical sensors that fail in dirty environments, eddy-current sensors work through non-conductive barriers like plastic, glass, or oil. The sensor's internal oscillator and demodulation circuit continuously measure this impedance shift, translating the physical gap distance into a highly stable, proportional analog voltage (typically 0-10V or 4-20mA). For embedded projects requiring sub-millimeter precision in harsh environments, a 0-10V industrial eddy-current sensor paired with a high-resolution external ADC is the gold standard.
Sensor Specifications and ESP32 Wiring
Industrial inductive sensors are rugged but operate at 24V DC and output high-voltage analog signals that will instantly fry a 3.3V microcontroller. To interface a standard 0-10V sensor with an ESP32, we must step the voltage down and use an external ADC. The ESP32's internal 12-bit ADC is notoriously non-linear and noisy; for precision position tracking, the 16-bit Texas Instruments ADS1115 I2C ADC is mandatory.
| Parameter | Value / Specification | Engineering Notes |
|---|---|---|
| Supply Voltage | 15V to 30V DC | Standard industrial 24V DC nominal. Tolerates ripple up to 10%. |
| Output Signal | 0 to 10V DC | Linear analog. 0V = 0mm (face of probe), 10V = 50mm (full stroke). |
| Linearity | ≤ ±0.1% of Full Scale | ±0.05mm error over 50mm stroke. Requires 2-point calibration in code. |
| Target Material Dependency | Calibrated for Steel (St37) | Aluminum or copper targets will alter sensitivity; requires recalibration. |
| Temperature Coefficient | ±0.03% / °C | Conductivity of the target shifts with heat, causing minor zero-point drift. |
| Electrical Protection | Reverse polarity, short circuit | Output is short-circuit protected, but will clamp if tied to VCC. |
Wiring and Voltage Divider Network
To safely read the 0-10V signal, we use a voltage divider with R1 = 10kΩ and R2 = 4.7kΩ. This scales the maximum 10V input down to 3.197V, which sits safely within the 4.096V full-scale range (FSR) of the ADS1115's internal programmable gain amplifier (PGA).
| Component | Pin | Connects To | Notes |
|---|---|---|---|
| Inductive Sensor | Brown (VCC) | 24V DC Power Supply (+) | Do not power from ESP32 VIN. |
| Inductive Sensor | Blue (GND) | 24V DC Power Supply (-) | Tie 24V GND and ESP32 GND at ONE point. |
| Inductive Sensor | Black (Signal) | R1 (10kΩ) & R2 (4.7kΩ) Junction | Use shielded twisted pair cable. |
| Voltage Divider | R2 Bottom Leg | System Ground (GND) | Use 1% tolerance metal film resistors. |
| ADS1115 Module | A0 (Analog In) | R1/R2 Junction | Add 100nF ceramic cap to GND here. |
| ADS1115 Module | VDD / SDA / SCL | ESP32 3V3 / GPIO 21 / GPIO 22 | Standard I2C bus. Add 4.7k pull-ups. |
Raw ADC to Millimeter Conversion Math
The output of this inductive position sensor is strictly a continuous analog voltage. To get physical millimeters in your C++ code, you must reverse the voltage divider math and map the result to the sensor's physical stroke. The ADS1115 datasheet specifies that at the 4.096V PGA setting, one least significant bit (LSB) equals exactly 0.125 mV (0.000125V).
The Conversion Formula
- Calculate ADC Voltage:
V_adc = Raw_ADC * 0.000125 - Calculate Sensor Voltage:
V_sensor = V_adc * ((R1 + R2) / R2)→V_adc * (14.7 / 4.7) - Calculate Position:
Position_mm = (V_sensor / 10.0) * Stroke_Length
// ESP32 / Arduino C++ Implementation
#include <Wire.h>
#include <Adafruit_ADS1X15.h>
Adafruit_ADS1115 ads;
// Hardware constants
const float R1 = 10000.0; // 10k ohm
const float R2 = 4700.0; // 4.7k ohm
const float ADC_LSB = 0.000125; // 4.096V FSR / 32768
const float SENSOR_STROKE_MM = 50.0;
const float SENSOR_V_MAX = 10.0;
void setup() {
Serial.begin(115200);
ads.setGain(GAIN_ONE); // 4.096V Full Scale Range
ads.begin();
}
void loop() {
int16_t raw_adc = ads.readADC_SingleEnded(0);
// Guard against negative noise floors at 0mm
if (raw_adc < 0) raw_adc = 0;
float v_adc = raw_adc * ADC_LSB;
float v_sensor = v_adc * ((R1 + R2) / R2);
// Clamp to physical limits
if (v_sensor > SENSOR_V_MAX) v_sensor = SENSOR_V_MAX;
float position_mm = (v_sensor / SENSOR_V_MAX) * SENSOR_STROKE_MM;
Serial.print("Raw: "); Serial.print(raw_adc);
Serial.print(" | V_sensor: "); Serial.print(v_sensor, 3);
Serial.print("V | Pos: "); Serial.print(position_mm, 2); Serial.println(" mm");
delay(50); // 20Hz sampling rate
}
Calibration, Interference, and Signal Conditioning
While the math above provides theoretical position, real-world industrial environments demand calibration and EMI mitigation. Eddy current sensors are highly susceptible to specific interference sources that will manifest as jitter or offset drift in your ESP32 serial output.
Two-Point Linear Calibration
Resistor tolerances (even at 1%) and slight variations in the sensor's internal demodulator mean your calculated 50.00mm might read as 49.82mm. Perform a two-point calibration:
1. Place the target at exactly 0mm (touching the probe face) and record the raw ADC value (raw_zero).
2. Place the target at a known distance using gauge blocks (e.g., 40.00mm) and record the raw ADC value (raw_span).
3. Replace the theoretical multiplier in your code with a mapped slope: slope = 40.0 / (raw_span - raw_zero).
Common Interference Sources and Fixes
- Variable Frequency Drives (VFDs): VFDs switching high currents generate massive common-mode EMI that couples into analog sensor cables. Fix: Use a shielded twisted-pair cable for the sensor signal. Ground the shield at the power supply end only to prevent ground loops. Do not pigtail the shield; use a 360-degree shield clamp.
- Ground Loops: If the 24V supply and the ESP32's USB ground are at different potentials, current will flow through the sensor's ground wire, offsetting the 0-10V signal. Fix: Tie the 24V DC negative terminal and the ESP32 GND pin together at a single star-ground point on your breadboard or PCB.
- Target Material Temperature Drift: As noted in Micro-Epsilon's eddy-current principles, the electrical conductivity of the target changes with temperature. If your steel shaft heats up by 50°C during operation, the eddy currents penetrate deeper, causing a zero-point shift. Fix: If operating in high-heat environments, implement a software temperature compensation table using a secondary thermistor mounted near the target.
- High-Frequency ADC Noise: The ESP32's I2C bus and WiFi antenna can inject high-frequency noise into the ADS1115. Fix: Solder a 100nF ceramic capacitor and a 10µF tantalum capacitor directly across the A0 and GND pins on the ADS1115 breakout board to create a hardware low-pass filter.






