The Physics: What a Hall Effect Sensor Actually Measures
A Hall effect sensor measures magnetic field strength and polarity by outputting a proportional voltage (analog) or a logic-level switch state (digital) when exposed to a magnetic field. At its core, it is a solid-state transducer that bridges the gap between invisible magnetic flux and measurable electrical signals, making it indispensable for position sensing, RPM counting, and current measurement in embedded systems.
The sensing principle relies on the Lorentz force. When a constant bias current flows through a thin semiconductor plate and a magnetic field passes perpendicularly through it, the charge carriers (electrons or holes) are deflected to one edge of the material. This charge accumulation creates a measurable transverse voltage—the Hall voltage. In practical integrated circuits, this microvolt-level signal is internally amplified, chopped to reduce offset errors, and temperature-compensated before it ever reaches the output pin.
Analog vs. Digital Outputs: Pinouts and Wiring
The most common beginner mistake is conflating analog linear sensors with digital switches. They share the same underlying physics but output entirely different signals. Analog sensors output a continuous, ratiometric voltage that scales with magnetic flux density (measured in milliTesla, mT). Digital sensors contain an internal Schmitt trigger and output a binary HIGH/LOW signal when the magnetic field crosses a specific threshold.
| Part Number | Type | Supply Range (VCC) | Output Stage | Pinout (1-2-3) |
|---|---|---|---|---|
| Allegro A3144 | Digital (Unipolar Switch) | 4.5V to 24V | Open-Drain (Requires Pull-up) | VCC, GND, OUT |
| Honeywell SS49E | Analog (Linear) | 2.7V to 6.5V | Push-Pull (Sources & Sinks) | VCC, GND, OUT |
| TI DRV5055 | Analog (Linear, High Precision) | 3.3V to 5.5V | Push-Pull (Ratiometric) | VCC, GND, OUT |
If you are using a digital sensor like the A3144, the output transistor only pulls the line to ground (LOW). It cannot drive the line HIGH. You must wire a 10kΩ pull-up resistor between the OUT pin and your microcontroller's logic voltage (e.g., 3.3V for ESP32). Analog sensors like the DRV5055 use push-pull outputs and can be wired directly to an ADC pin without pull-ups.
Converting Raw ADC Readings to Magnetic Flux Density
Digital sensors require no math—just read the GPIO state. But if you are using an analog sensor to measure continuous position or magnetic strength, you must convert the microcontroller's raw ADC integer into physical units (mT). The output voltage of a linear Hall sensor follows this formula:
V_out = V_Q + (B × Sensitivity)
Where:
• V_out is the measured voltage at the output pin.
• V_Q is the quiescent (zero-gauss) offset voltage. For a 3.3V supply, this is typically half the supply voltage (1.65V).
• B is the magnetic flux density in milliTesla (mT).
• Sensitivity is the manufacturer's specified mV/mT rating (e.g., 60 mV/mT for the DRV5055A1 at 3.3V).
Rearranging for B gives us the raw-to-unit math:
B = (V_out - V_Q) / Sensitivity
Here is a complete, copy-pasteable ESP32 Arduino snippet that reads a DRV5055 powered at 3.3V, applies a moving average filter to clean up noise, and outputs the exact magnetic field strength.
// ESP32 Analog Hall Effect Sensor (DRV5055A1) Interfacing
const int HALL_PIN = 34; // ADC1_CH6 (GPIO 34)
const float V_SUPPLY = 3.3;
const float V_Q = 1.65; // Quiescent voltage at 3.3V supply
const float SENSITIVITY = 0.060; // 60 mV/mT expressed in V/mT
const int ADC_MAX = 4095; // 12-bit resolution
// Moving average filter to reject 50/60Hz EMI
const int NUM_READINGS = 32;
int readings[NUM_READINGS];
int readIndex = 0;
long total = 0;
void setup() {
Serial.begin(115200);
analogReadResolution(12);
for (int i = 0; i < NUM_READINGS; i++) readings[i] = 2048;
}
void loop() {
total = total - readings[readIndex];
readings[readIndex] = analogRead(HALL_PIN);
total = total + readings[readIndex];
readIndex = (readIndex + 1) % NUM_READINGS;
float avg_adc = total / (float)NUM_READINGS;
float v_out = (avg_adc / ADC_MAX) * V_SUPPLY;
// Calculate Magnetic Flux Density (mT)
float b_field = (v_out - V_Q) / SENSITIVITY;
Serial.print("V_out: "); Serial.print(v_out, 3);
Serial.print("V | B-Field: "); Serial.print(b_field, 2);
Serial.println(" mT");
delay(50);
}
Calibration, Drift, and Common Interference
Even with the math above, raw readings will drift if you ignore real-world physics. Hall sensors are notoriously susceptible to three specific interference sources:
- Thermal Drift: The sensitivity (mV/mT) and the quiescent voltage (V_Q) shift as the silicon heats up. The DRV5055 includes internal temperature compensation, but if your microcontroller is enclosed in a hot box, expect a 0.1% to 0.2% drift per °C. Fix: Calibrate V_Q at operating temperature, not room temperature.
- Mechanical Stress (Piezoresistive Effect): Bending the PCB or applying uneven pressure to the sensor package during soldering alters the resistance of the Hall element, shifting the zero-gauss offset. Fix: Use a reflow profile with a controlled cool-down, and avoid mounting the sensor directly over a board flex line.
- AC Mains EMI: Running sensor wires parallel to 120V/240V AC lines induces 50/60Hz noise on the analog output trace. Fix: Use twisted-pair wiring for the sensor leads, keep a minimum 2-inch clearance from AC conduits, and implement the software moving-average filter shown in the code block above.
V_Q variable. This eliminates part-to-part manufacturing tolerances in the offset voltage.
Decision Tree: Which Hall Sensor Should You Buy?
Stop guessing based on whatever cheap assortment kit you bought online. Use this decision path to select the exact right component for your embedded project.
| Application Requirement | Required Output Type | Concrete Part Pick | Why This Part? |
|---|---|---|---|
| Measuring continuous linear position, fluid level, or exact magnetic field strength. | Analog (Linear) | TI DRV5055 (Specifically DRV5055A1QDBZR for 3.3V systems) | Superior linearity, low noise, and true ratiometric output at 3.3V. Eliminates the need for 5V-to-3.3V voltage dividers. |
| Counting gear teeth, measuring motor RPM, or acting as a simple proximity limit switch. | Digital (Unipolar Switch) | Allegro A3144 | Industry standard for RPM. High sensitivity to South pole, ignores North pole. Tolerates up to 24V, making it ideal for 12V automotive/marine environments. |
| Detecting the passing of alternating magnetic poles (e.g., BLDC motor commutation, encoder wheels). | Digital (Bipolar Latch) | Honeywell SS41 | Latches HIGH on South pole, latches LOW on North pole. Essential for direction-sensing and multi-pole ring magnets. |
The Default Recommendation: If you are building a general-purpose ESP32/Arduino project and need to measure how strong a magnet is or track smooth, continuous movement, buy the TI DRV5055A1QDBZR. If you just need to know if a magnet is present to count rotations or trigger an interrupt, buy the Allegro A3144 and remember your 10kΩ pull-up resistor.






