The Physics: How Does the Hall Effect Sensor Work?

When an electrical current flows through a semiconductor and a magnetic field is applied perpendicular to that current, the Lorentz force deflects the moving charge carriers to one side of the material. This accumulation of charge creates a measurable transverse voltage differential, known as the Hall voltage, which is directly proportional to the strength of the perpendicular magnetic field.

In modern integrated sensors like the ubiquitous SS49E, this microscopic Hall element is combined on a single silicon die with an on-chip differential amplifier, voltage regulator, and temperature compensation circuitry. The result is a robust, three-terminal component that outputs a continuous voltage or a crisp digital signal corresponding to the magnetic flux density (measured in Gauss or milliTesla) passing through the package.

Analog vs. Digital Outputs: What You Are Actually Measuring

A common mistake in embedded projects is conflating analog and digital Hall sensors. They share the same underlying physics but output entirely different signals.

  • Analog (Linear) Sensors: Output a continuous voltage (e.g., 0.5V to 4.5V). The quiescent (zero-magnetic-field) output is typically half the supply voltage. These are used for measuring how strong a magnetic field is, or calculating distance to a magnet.
  • Digital (Switch/Latch) Sensors: Output a clean HIGH or LOW logic level. They contain an internal Schmitt trigger and open-drain or push-pull transistor. These are used for detecting presence, counting RPMs, or acting as limit switches. They do not tell you the field strength, only whether it has crossed a specific threshold.

Wiring and Pinout Reference

Below is the standard pinout for a 3-pin through-hole or breakout-board Hall sensor (like the SS49E analog or US5881 digital). Always check your specific datasheet, but this 3-pin configuration is the industry standard.

PinFunctionESP32 / Arduino ConnectionNotes & Supply Range
1 (Left)VCC3.3V or 5V PinSupply range is typically 2.7V to 6.5V. Use 3.3V for direct ESP32 ADC compatibility.
2 (Middle)GNDGNDCommon ground with your microcontroller.
3 (Right)OUTGPIO (ADC or Digital)Analog: Outputs 0.5V-VCC. Digital: Open-drain (requires 10kΩ pull-up to VCC).
Pro Tip: If using a digital open-drain sensor with an ESP32, do not rely on the internal weak pull-up resistors. Wire a physical 10kΩ resistor from the OUT pin to 3.3V to ensure fast rise times and immunity to EMI.

Raw-to-Unit Math: Converting ADC Counts to Magnetic Flux

If you are using an analog sensor like the Honeywell SS49E with an ESP32, you need to convert the raw 12-bit ADC reading into a physical unit (Gauss). The SS49E is ratiometric, meaning its sensitivity and quiescent voltage scale with the supply voltage.

Assumptions for this math:

  • Supply Voltage (VCC) = 3.3V
  • Quiescent Voltage (Zero Gauss) = VCC / 2 = 1.65V
  • Datasheet Sensitivity at 5V = 1.4 mV/Gauss
  • Scaled Sensitivity at 3.3V = 1.4 × (3.3 / 5.0) = 0.924 mV/Gauss (or 0.000924 V/G)
  • ESP32 12-bit ADC resolution = 4095 steps across 3.3V

The Conversion Formula:

// 1. Convert raw ADC to Voltage
float voltage = (adc_raw / 4095.0) * 3.3;

// 2. Convert Voltage to Gauss
float gauss = (voltage - 1.65) / 0.000924;

// 3. Optional: Convert Gauss to milliTesla (1 mT = 10 Gauss)
float milliTesla = gauss / 10.0;

Note that the ESP32 ADC is notoriously non-linear near 0V and 3.3V. Fortunately, the SS49E's 1.65V quiescent point sits right in the most linear region of the ESP32's ADC curve, making it an excellent pairing.

Calibration, Scaling, and Interference Sources

Hall sensors are not plug-and-play for precision measurement without addressing three real-world interference sources:

  1. Zero-Offset Drift: The quiescent voltage is nominally VCC/2, but manufacturing tolerances mean it might actually be 1.62V or 1.68V. Fix: On boot, with no magnets present, read the ADC 100 times, average it, and store that value as your dynamic zero_offset variable instead of hardcoding 1.65V.
  2. Electromagnetic Interference (EMI): Running AC mains wires or high-current DC motor leads near the sensor will induce fluctuating magnetic fields. Fix: Keep sensor wiring under 6 inches, use twisted pairs for the power/ground, and implement a software low-pass filter (exponential moving average) in your code.
  3. Mechanical Stress (Piezoresistive Effect): Bending the sensor leads, aggressive soldering, or potting the sensor in hard epoxy can physically stress the silicon die, shifting the zero-offset. Fix: Use a low-stress potting compound (like soft silicone) and avoid bending the leads flush against the plastic body.

Decision Matrix: Which Hall Sensor Should You Buy?

Stop guessing which module to order. Use this decision path to select the exact part number for your embedded project.

Your ApplicationRequired OutputSensor TypeConcrete Part Number
Measuring magnetic field strength, current sensing, or distance to a magnetContinuous VoltageAnalog LinearSS49E (or DRV5055)
Counting RPM on a motor shaft, flow meter pulse countingDigital Pulse (Turns off when magnet leaves)Digital Unipolar SwitchUS5881 (or A3144)
Door/window open-close detection, brushless motor commutationDigital Latch (Stays on until reverse polarity applied)Digital LatchUS1881 (or SS411A)
Detecting presence regardless of magnetic polarity (North or South)Digital PulseDigital OmnipolarDRV5032 (or MLX92232)
The Default Recommendation: If you are prototyping a general-purpose magnetic sensor project and aren't sure which to pick, buy a 10-pack of the SS49E. It costs roughly $0.15 per unit, operates natively at 3.3V, and its analog output allows you to implement software thresholds (acting like a digital switch) or measure actual field strength later without changing hardware.