A Hall effect sensor is a solid-state transducer that outputs a specific voltage, current, or digital signal in response to an applied magnetic field. If you are asking what is the hall sensor in the context of microcontrollers, it is fundamentally a magnetic-to-electrical converter used for proximity detection, position tracking, RPM counting, and current sensing. The output is strictly defined by the IC variant: it is either a ratiometric analog voltage that scales linearly with magnetic flux density, or a digital open-drain signal that pulls low when a specific magnetic threshold is crossed.
Choosing between these outputs dictates your entire circuit design. Digital Hall sensors (like the A3144) act as simple switches requiring a pull-up resistor, while analog linear sensors (like the SS49E) require an Analog-to-Digital Converter (ADC) and mathematical scaling to translate millivolts into physical units like Gauss or milliTesla (mT). Conflating the two is the most common reason hobbyists fry their microcontroller pins or get wildly inaccurate readings.
The Physics: How a Hall Effect Sensor Works
The sensing principle relies on the Lorentz force. When a constant control current flows through a thin semiconductor element (the Hall plate) and a magnetic field is applied perpendicular to that current, the moving charge carriers (electrons or holes) are deflected to one side of the material. This physical separation of charge creates a measurable transverse voltage across the plate, known as the Hall voltage.
Because the raw Hall voltage is typically in the microvolt range, modern Hall ICs integrate a differential amplifier, a voltage regulator, and temperature compensation circuitry on the same silicon die. The amplifier boosts the microvolt signal to a usable level (usually 0.5V to 4.5V), while the temperature compensation network cancels out the semiconductor's natural thermal drift, ensuring the output remains strictly proportional to the magnetic field rather than the ambient heat.
Spec Sheet: Choosing the Right Hall Effect IC
Before wiring anything, you must select the correct IC for your application. Below is a data-dense comparison of the most common Hall sensors found on the bench, detailing their exact operating parameters and output behaviors.
| Part Number | Type | Supply Range (VCC) | Output Type | Sensitivity / Threshold | Quiescent Current |
|---|---|---|---|---|---|
| A3144 | Digital (Unipolar) | 4.5V to 24.0V | Open-Collector (Digital) | Operate: ~30G / Release: ~15G | ~4.0 mA |
| SS49E | Analog (Linear) | 2.7V to 6.5V | Ratiometric Voltage | ~1.4 mV/Gauss (at 5.0V) | ~6.0 mA |
| DRV5055 | Analog (Linear) | 2.5V to 5.5V | Ratiometric Voltage | Up to 100 mV/mT (variant dependent) | ~3.5 mA |
| TLE493D | Digital (3D I2C) | 2.7V to 3.6V | I2C Digital (13-bit/axis) | Programmable via I2C registers | ~0.2 mA (Low power mode) |
| ACS712 | Analog (Current) | 4.5V to 5.5V | Ratiometric Voltage | 185 mV/A (20A variant) | ~8.0 mA |
Wiring, Pinouts, and Power Supply Ranges
Most through-hole Hall sensors use a standard 3-pin TO-92 or SOT-23 package. When looking at the flat face of a TO-92 package with the leads pointing down, the pins are numbered 1, 2, and 3 from left to right. Always verify this against the specific datasheet, as some SMD variants reverse the pinout.
| Pin | Function | Wiring to ESP32 / Arduino | Critical Notes |
|---|---|---|---|
| 1 | VCC (Supply) | 3.3V or 5V (Must match MCU logic if analog) | Add a 100nF ceramic decoupling capacitor directly across Pin 1 and Pin 2 to filter high-frequency EMI. |
| 2 | GND (Ground) | Common Ground with MCU | Ensure a star-ground topology; do not share this ground return path with high-current motor drivers. |
| 3 | OUT (Signal) | ADC Pin (Analog) or GPIO (Digital) | Digital outputs (A3144) require a 10kΩ pull-up resistor to VCC. Analog outputs (SS49E) drive the pin directly. |
Digital vs. Analog Wiring Differences
If you are using a digital sensor like the A3144, the output pin is an open-collector NPN transistor. It can sink current to ground but cannot source voltage. You must wire a 10kΩ resistor between the OUT pin and your microcontroller's VCC (3.3V). When a magnet is near, the transistor turns on, pulling the GPIO pin to 0V (LOW). When the magnet is removed, the pull-up resistor pulls the pin to 3.3V (HIGH).
If you are using an analog linear sensor like the SS49E, the output pin is driven by an internal push-pull op-amp. It actively sources and sinks current, outputting a continuous voltage. Wire this directly to your microcontroller's ADC pin. Do not use a pull-up or pull-down resistor on an analog Hall sensor output, as it will create a voltage divider and ruin your ratiometric scaling.
Output Math: Converting Raw ADC to Magnetic Flux
The raw ADC reading from a microcontroller is useless on its own. To find the actual magnetic flux density (B) in Gauss or milliTesla, you must apply the sensor's sensitivity and null-voltage offset. We will use the Honeywell SS49E as our working example, powered at 5.0V and read by a 12-bit ADC.
The Raw-to-Unit Formula
For a ratiometric linear Hall sensor, the output voltage at zero magnetic field (the null voltage) is exactly half of the supply voltage. For a 5.0V supply, V_null = 2.5V. The sensitivity of the SS49E is nominally 1.4 mV/Gauss (or 14 mV/mT).
The physical math is:
B (Gauss) = (V_out - V_null) / Sensitivity
B (Gauss) = (V_out - 2.5) / 0.0014
Translating to Microcontroller ADC Code
Microcontrollers do not read volts; they read digital steps. If you are using an Arduino Uno (10-bit ADC, 0-1023 steps, 5V reference), each step is 4.88 mV. However, if you are using an ESP32 with its 12-bit ADC (0-4095 steps), the math requires handling the ADC's known non-linearity at the voltage rails.
Here is the exact C++ implementation for an ESP32 reading an SS49E powered at 3.3V:
// SS49E Math for ESP32 (3.3V VCC, 12-bit ADC)
const int HALL_PIN = 34; // ADC1_CH6 (GPIO 34)
const float VCC = 3.3;
const float ADC_MAX = 4095.0;
const float SENSITIVITY_MV_GAUSS = 0.924; // 1.4 mV/G scaled down for 3.3V VCC
const float NULL_VOLTAGE = VCC / 2.0; // 1.65V
void setup() {
Serial.begin(115200);
analogReadResolution(12);
}
void loop() {
int raw_adc = analogRead(HALL_PIN);
// Convert raw ADC to Voltage
float v_out = (raw_adc / ADC_MAX) * VCC;
// Convert Voltage to Gauss
float gauss = ((v_out - NULL_VOLTAGE) * 1000.0) / SENSITIVITY_MV_GAUSS;
// Convert Gauss to milliTesla (10 Gauss = 1 mT)
float mT = gauss / 10.0;
Serial.printf("Raw: %d | V: %.2f | Gauss: %.1f | mT: %.2f\n", raw_adc, v_out, gauss, mT);
delay(100);
}
Calibration and Interference Sources
If your serial monitor shows a non-zero Gauss reading when no magnet is present, you are experiencing offset drift. Calibration is mandatory for analog Hall sensors. In your code, read the sensor 100 times at startup with no magnets nearby, average the raw ADC values, and store that as your dynamic NULL_ADC offset instead of hardcoding the theoretical VCC/2 value.
When deploying Hall sensors in real-world environments, you must account for three primary interference sources:
- AC Electromagnetic Interference (EMI): Routing Hall sensor wires parallel to 120V/240V AC mains cables will induce 50/60Hz noise on the analog output. Keep signal wires short, use shielded twisted-pair cable for runs over 12 inches, and rely on the 100nF decoupling capacitor at the sensor pins.
- Thermal Drift: While internal circuitry compensates for the Hall element's drift, the sensitivity itself shifts by roughly -0.02%/°C. If your sensor is mounted near a hot motor or power resistor, expect a 2% to 5% reading error across a 40°C temperature swing.
- Ferrous Metal Proximity: Mounting a Hall sensor directly to a steel chassis or using steel-core screws near the TO-92 package will distort the magnetic flux lines. The steel acts as a magnetic shunt, pulling the field away from the sensor die. Always mount Hall sensors using brass, plastic, or non-magnetic stainless steel (300-series) hardware.






