The Hall Effect Sensing Principle and Magnet Interaction
When a conductive material carrying a current is placed in a magnetic field, the Lorentz force pushes charge carriers to one side, creating a measurable transverse voltage. In modern embedded systems, a Hall effect sensor IC packages this element with an amplifier, outputting a voltage or digital signal proportional to the perpendicular magnetic flux density (B-field) passing through its silicon die. The sensor does not merely detect the presence of a magnet; it measures the exact vector of the magnetic field intersecting the die at a right angle.
Because the sensor is directional and distance-dependent, the physical shape, grade, and pole orientation of your chosen magnet for a Hall sensor dictate the field gradient, the linear travel range, and whether the output will saturate the IC's internal amplifier before the magnet even touches the plastic package. Selecting a magnet with too high a surface Gauss rating for a sensitive analog IC is a common bench mistake that results in a clipped, non-linear output signal.
Selecting the Right Magnet for Your Hall Sensor
Neodymium Iron Boron (NdFeB) magnets are the standard for embedded projects due to their high energy density, but ceramic (ferrite) magnets remain useful for high-temperature environments where NdFeB would suffer irreversible demagnetization. When sourcing a magnet, you must match the magnet's geometry to your sensor's packaging (TO-92 vs SOT-23) and the required air gap.
| Magnet Type | Grade | Dimensions (mm) | Surface Field | Field @ 5mm Gap | Field @ 10mm Gap | Best Application |
|---|---|---|---|---|---|---|
| NdFeB Disc | N52 | 6 x 2 | ~5,200 G | ~850 G | ~220 G | Short-stroke digital limit switches |
| NdFeB Cylinder | N42 | 6 x 10 | ~6,100 G | ~2,100 G | ~850 G | Linear position sensing (analog) |
| Ceramic (Ferrite) | Y30 | 10 x 3 | ~1,200 G | ~350 G | ~110 G | Low-cost proximity, high-temp (>150°C) |
| NdFeB Ring | N52 | 10 x 5 x 3 | ~4,800 G | ~1,400 G | ~550 G | Rotary encoders, BLDC commutation |
Wiring, Pinouts, and Signal Output Types
A critical mistake in sensor interfacing is conflating digital and analog outputs. A digital Hall switch (like the A3144) outputs a hard logic LOW or HIGH via an internal open-drain MOSFET. An analog Hall sensor (like the DRV5055) outputs a continuous voltage referencing an internal bandgap or the VCC rail. Below is the wiring and specification matrix for the most common 3-pin Hall ICs used in 2026 maker projects.
| Sensor IC | Type | VCC Range | Output Architecture | Pin 1 | Pin 2 | Pin 3 |
|---|---|---|---|---|---|---|
| SS49E | Analog | 2.7V - 6.5V | Ratiometric (VCC/2 quiescent) | VCC | GND | VOUT |
| DRV5055A1 | Analog | 2.5V - 5.5V | Absolute (0.25*VCC quiescent) | VOUT | GND | VCC |
| A3144 | Digital Switch | 3.8V - 24V | Open-Drain (Requires Pull-up) | VCC | GND | OUT |
| US5881 | Digital Latch | 2.2V - 24V | Push-Pull CMOS | VCC | GND | OUT |
According to Texas Instruments' Hall Effect design guides, ratiometric sensors like the SS49E scale their quiescent voltage and sensitivity directly with VCC. If your 5V supply sags to 4.8V under load, your zero-point shifts, requiring software compensation. Absolute sensors like the DRV5055 maintain a fixed sensitivity (e.g., 63 mV/mT) regardless of minor VCC ripple, making them vastly superior for precision ESP32 ADC interfacing.
Raw ADC Math: Converting Readings to Gauss
Let's interface the DRV5055A1 (±21 mT range) with an ESP32-S3. The ESP32's ADC operates at 3.3V. We will power the DRV5055A1 at exactly 3.3V using the ESP32's 3V3 pin.
- Quiescent Voltage (0 mT): 0.25 × 3.3V = 0.825V
- Sensitivity: 63 mV/mT (0.063 V/mT)
- Max Positive Field (+21 mT): 0.825V + (21 × 0.063) = 2.148V
- Max Negative Field (-21 mT): 0.825V - (21 × 0.063) = -0.498V (Clipped to 0V by the IC's internal rail limits)
To convert the raw 12-bit ADC reading (0-4095) into physical milliTesla (mT) units, we first derive the voltage, subtract the quiescent offset, and divide by the sensitivity. Note that 1 mT = 10 Gauss.
// ESP32-S3 DRV5055A1 Interfacing Code
const int HALL_PIN = 4;
const float VCC = 3.3;
const float ADC_MAX = 4095.0;
const float QUIESCENT_V = VCC * 0.25; // 0.825V
const float SENSITIVITY = 0.063; // 63 mV/mT
void setup() {
Serial.begin(115200);
analogReadResolution(12);
}
void loop() {
int raw_adc = analogRead(HALL_PIN);
// Convert raw ADC to Voltage
float voltage = (raw_adc / ADC_MAX) * VCC;
// Convert Voltage to milliTesla (mT)
float mT = (voltage - QUIESCENT_V) / SENSITIVITY;
// Convert mT to Gauss (optional, 1 mT = 10 Gauss)
float gauss = mT * 10.0;
Serial.printf("Raw: %d | V: %.3f | Field: %.2f mT\n", raw_adc, voltage, mT);
delay(100);
}
Interference, Calibration, and Mounting Gotchas
Magnetic field vectors are easily distorted by the physical environment. When prototyping on a workbench, a sensor might read perfectly, but fail completely when mounted in an enclosure. K&J Magnetics engineering resources highlight several physical phenomena that alter B-field geometry:
- Ferrous Chassis Distortion: Mounting a Hall sensor on a steel bracket or inside a steel enclosure creates a "flux return path." The steel pulls the magnetic field lines away from the sensor die, artificially lowering the measured Gauss and shifting the linear center-point. Always mount Hall sensors on non-magnetic substrates like FR4, aluminum, or 3D-printed PETG/ABS.
- EMI from PWM Motor Drivers: If you are using a Hall sensor for BLDC motor commutation or current sensing, the high di/dt switching nodes from your MOSFETs will induce noise in high-impedance analog traces. Keep analog Hall sensor traces under 2 inches, route them over a solid ground plane, and place a 100nF ceramic bypass capacitor directly across the VCC and GND pins of the sensor IC.
- Pole Misalignment: Hall sensors only measure the field perpendicular to the die. If your TO-92 sensor is soldered slightly crooked, or if a disc magnet is tilted by even 15 degrees, the cosine of the angle dictates the signal loss. A 15-degree tilt results in a ~3.5% drop in measured field strength. Use 3D-printed jigs to guarantee parallel alignment between the magnet face and the sensor face during assembly.
- Temperature Coefficient: NdFeB magnets lose roughly 0.12% of their field strength per degree Celsius increase. If your project operates in an automotive or outdoor environment (0°C to 60°C), expect a ~7% baseline shift in your magnet's output over temperature. For precision applications, read an onboard thermistor and apply a software temperature-compensation multiplier to your mT calculation.
By matching the correct magnet geometry to your sensor's specific linear range, wiring it to respect the IC's output architecture, and applying the exact transfer function math, you eliminate the trial-and-error guessing that plagues most hobbyist magnetic sensing projects.






