An analog hall sensor outputs a continuous, ratiometric DC voltage proportional to magnetic flux density (measured in Gauss or milliTesla). When no magnetic field is present, the output sits exactly at half the supply voltage (Vcc/2). As a magnetic pole approaches, the voltage linearly ramps up toward Vcc (for a North pole) or down toward GND (for a South pole), allowing your microcontroller to measure both field strength and polarity.
The Physics: How the Hall Effect Generates Voltage
The sensing element inside an analog hall sensor is a thin slab of semiconductor material, typically indium antimonide or gallium arsenide. When you apply a supply voltage across this slab, a constant control current flows through it. If a magnetic field pierces the semiconductor perpendicularly, the Lorentz force deflects the moving charge carriers (electrons or holes) toward one edge of the material. This physical separation of charge creates a measurable transverse voltage across the slab, known as the Hall voltage.
Because the raw Hall voltage is only in the microvolt range, the sensor package includes an internal differential operational amplifier. This op-amp boosts the signal and biases it to a usable DC range. Unlike digital hall switches—which use an internal Schmitt trigger to snap a single pin HIGH or LOW at a fixed threshold—an analog hall sensor preserves the continuous linear gradient of the magnetic field, making it ideal for applications like joystick position sensing, linear actuator feedback, and non-contact current estimation.
Pinout, Wiring, and Supply Constraints
Analog hall sensors are notoriously simple to wire, but their ratiometric nature means your power supply quality directly dictates your measurement accuracy. If your 5V rail sags to 4.8V, the sensor's zero-point offset sags with it. Below is the standard 3-pin interface and a comparison of the two most common hobbyist part families.
| Parameter | SS49E (Honeywell / Generic) | DRV5053 (Texas Instruments) |
|---|---|---|
| Supply Range (Vcc) | 4.5V to 6.5V | 2.3V to 5.5V |
| Quiescent Current | ~6.0 mA | ~1.6 mA |
| Zero-Field Offset | 0.5 × Vcc (Ratiometric) | 0.5 × Vcc (Ratiometric) |
| Sensitivity (OA Variant) | ~1.4 mV/Gauss (at 5V) | 21 mV/mT (2.1 mV/Gauss) |
| Output Swing | 0.2V to Vcc - 0.2V | 0.1V to Vcc - 0.1V |
- Pin 1 (Vcc): Connect to 3.3V (for DRV5053) or 5V (for SS49E). Do not exceed the absolute maximum of 6.5V or the internal die will overheat.
- Pin 2 (GND): Connect to microcontroller GND. Keep this return path short to avoid ground loops.
- Pin 3 (OUT): Connect directly to an ADC pin (e.g., ESP32 GPIO 34 or Arduino A0). No series resistor is needed.
Translating Raw ADC Reads to Gauss (The Math)
The most common mistake makers make with analog hall sensors is treating the ADC reading as an absolute value. Because the output is ratiometric, you must convert the raw ADC integer into a voltage, subtract the zero-field offset, and then divide by the sensor's specific sensitivity.
The core formula to derive magnetic flux density (B) in Gauss is:
B (Gauss) = (V_out - V_offset) / Sensitivity
For the DRV5053OA powered at exactly 3.3V:
- V_offset: 3.3V / 2 = 1.65V (1650 mV)
- Sensitivity: 2.1 mV/Gauss
(2070 - 1650) / 2.1 = +200 Gauss (North pole).
On the ESP32, the native analogRead() function is notoriously non-linear, especially near the 0V and 3.3V rails. To bypass manual ADC calibration, use the ESP32's built-in analogReadMilliVolts() function, which leverages the chip's internal eFuse calibration data to return a highly accurate millivolt reading.
// ESP32 Analog Hall Sensor Reader (DRV5053OA at 3.3V)
#define HALL_PIN 34
#define VCC_MV 3300.0 // Measure your actual 3.3V rail with a multimeter
#define OFFSET_MV (VCC_MV / 2.0)
#define SENSITIVITY_MV_G 2.1 // 2.1 mV per Gauss for DRV5053OA
void setup() {
Serial.begin(115200);
analogReadResolution(12); // Ensure 12-bit resolution (0-4095)
}
void loop() {
// Read voltage directly in millivolts (ESP32 specific, skips non-linear ADC mapping)
int v_out_mv = analogReadMilliVolts(HALL_PIN);
// Calculate Gauss
float gauss = (v_out_mv - OFFSET_MV) / SENSITIVITY_MV_G;
// Convert to milliTesla (1 mT = 10 Gauss) for SI unit preference
float mT = gauss / 10.0;
Serial.printf("Voltage: %d mV | Field: %+.1f Gauss (%+.2f mT)\n", v_out_mv, gauss, mT);
delay(100);
}
Calibration, Scaling, and Interference Sources
Even with perfect math, real-world physics will corrupt your signal if you ignore environmental interference. Analog hall sensors are high-impedance, high-gain devices, making them magnets for noise. Here are the three primary interference sources and how to defeat them.
1. Electromagnetic Interference (EMI) from AC Mains
If your sensor wiring runs parallel to 120V/240V AC mains, the 50Hz or 60Hz alternating magnetic field will induce a ripple on your analog output line. You will see this as a ±10 to ±30 Gauss jitter in your serial monitor. The Fix: Solder a 100nF (0.1µF) ceramic decoupling capacitor directly across the Vcc and GND pins on the sensor breakout board, and use a twisted-pair cable for the signal run. In software, implement a 16-sample moving average filter to smooth out the AC ripple.
2. Ferrous Mounting Hardware
Mounting an analog hall sensor using a standard steel machine screw right next to the semiconductor die is a classic bench mistake. The steel screw acts as a flux concentrator, bending ambient magnetic fields (including the Earth's ~0.5 Gauss field) into the sensor and shifting your zero-point offset. The Fix: Always mount hall sensors using brass, nylon, or austenitic stainless steel (300-series) hardware, which are non-magnetic.
3. Temperature Drift
The sensitivity of the internal semiconductor changes with temperature, typically drifting by 0.1% to 0.2% per °C. If your sensor is mounted near a power resistor or a motor housing, a 30°C temperature spike can introduce a 5% gain error. For high-precision applications, read an onboard thermistor (like the ESP32's internal temp sensor or an external BME280) and apply a software temperature compensation multiplier based on the datasheet's drift curve.
Decision Matrix: Picking Your Sensor
Do not waste time trying to adapt a 5V sensor to a 3.3V microcontroller using a voltage divider; you will halve your ADC resolution and double your noise floor. Use this decision path to select the correct part for your specific microcontroller and application.
| IF your system requires... | THEN choose this part family | Why? |
|---|---|---|
| 3.3V logic (ESP32, RP2040, STM32) | DRV5053 (TI) | Natively swings 0.1V to 3.2V on a 3.3V rail, perfectly matching the ESP32's 12-bit ADC window without clipping. |
| 5V logic (Arduino Uno/Mega, legacy PLCs) | SS49E (Honeywell/Generic) | Cheap, widely available, and optimized for a 5V supply with a 1.4 mV/G sensitivity. |
| Measuring high AC/DC current (>50A) | ACS712 / ACS724 | Raw hall sensors cannot reject the massive common-mode fields of high-current busbars. Use an isolated Hall-effect current IC instead. |
| Detecting a simple open/close door state | US5881 (Digital Switch) | An analog output is overkill for binary states. A digital Hall switch eliminates the need for ADC calibration entirely. |






