A linear magnetic hall sensor outputs a continuous analog voltage proportional to the magnetic flux density passing through it, measured in Gauss or milliTesla (mT). Unlike digital Hall switches that simply snap HIGH or LOW when a magnet crosses a threshold, linear variants like the Honeywell SS49E or Texas Instruments DRV5055 provide granular positional, proximity, or current-sensing data. If you are building a DIY throttle, a fluid level gauge, or a non-contact current meter, this is the component you need.

The direct answer to "what is the output?" is an analog DC voltage. However, getting clean, usable data from that voltage into an ESP32 requires navigating ratiometric scaling, ADC non-linearity, and environmental noise. Below is the complete bench-to-code guide for wiring, scaling, and calibrating these sensors.

How a Linear Magnetic Hall Sensor Actually Works

The sensing principle relies on the Lorentz force. When a bias current flows through a thin semiconductor element inside the sensor package, an external magnetic field deflects the moving charge carriers to one side of the material. This charge accumulation creates a measurable transverse voltage—the Hall voltage—which is amplified by internal op-amps and pushed to the output pin. The stronger the magnetic field perpendicular to the die, the higher the output voltage.

It is critical not to conflate linear sensors with digital Hall effect switches. A digital sensor (like the A3144) contains a Schmitt trigger and an open-drain MOSFET; it only outputs a 0V or Vcc logic level. A linear sensor lacks this trigger. Its output is a continuous analog waveform centered around a quiescent voltage (usually Vcc/2). If you wire a linear sensor to a digital interrupt pin expecting a clean square wave, your microcontroller will read floating noise or a constant state. Always route linear Hall outputs to an Analog-to-Digital Converter (ADC) pin.

Hardware Pinout and Wiring Specifications

Before wiring, you must select a sensor that matches your microcontroller's logic level, or use a voltage divider. The ESP32 GPIO pins are strictly 3.3V tolerant. Feeding a 5V sensor output directly into an ESP32 ADC pin will degrade the pin over time or destroy the silicon.

Table 1: Common Linear Magnetic Hall Sensor Specifications
Model Vcc Range Quiescent Vout (No Field) Sensitivity Best Use Case
Honeywell SS49E 2.7V - 6.5V Vcc / 2 1.4 mV/G (at 5V) General purpose, 3.3V or 5V systems
TI DRV5055 2.5V - 5.5V Vcc / 2 Varies by suffix (e.g., A1 = 10mV/mT) High-precision industrial positioning
Diodes AH3503 2.5V - 6.0V Vcc / 2 1.5 mV/G (at 3.3V) Native 3.3V ESP32/Raspberry Pi Pico
Melexis MLX90242 4.5V - 5.5V Vcc / 2 Programmable via EEPROM Automotive throttle / pedal sensors

For this guide, we will use the Honeywell SS49E powered at 5V, but we will step the analog output down to a safe 3.3V range for the ESP32 using a simple resistor voltage divider. This avoids the non-linear edges of the ESP32's ADC while maximizing resolution.

Table 2: ESP32 Wiring with 5V SS49E and Voltage Divider
SS49E Pin Function Wiring Destination Bench Notes
1 (Vcc) Power Supply 5V Rail (External or USB) Use a clean 5V source; noisy supplies inject ripple directly into the output.
2 (GND) Ground Common Ground (ESP32 + 5V) Crucial: ESP32 GND and 5V supply GND must be bonded together.
3 (Vout) Analog Output 10kΩ Resistor (R1) R1 connects to Vout. R2 (20kΩ) connects from the R1/R2 junction to GND.
N/A (Divider Tap) Scaled Signal ESP32 GPIO 34 (ADC1_CH6) GPIO 34 is input-only and lacks internal pull-ups, making it ideal for ADC.
Callout Tip: ESP32 ADC Attenuation
The ESP32 ADC natively reads up to ~1.1V. To read the full 0-3.3V range from our voltage divider, you must set the ADC attenuation to 11dB in your code. If you forget this, any voltage above 1.1V will max out the ADC reading at 4095, completely destroying your measurement resolution.

Raw ADC to Gauss: The Output Signal Math

Converting the raw 12-bit ADC reading (0-4095) into a physical magnetic field strength (Gauss) requires a two-step mathematical translation. First, we convert the digital integer back to a voltage. Second, we apply the sensor's sensitivity and quiescent offset.

Step 1: ADC to Voltage
The ESP32's ADC is notoriously non-linear at the extreme top and bottom of its range. Rather than using the basic analogRead() and multiplying by a hardcoded factor, use the ESP-IDF calibrated function analogReadMilliVolts() (available in Arduino core v2.0.0+). This applies factory-stored eFuse calibration data to correct the non-linearity.

// Read the calibrated voltage directly in millivolts
int adc_mV = analogReadMilliVolts(34); 
float v_out = adc_mV / 1000.0; // Convert to Volts (e.g., 2.20V)

