If you have been sourcing magnetic field sensors on Amazon or AliExpress, you have likely encountered the Halifax sensor. In the maker market, "Halifax" is the common marketplace moniker for the generic 49E series linear Hall-effect modules (often printed with "49E Halifax" on the blue PCB). It is functionally a clone of the Honeywell SS49E. Unlike the ubiquitous 3144 digital Hall switch which only outputs a binary HIGH/LOW when a magnet passes, the Halifax 49E outputs a continuous, ratiometric analog voltage proportional to the magnetic flux density. This makes it ideal for measuring exact distances, joystick positioning, or current sensing, provided you handle the analog-to-digital conversion correctly.
The "Halifax" Moniker and Linear Sensing Principle
The sensing element inside the 49E silicon is a thin piece of semiconductor material through which a constant bias current flows. When a magnetic field is applied perpendicular to this current, the Lorentz force deflects the charge carriers (electrons) to one side of the material. This accumulation of charge creates a transverse voltage potential known as the Hall voltage. Because the raw Hall voltage is only in the microvolt range, the 49E integrates an on-chip linear operational amplifier to boost the signal to a usable level.
The output of the Halifax sensor is strictly an analog ratiometric voltage, not a digital signal. "Ratiometric" means the output scales proportionally with the supply voltage (Vcc). With no magnetic field present, the output sits at exactly half of the supply voltage (Vcc/2). As a south magnetic pole approaches the branded face of the sensor, the voltage increases linearly; as a north pole approaches, the voltage decreases linearly. Understanding this ratiometric behavior is critical, as any noise or droop on your power supply will directly corrupt your magnetic field readings.
| Parameter | Min | Typical | Max | Unit |
|---|---|---|---|---|
| Supply Voltage (Vcc) | 2.7 | 5.0 | 6.5 | V |
| Quiescent Output (No Magnetic Field) | 2.25 | 2.50 | 2.75 | V (at 5V Vcc) |
| Magnetic Sensitivity | 1.0 | 1.4 | 1.75 | mV/Gauss (at 5V Vcc) |
| Linear Magnetic Range | - | ±1000 | - | Gauss |
| Output Noise (rms) | - | 30 | - | µV |
| Supply Current | - | 6.0 | 8.0 | mA |
Wiring, Pinout, and 3.3V Supply Constraints
Wiring the Halifax sensor to a 5V microcontroller like an Arduino Uno is straightforward, but interfacing it with a 3.3V logic microcontroller like the ESP32 or Raspberry Pi Pico requires careful attention to the supply range. The ESP32's GPIO pins are not 5V tolerant. If you power the Halifax module at 5V, the output pin can swing up to 5V under a strong magnetic field, which will permanently damage the ESP32's ADC pin.
For the cleanest signal and safest operation with an ESP32 DevKit V1, power the Halifax sensor directly from the ESP32's 3.3V pin. The 49E silicon operates natively down to 2.7V, so 3.3V is well within its acceptable supply range.
| Halifax Pin | Function | ESP32 DevKit Pin | Notes |
|---|---|---|---|
| VCC | Positive Supply | 3V3 | Do NOT use 5V (VIN) to protect the ADC. |
| GND | Ground Reference | GND | Keep ground wire short to avoid ground loops. |
| OUT | Analog Signal | GPIO 34 (ADC1_CH6) | GPIO 34 is input-only and has no internal pull-ups. |
Raw-to-Unit Math and ESP32 ADC Calibration
To convert the raw analog reading into a physical unit (Gauss or milliTesla), you must account for the ratiometric nature of the sensor and the specific quirks of the ESP32's 12-bit SAR ADC. When powered at 3.3V, the sensor's quiescent voltage (the baseline with no magnet present) drops from 2.5V to exactly 1.65V (3.3V / 2). The sensitivity also scales linearly: the typical 1.4 mV/G at 5V becomes approximately 0.924 mV/G at 3.3V.
The fundamental raw-to-unit math equation for magnetic flux density ($B$) in Gauss is:
B (Gauss) = (Vmeasured - Vquiescent) / Sensitivity
Where Vquiescent = 1.65V and Sensitivity = 0.000924 V/G (at 3.3V Vcc).
However, the ESP32's ADC is notoriously non-linear at the extremes of its 0-3.3V range. Readings below 0.1V and above 3.1V are highly inaccurate and compress heavily. Fortunately, because the Halifax sensor centers its output at 1.65V and typical hobby neodymium magnets will only swing the voltage by ±0.5V, your readings will fall safely in the 1.15V to 2.15V range, which is the most linear region of the ESP32 ADC. For precise measurement, refer to the Espressif ADC calibration documentation to implement the `esp_adc_cal` library in your firmware, which applies factory-stored eFuse calibration values to correct the raw 0-4095 integer into actual millivolts.
Here is the step-by-step scaling logic for your code:
- Read the raw 12-bit ADC value (0 to 4095).
- Convert the raw ADC value to millivolts using the calibrated ESP32 function (e.g., `esp_adc_cal_raw_to_voltage()`).
- Subtract the quiescent baseline (1650 mV) from the measured millivolts.
- Divide the result by the 3.3V sensitivity factor (0.924 mV/G) to get Gauss.
- Multiply by 0.1 if you need to convert Gauss to milliTesla (mT).
Interference Sources and Signal Conditioning
Linear Hall sensors are incredibly sensitive to environmental noise. Because the Halifax module outputs a high-impedance analog signal in the millivolt range, it acts as an antenna for electromagnetic interference (EMI). If your readings are jittery or drifting, it is almost always due to one of the three interference sources listed below.
| Interference Source | Symptom on ESP32 | Hardware Mitigation |
|---|---|---|
| Vcc Power Ripple | Constant high-frequency jitter (±10 to 20 ADC counts) even when stationary. | Solder a 100nF ceramic capacitor and a 10µF electrolytic capacitor directly across the VCC and GND pins on the sensor PCB. |
| Thermal Drift | Slow, continuous creep in the baseline reading as the room or PCB warms up. | Implement a software high-pass filter or take a baseline "zero" reading at startup before the motor/magnet heats the enclosure. |
| Magnetic EMI (Motors) | Massive spikes correlating with PWM motor switching or relay toggling. | Use twisted-pair wire for the sensor leads, keep the sensor >5cm away from DC motors, and use a mu-metal shield if necessary. |
| ADC Crosstalk | Readings change when other analog sensors (like an NTC thermistor) are polled. | Add a 10nF ceramic capacitor between the OUT pin and GND at the ESP32 GPIO to form a low-pass RC filter with the ADC's internal sampling impedance. |
For further reading on the physics governing these sensors, Electronics Tutorials provides an excellent breakdown of the Lorentz force mechanics and the Hall coefficient. By treating the Halifax 49E not just as a simple module, but as a precision ratiometric transducer, you can achieve sub-millimeter position resolution in your embedded projects.






