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.
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 Number | Type | Vcc Range | Output Signal | Interface | Typical Price |
|---|---|---|---|---|---|
| TI DRV5055A1 | Analog Linear | 2.3V to 5.5V | Ratiometric Voltage | Analog Pin | $1.20 |
| Honeywell SS49E | Analog Linear | 2.7V to 6.5V | Ratiometric Voltage | Analog Pin | $0.85 |
| Melexis MLX90393 | Triaxis Digital | 2.2V to 3.6V | 16-bit Data Words | I2C / SPI | $3.50 |
| TI DRV5012 | Digital Switch | 1.6V to 5.5V | Push-Pull Logic | Digital Pin (Interrupt) | $0.40 |
| Allegro A3144 | Digital Switch | 4.5V to 24V | Open-Drain Logic | Digital 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.
- Read the ADC:
int raw = analogRead(34);returns 2400. - Convert to Voltage:
V_out = 2400 * (3.3 / 4095) = 1.931V. - Subtract Offset:
1.931V - 1.65V = 0.281V(or 281 mV). - Divide by Sensitivity:
281 mV / 100 mV/mT = 2.81 mT.
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 Need | Required Output | Recommended Architecture | Concrete Part Pick |
|---|---|---|---|
| Continuous position, stroke, or field strength | Analog Voltage | Ratiometric Linear | TI DRV5055A1 (Default Pick) |
| High-precision 3-axis joystick or dial | I2C Digital | Triaxis Magnetometer | Melexis MLX90393 |
| Simple RPM counting, limit switch, or proximity | Digital Logic | Switch/Latch | TI 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.






