When sourcing magnetic field detectors for global projects or navigating international datasheets, you will frequently encounter the term sensores hall (Hall effect sensors). Whether you are building a brushless DC motor commutator, a non-contact current shunt, or a magnetic encoder, knowing exactly what comes out of the signal pin is critical. The direct answer: analog Hall sensors output a ratiometric voltage centered at VCC/2, while digital ones output a clean HIGH/LOW logic level triggered by a specific Gauss threshold. Conflating the two will result in fried GPIO pins or erratic ADC noise.

The Sensing Principle and Output Types

Hall effect sensors rely on the Lorentz force. When a bias current flows through a thin semiconductor wafer and a perpendicular magnetic field is applied, the charge carriers are deflected to one side of the wafer. This accumulation of charge creates a measurable transverse voltage (the Hall voltage) proportional to the magnetic flux density.

In practice, this microvolt-level Hall voltage is amplified by internal op-amps before reaching the output pin. Analog sensores hall (like the SS49E or A1324) output a continuous voltage that scales linearly with magnetic field strength, typically resting at VCC/2 when no magnet is present. Digital sensors (like the US1881) use an internal Schmitt trigger to snap the output to GND or VCC, acting as a simple proximity switch. Feeding a digital open-drain output into an ESP32 ADC will just yield erratic noise; you must match the sensor output type to the correct microcontroller peripheral.

Common Sensores Hall Specifications (Analog vs Digital)
Part Number Type Supply Range (V) Quiescent Output Sensitivity / Threshold
SS49E Analog Linear 2.7 - 6.5V VCC / 2 1.4 mV/Gauss
A1324 Analog Linear 4.5 - 5.5V VCC / 2 2.5 mV/Gauss
US1881 Digital (Latched) 3.5 - 24V Pull-up to VCC Operate: 150G / Release: 100G
DRV5012 Digital (Omni) 1.65 - 5.5V Push-pull Operate: 3.5mT / Release: 2.0mT

Wiring Pinout and ESP32 ADC Quirks

Interfacing an analog Hall sensor with an ESP32 requires careful attention to voltage levels. The ESP32's ADC is notoriously non-linear near 0V and 3.3V, and its GPIO pins are strictly limited to 3.3V. If you power a 5V analog sensor, its quiescent output is 2.5V. A strong magnet could push that output to 4.5V, instantly damaging the ESP32's ADC circuitry.

The safest bench practice is to power the SS49E directly from the ESP32's 3.3V rail. The SS49E operates down to 2.7V, making it fully compatible. This sets the quiescent voltage to ~1.65V, safely in the middle of the ESP32's readable ADC window.

Bench Tip: Never use GPIO 34, 35, 36, or 39 for digital Hall sensors. These are input-only pins on the ESP32 and lack internal pull-up resistors. If you use an open-drain digital sensor like the US1881 on these pins without an external 10kΩ pull-up resistor, the pin will float and trigger phantom interrupts.
SS49E to ESP32 Wiring Map
SS49E Pin Function ESP32 Connection Notes
1 (VCC) Supply (2.7-6.5V) 3V3 Keep at 3.3V to protect ESP32 ADC
2 (GND) Ground GND Common ground required
3 (OUT) Analog Output GPIO 34 (ADC1_CH6) Use ADC1; ADC2 conflicts with WiFi

Raw-to-Unit Math and Calibration

Reading the raw ADC value is useless without converting it to a physical unit like Gauss or milliTesla (mT). The ESP32 Arduino Core (v2.x and later) includes the analogReadMilliVolts() function, which uses the chip's internal eFuse calibration data to return a highly accurate millivolt reading, bypassing the raw 12-bit integer non-linearity.

Here is the exact math to convert millivolts to Gauss for an SS49E powered at 3.3V:

  1. Establish Quiescent Voltage (Vq): With no magnetic field present, the output is VCC/2. For a 3.3V supply, Vq = 1650 mV.
  2. Calculate Delta Voltage: Subtract Vq from your measured millivolt reading. Delta_V = Measured_mV - 1650.
  3. Apply Sensitivity Scaling: The SS49E datasheet specifies a sensitivity of 1.4 mV/Gauss. Divide the Delta_V by 1.4 to get the field strength in Gauss.
  4. Convert to Tesla: 1 Tesla = 10,000 Gauss. Divide the Gauss value by 10,000 to get Tesla, or by 10 to get milliTesla (mT).