Step 2: Voltage to Magnetic Flux Density (Gauss)
The SS49E is a ratiometric sensor. This means its quiescent voltage and sensitivity scale proportionally with the supply voltage. According to the Hall effect principles outlined by All About Circuits, if you power the sensor at exactly 5.0V, the quiescent voltage ($V_q$) is 2.5V, and the sensitivity ($S$) is 1.4 mV/G (0.0014 V/G).

However, because we used a voltage divider (10kΩ and 20kΩ) to protect the ESP32, the voltage arriving at the GPIO is scaled down by a factor of 0.666 ($20k / (10k + 20k)$). We must reverse this scaling before applying the Hall math.

// 1. Reverse the voltage divider scaling
float v_sensor = v_out / 0.666; 

// 2. Calculate Gauss
float v_quiescent = 2.5; // Vcc/2 for a 5V supply
float sensitivity = 0.0014; // 1.4 mV/G expressed in Volts

float magnetic_field_gauss = (v_sensor - v_quiescent) / sensitivity;

Worked Numeric Example:
Imagine a magnet is brought near the sensor. The ESP32 reads 1800 mV (1.8V) on GPIO 34.
1. Reversed divider voltage: $1.8V / 0.666 = 2.70V$ at the sensor pin.
2. Offset from quiescent: $2.70V - 2.50V = 0.20V$.
3. Gauss calculation: $0.20V / 0.0014 V/G = 142.8 Gauss$.
Because the voltage is higher than the quiescent midpoint, this indicates a South magnetic pole facing the branded side of the sensor.

Interference, Noise, and Real-World Calibration

On a clean lab bench, the math above works perfectly. In a real-world enclosure, a linear magnetic hall sensor will pick up a massive amount of environmental noise. The Texas Instruments DRV5055 datasheet and application notes extensively document how EMI and thermal drift degrade Hall measurements. Here are the three most common interference sources and how to defeat them.

1. Mains Hum and Switching Noise (EMI)
Hall sensors have high-impedance outputs and act as tiny antennas for 50Hz/60Hz mains hum and high-frequency switching noise from nearby buck converters. Fix: Place a 100nF (0.1µF) ceramic capacitor directly across the Vcc and GND pins of the sensor, as close to the plastic package as physically possible. Additionally, keep the analog trace short and avoid routing it parallel to AC mains wiring.

2. Ferrous Chassis Distortion
If you mount your sensor near a steel enclosure, iron brackets, or even carbon-steel screws, the magnetic field lines from your target magnet will bend toward the metal. This creates a non-linear "dead zone" or distorts your calibration curve. Fix: Use brass, stainless steel (austenitic 300-series is non-magnetic), or plastic hardware within a 1-inch radius of the sensor die.

3. Temperature Drift
The sensitivity of silicon Hall elements drifts with temperature, typically around -0.02% to -0.06% per °C. If your project moves from a 20°C indoor environment to a 40°C outdoor enclosure, your Gauss readings will skew. For high-precision applications, read the Espressif ADC Calibration API documentation to ensure your baseline voltage is stable, and consider implementing a software lookup table if you have an onboard thermistor.

Bench Mistake to Avoid: Vcc Sag
A common error is assuming your 5V USB rail is exactly 5.00V. In reality, a loaded USB port might sag to 4.75V. Because the sensor is ratiometric, a drop in Vcc lowers your quiescent voltage from 2.50V to 2.375V. If your code hardcodes 2.5V as the zero-point, your sensor will read a phantom magnetic field of nearly 90 Gauss even when no magnet is present. Always measure your actual Vcc with a multimeter and update the v_quiescent variable in your code accordingly.

Calibration Procedure (Numbered Steps)

  1. Establish Zero-Field Baseline: Remove all magnets and ferrous tools from the workbench. Power the circuit and read the raw ADC millivolts. Average 100 samples to find your true v_quiescent value.
  2. Verify ADC Attenuation: Ensure your code sets analogSetPinAttenuation(34, ADC_11db) (or uses the modern analogReadMilliVolts which handles this automatically). If your baseline reads ~1100mV and refuses to go higher, your attenuation is wrong.
  3. Map the Physical Travel: Move your target magnet through its full mechanical range. Record the minimum and maximum Gauss values. If the values clip at the ESP32's 3.3V limit, increase the resistance of R1 in your voltage divider.
  4. Implement Software Filtering: Apply a simple Exponential Moving Average (EMA) filter in your loop to smooth out high-frequency EMI spikes without introducing the lag of a large rolling average buffer.
// Simple EMA Filter for Hall Sensor
float alpha = 0.1; // Lower = smoother but more lag
float filtered_gauss = 0;

void loop() {
  float current_gauss = read_hall_sensor(); // Your math function
  filtered_gauss = (alpha * current_gauss) + ((1.0 - alpha) * filtered_gauss);
  delay(10);
}

By respecting the analog nature of the linear magnetic hall sensor, properly scaling the voltage for 3.3V logic, and accounting for ratiometric drift, you can achieve sub-millimeter positional accuracy or highly reliable current sensing on a hobbyist budget.