The Hall Effect Sensing Principle

When a current-carrying semiconductor is placed in a perpendicular magnetic field, the Lorentz force deflects the moving charge carriers (electrons or holes) toward one edge of the material. This physical deflection is the foundational mechanism behind every hall magnetic sensor on the market.

As charges accumulate on one side, they create a transverse electric field that opposes further deflection. This equilibrium generates a measurable potential difference across the material, known as the Hall voltage. In modern integrated circuits, this microvolt-level signal is immediately amplified, temperature-compensated, and routed to an output pin, allowing microcontrollers to read magnetic flux density directly.

Output Signals: Analog Voltage vs. Digital Logic

A common mistake in embedded design is conflating the output types of hall sensors. The output is strictly determined by the internal IC architecture, and you must select the right type for your firmware logic.

Analog (Linear) Output: The sensor outputs a continuous, ratiometric DC voltage. The voltage scales linearly with the magnetic flux density (measured in Gauss or millitesla). A zero-magnetic-field state typically outputs exactly half of the supply voltage (Vcc/2). Use this for measuring continuous position, stroke length, or field strength.
Digital (Switch/Latch) Output: The sensor outputs a binary logic level (HIGH or LOW). Internally, a Schmitt trigger compares the Hall voltage against a fixed threshold. A 'switch' turns on when a south pole approaches and turns off when it leaves. A 'latch' turns on with a south pole and stays on until a north pole is applied. Use this for RPM counting, limit switches, or simple proximity detection.

Wiring Reference and Supply Ranges

Before wiring, verify your microcontroller's logic level. Feeding a 5V analog sensor output into a 3.3V ESP32 GPIO will damage the ADC pin. Use the table below to match your sensor to your board.

Part NumberTypeVcc RangeOutput SignalInterfaceTypical Price
TI DRV5055A1Analog Linear2.3V to 5.5VRatiometric VoltageAnalog Pin$1.20
Honeywell SS49EAnalog Linear2.7V to 6.5VRatiometric VoltageAnalog Pin$0.85
Melexis MLX90393Triaxis Digital2.2V to 3.6V16-bit Data WordsI2C / SPI$3.50
TI DRV5012Digital Switch1.6V to 5.5VPush-Pull LogicDigital Pin (Interrupt)$0.40
Allegro A3144Digital Switch4.5V to 24VOpen-Drain LogicDigital Pin$0.30 (Legacy)

Note: The A3144 is largely obsolete and requires a pull-up resistor. For new 3.3V designs, the TI DRV5012 is the modern, low-voltage replacement.

Raw-to-Unit Math: ADC Reads to Millitesla

When using an analog hall magnetic sensor, your microcontroller reads a raw ADC integer. You must convert this to a physical unit (millitesla, mT) using the sensor's sensitivity and zero-offset. The TI DRV5055 datasheet defines the formula as:

B (mT) = (V_out - V_offset) / Sensitivity

Worked Example: ESP32 with DRV5055A1

Assume we are using an ESP32 (12-bit ADC, 4095 max, 3.3V reference) and a DRV5055A1 (Sensitivity = 100 mV/mT). At Vcc = 3.3V, the zero-field offset (V_offset) is nominally 1.65V.

  1. Read the ADC: int raw = analogRead(34); returns 2400.
  2. Convert to Voltage: V_out = 2400 * (3.3 / 4095) = 1.931V.
  3. Subtract Offset: 1.931V - 1.65V = 0.281V (or 281 mV).
  4. Divide by Sensitivity: 281 mV / 100 mV/mT = 2.81 mT.
ESP32 ADC Non-Linearity Warning: The ESP32's internal ADC is notoriously non-linear near 0V and 3.3V. If your Hall sensor outputs near the rails (strong magnetic fields), your readings will compress and lose accuracy. Keep your magnetic field strength within the middle 60% of the ADC range, or use an external I2C ADC like the ADS1115 for precision work.

Interference, Calibration, and the Default Pick

Hall sensors are highly susceptible to environmental noise. If your readings are jittery or drifting, check these three interference sources:

  • AC Mains EMI: 50Hz/60Hz alternating current in nearby wall wiring or power supplies induces a ripple in the Hall voltage. Fix this in firmware with a simple moving average filter, or in hardware with a 100nF ceramic capacitor between the Vout and GND pins.
  • Ferrous Enclosures: Steel screws, mounting brackets, or enclosures near the sensor will distort the local magnetic field lines, causing a permanent offset shift. Always mount hall sensors in plastic or aluminum housings, or calibrate the zero-offset after final mechanical assembly.
  • Temperature Drift: While modern ICs have internal temperature compensation, extreme thermal shifts still cause minor offset drift (typically measured in ppm/°C). For high-precision applications, read an onboard thermistor and apply a software compensation curve.

Decision Path: Which Sensor Should You Buy?

Use this decision matrix to terminate your part selection process. Do not default to generic 'KY-003' modules from Amazon for serious prototyping; they use unmarked, unbinned clones that lack datasheet sensitivity guarantees.

Application NeedRequired OutputRecommended ArchitectureConcrete Part Pick
Continuous position, stroke, or field strengthAnalog VoltageRatiometric LinearTI DRV5055A1 (Default Pick)
High-precision 3-axis joystick or dialI2C DigitalTriaxis MagnetometerMelexis MLX90393
Simple RPM counting, limit switch, or proximityDigital LogicSwitch/LatchTI DRV5012

The Default Bench Pick: If you are building a general-purpose analog measurement rig (like a fluid level float sensor or a linear actuator position tracker), buy the Texas Instruments DRV5055A1. It operates natively at 3.3V (safe for ESP32/Raspberry Pi Pico), has a predictable 100 mV/mT sensitivity, and costs roughly $1.20 in single quantities. Wire Vcc to 3.3V, GND to GND, and OUT to an ADC pin with a 100nF decoupling capacitor, and your raw-to-unit math will work exactly as calculated above.