Calibration Requirement: Manufacturing tolerances mean your specific sensor's Vq might be 1620 mV or 1680 mV, not exactly 1650 mV. Always run a calibration routine on boot with no magnets in the room to capture the true Vq offset.

Interference, Edge Cases, and Debugging

Magnetic sensing on a noisy workbench introduces several interference sources that can ruin your data. According to Texas Instruments' Hall sensor design guides, the most common culprits are temperature drift and EMI.

1. EMI and Switching Noise: The internal op-amps in analog sensores hall have high gain and will happily demodulate RF noise from nearby buck converters or BLDC motor drivers. You must place a 0.1µF ceramic bypass capacitor directly across the VCC and GND pins of the sensor, as close to the plastic package as physically possible. A capacitor on the breadboard power rails is not enough; the leads act as antennas.

2. Magnetic Saturation: A bare N52 neodymium magnet can produce >5,000 Gauss at its surface. The SS49E saturates around ±1,000 Gauss. If you place an N52 magnet directly on the sensor, the output will rail at 0V or 3.3V and stay there until the magnet is moved away. If you need to measure strong fields, increase the air gap or choose a low-sensitivity sensor like the A1302 (1.3 mV/G).

3. ADC2 vs WiFi Conflict: If your ESP32 is connected to WiFi (e.g., sending MQTT sensor data), you cannot use ADC2 pins (GPIO 0, 2, 4, 12-15, 25-27). The WiFi driver monopolizes ADC2. Always route analog sensores hall to ADC1 pins (GPIO 32-39) to prevent read failures.

Complete ESP32 Calibration and Reading Code

The following code implements the raw-to-unit math, handles the Vq calibration on boot, and filters out 50/60Hz mains hum using a simple oversampling technique. For deeper ESP32 ADC configuration details, refer to the Espressif ADC Calibration API documentation.


// ESP32 Analog Hall Sensor (SS49E) Interfacing Code
// Target: ESP32 DevKit V1 | Core: Arduino-ESP32 v2.x+

const int HALL_PIN = 34;       // ADC1_CH6 (Input only, no pull-ups)
const float SENSITIVITY = 1.4; // SS49E: 1.4 mV/Gauss
float quiescent_mV = 1650.0;   // Default VCC/2 for 3.3V system

void calibrateSensor() {
  long sum = 0;
  int samples = 256;
  Serial.println("Calibrating... keep magnets away!");
  for (int i = 0; i < samples; i++) {
    sum += analogReadMilliVolts(HALL_PIN);
    delay(2);
  }
  quiescent_mV = (float)sum / samples;
  Serial.printf("Calibrated Vq: %.2f mV\n", quiescent_mV);
}

void setup() {
  Serial.begin(115200);
  delay(1000);
  analogReadResolution(12); // Ensure 12-bit resolution
  calibrateSensor();
}

void loop() {
  // Oversample to reduce EMI noise
  long mv_sum = 0;
  for (int i = 0; i < 16; i++) {
    mv_sum += analogReadMilliVolts(HALL_PIN);
  }
  float measured_mV = mv_sum / 16.0;
  
  // Raw-to-Unit Math
  float delta_V = measured_mV - quiescent_mV;
  float gauss = delta_V / SENSITIVITY;
  float milliTesla = gauss / 10.0;
  
  Serial.printf("Raw: %.1f mV | Delta: %.1f mV | Field: %.2f G (%.3f mT)\n", 
                measured_mV, delta_V, gauss, milliTesla);
  
  delay(100);
}

By respecting the voltage boundaries of the ESP32, applying the correct ratiometric math, and filtering out high-frequency EMI at the source, you can achieve highly reliable magnetic field measurements. Whether your datasheets label them as Hall effect transducers or sensores hall, the physics and the math remain exactly the same.